Citeck ECOS Flowable integration
Install
Flowable workflow components (configuration bean, WorkflowComponent and TaskComponent implementation and other services) located in module ecos-flowable-repo. To start and register Flowable workflow components, it's necessary to set connection parameters to the external database in alfresco-global.properties file and download Flowable WARs.
flowable.db.url=jdbc:postgresql://127.0.0.1/bpm_service flowable.db.username=bpm_service flowable.db.password=123123 flowable.db.driver.class.name=org.postgresql.Driver
On application start if database connection parameters are set correctly, all Flowable workflow components will be automatically registered, including global GlobalTaskListeners and GlobalExecutionListener (Task and Execution listeners are called on every tasks and executions).
Process definition deploying
To deploy process definitions via bootstrap mechanism, need to create a spring-bean with parent "workflowDeployer" and set to properties lists of models, labels, and process definitions. For flowable process definitions required to set <prop key="engineId">flowable</prop> (WorkflowService recognize engines implementation by prefix)
<bean id="idocs.workflowBootstrap" parent="workflowDeployer"> <property name="workflowDefinitions"> <list> <props> <prop key="engineId">flowable</prop> <prop key="location">alfresco/module/idocs-repo/workflow/case-perform/case-perform.bpmn20.xml</prop> <prop key="mimetype">text/xml</prop> <prop key="redeploy">true</prop> </props> </list> </property> <property name="models" ref="idocs.workflowModelsList" /> <property name="labels" ref="idocs.workflowLabelsList" /> </bean>
Bean of list of model definitions xml files
<util:list id="idocs.workflowModelsList"> <value>alfresco/module/idocs-repo/workflow/confirm-workflow/confirm-workflow-model.xml</value> </util:list>
Bean of list of labels properties resource files
<util:list id="idocs.workflowLabelsList"> <value>alfresco/module/idocs-repo/workflow/confirm-workflow/confirm-workflow</value> </util:list>
Script Listeners
For script execution on tasks or executions events are used ru.citeck.ecos.flowable.listeners.FlowableScriptExecutionListener and ru.citeck.ecos.flowable.listeners.FlowableScriptTaskListener. They implement org.flowable.engine.delegate.ExecutionListener and org.flowable.engine.delegate.TaskListener respectively. There're available fields:
Field | Description |
---|---|
script | Script expression |
language | Script language. Default value is javascript |
resultVariable | Script execution result variable |
Example of script execution
<activiti:executionListener event="start" class="ru.citeck.ecos.flowable.listeners.FlowableScriptExecutionListener"> <activiti:field name="script"> <activiti:expression> if(execution.getVariable("bpm_workflowDescription") == "" || execution.getVariable("bpm_workflowDescription") == null) { if(execution.getVariable("document") != null) { execution.setVariable("bpm_workflowDescription", document.name); } } if(execution.getVariable("wfcf_hasMandatoryConfirmers") == null) { execution.setVariable("wfcf_hasMandatoryConfirmers", false); } </activiti:expression> </activiti:field> </activiti:executionListener>
Spring services inside scripts available via services.get("bean-name").method() or extending BaseScopableProcessorExtension and creating bean with necessary parent. For example:
<bean name="FlowableConfirmableVersionJS" class="ru.citeck.ecos.flowable.example.FlowableConfirmableVersionJS" parent="baseJavaScriptExtension"> <property name="extensionName" value="flowableVersions" /> <property name="impl" ref="FlowableConfirmHelper" /> </bean>
Global Execution Listeners
Interfaces for spring-bean objects for Global Execution Listeners (execute for all process definitions). All interfaces extend org.flowable.engine.delegate.ExecutionListener interface. Necessary to implement an interface and create spring-bean of interface implementation. Execution listeners will be automatically registered.
Interface | Event type |
---|---|
ru.citeck.ecos.flowable.listeners.global.GlobalStartExecutionListener | start |
ru.citeck.ecos.flowable.listeners.global.GlobalTakeExecutionListener | take |
ru.citeck.ecos.flowable.listeners.global.GlobalEndExecutionListener | end |
Global Task Listeners
Interfaces for spring-bean objects for Global Task Listeners (execute for all tasks). All interfaces extend org.flowable.engine.delegate.TaskListener interface. Necessary to implement an interface and create spring-bean of interface implementation. Task listeners will be automatically registered.
Interface | Event type |
---|---|
ru.citeck.ecos.flowable.listeners.global.GlobalCreateTaskListener | create |
ru.citeck.ecos.flowable.listeners.global.GlobalAssignmentTaskListener | assignment |
ru.citeck.ecos.flowable.listeners.global.GlobalCompleteTaskListener | complete |
ru.citeck.ecos.flowable.listeners.global.GlobalDeleteTaskListener | delete |
ru.citeck.ecos.flowable.listeners.global.GlobalAllTaskListener | all |
Flowable-modeler war files and properties files locations
Flowable comes with convenient tools for process definitions development. Flowable-modeler allows to create process definitions via graphical designer and publish them to the database (e.g. to the database which flowable ecos-community refers). You need to deploy modeler, idm and rest applications on another Tomcat Server instance and change properties files (change database source, set idm-application url, set datasource for rest-api for publishing process definitions).
Link to flowable-modeler - https://github.com/flowable/flowable-engine/releases/download/flowable-6.3.0/flowable-6.3.0.zip
Link to tomcat configuration descriptors -
War file name | .properties file path | Parameters |
---|---|---|
flowable-admin | /flowable-admin/WEB-INF/classes/application.properties | Flowable database connection parameters spring.datasource.driver-class-name flowable.common.app.idm-url - flowable-idm application url (e.g. Local Tomcat on port 8080 - http://localhost:8080/flowable-idm) flowable.common.app.idm-admin.user - admin username flowable.common.app.idm-admin.password - admin password Rest integration API flowable.admin.app.server-config.process.server-address flowable.admin.app.server-config.cmmn.server-address flowable.admin.app.server-config.dmn.server-address flowable.admin.app.server-config.form.server-address flowable.admin.app.server-config.content.server-address |
flowable-idm | /flowable-idm/WEB-INF/classes/application.properties | Flowable database connection parameters spring.datasource.driver-class-name flowable.idm.app.admin.user-id - admin username flowable.idm.app.admin.password - admin password |
flowable-modeler | /flowable-modeler/WEB-INF/classes/application.properties | Flowable database connection parameters spring.datasource.driver-class-name flowable.common.app.idm-url - flowable-idm application url (e.g. Local Tomcat on port 8080 - http://localhost:8080/flowable-idm) flowable.modeler.app.deployment-api-url - deployment api url (e.g. http://localhost:8080/flowable-task/process-api ) |
flowable-rest | /flowable-rest/WEB-INF/classes/application.properties | Flowable database connection parameters spring.datasource.driver-class-name flowable.rest.app.admin.user-id - admin username flowable.rest.app.admin.password - admin password flowable.rest.app.create-demo-definitions - creation demo data flag |
flowable-task | /flowable-task/WEB-INF/classes/application.properties | Flowable database connection parameters spring.datasource.driver-class-name flowable.common.app.idm-url - flowable-idm application url (e.g. Local Tomcat on port 8080 - http://localhost:8080/flowable-idm) flowable.common.app.idm-admin.user - admin username flowable.common.app.idm-admin.password - admin password |