Activiti (http://activiti.org/) is a light-weight workflow and Business Process Management (BPM) Platform targeted at business people, developers and system admins. Its core is a super-fast and rock-solid BPMN 2 process engine for Java.
This module helps running activiti inside Ninja framework (http://www.ninjaframework.org/).
-
Add the ninja-activiti-module dependency to your pom.xml:
ir.cafebabe.ninja ninja-activiti-module 0.0.1 -
Install the module in your conf.Module:
@Override protected void configure() { install(new ActivitiModule()); }
-
All set! Start Ninja application and activiti engine will be started with an in-memory database and default configs. you can inject activiti ProcessEngine, FormService, TaskService, ... in your code.
@Singleton public class Sample {
@Inject ProcessEngine processEngine; @Inject FormService formService; @Inject HistoryService historyService; @Inject IdentityService identityService; @Inject RepositoryService repositoryService; @Inject RuntimeService runtimeService; @Inject ManagementService managementService; @Inject TaskService taskService;
}
-
You can create activiti.cfg.xml in 'conf' directory. This file will be used as a default activiti configurations. for more detail on how to use the file refer to "www.activiti.org/userguide/".
-
You can also choose the "configuration file" in conf/application.conf.
activiti.cfg.path=conf/my.activiti.cfg.xml %test.activiti.cfg.path=conf/mytest.activiti.cfg.xml
-
There is also possibility to set activiti configuration in conf/application.conf file without providing activiti xml configuration file.
... activiti.jdbcDriver=org.h2.Driver activiti.jdbcUrl=jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000 activiti.jdbcUsername=sa activiti.jdbcPassword= activiti.mailServerHost=localhost ...
consult activiti documents for list of all process engine configurations "www.activiti.org/userguide/".
-
Mixed-mode: You can also mix xml and property configuration. by providing both activiti.cfg.xml file and ninja properties(conf/application.conf). configs in conf/application.conf overrides xml configuration.
-
No configuration: If there was no configuration, the default activiti configurations with an in-memory database will be applied.
Step1) If Default activiti.cfg.xml is provided it will be read unless you explicitly set the config file path in "conf/application.conf" --> activiti.cfg.path=conf/my.activiti.cfg.xml
Step2) If there are activiti configuration in "conf/application.conf" they will be override xml configurations.