Limit Workflow
The Limits Module provides a few workflows out of box with Activiti. The complete tutorial of Activiti can be found on the Activiti website.
This section shows you how to use the out-of-box workflow.
You can find the Business Process Modeling Notation (BPMN) files in the limits-starter/src/main/resources/processes folder. bpmn files are in the XML format, however, we recommend that you install the Activiti Diagram Editor plugin in your IDE, such as Intellij or Eclipse, to edit and read the bpmn files in a nice UI workflow representation.
The events when the workflow kicks in are:
- Limits change: a new limit is created through the UI.
- When a breach occurs after the limit evaluation.
- When a warning occurs after the limit evaluation.
You can set up the workflow for each of the above occasions.
limit-process-definition.bpmn
This workflow controls who can create the new limit. If a logged-in user is authorized to create a new limit, after a new limit is created, the Limits Module starts the approval workflow, either one approval or two-approval below.
This shows the role group “Managers”, is authorized to execute this workflow. In the Limits Module, it is the limit creation:
<process id="limit-process-definition" isExecutable="true" activiti:candidateStarterGroups="MANAGERS">
All serviceTasks need to have the associated Bean defined in the java file: Location: limits-activeviam/src/main/java/com/activeviam/limits/workflow/definition File name: LimitsProcessDefinitionWorkflowService.java
For example:
limit-process-definition.bpmn defines
<serviceTask id="create.Activity" name="PUBLISHING" implementation="signOffProcessDefinitionCreate"/>
LimitsProcessDefinitionWorkflowService.java defines
@Bean("signOffProcessDefinitionCreate") public Connector executeCreate() { return executeCreate(null, null); }
limit-process-four-eyes.bpmn
This workflow requires one approval. One user creates the limit, and another approves it.
Please note the section of limits/workflow-types in application.yml. The workflow names need to match the process ID in the bpmn.
application.yml:
limits: workflow-types: FourEyes: limit-process-instance.four-eyes
limit-process-four-eyes.bpmn:
<process id="limit-process-instance.four-eyes ...>"
All serviceTasks need to have the associated Bean defined in the java file: Location: limits-activeviam/src/main/java/com/activeviam/limits/workflow/instance File name: LimitsProcessInstanceWorkflowService.java
limit-process-six-eyes.bpmn
This workflow requires two approvals. One user creates the limit, and two others need to approve it.
Please note the section of limits/workflow-types in application.yml. The workflow names need to match the process ID in the bpmn.
application.yml:
limits: workflow-types: FourEyes: limit-process-instance.six-eyes
limit-process-six-eyes.bpmn:
<process id="limit-process-instance.six-eyes" ...>
All serviceTasks need to have the associated Bean defined in the java file: Location: limits-activeviam/src/main/java/com/activeviam/limits/workflow/instance File name: LimitsProcessInstanceWorkflowService.java
limit-process-straight-through.bpmn
This workflow doesn’t require an approval. The limit is created in approved state. Limits created via DLC and Limit File Upload use the Straight through workflow.
Please note the section of limits/workflow-types in application.yml, the workflow names need to match the process ID in the bpmn.
application.yml:
limits: workflow-types: StrightThrough: limit-process-instance.straight-through
limit-process-straight-through.bpmn:
<process id="limit-process-instance.straight-through ...>"
All serviceTasks need to have the associated Bean defined in the java file: Location: limits-activeviam/src/main/java/com/activeviam/limits/workflow/instance File name: LimitsProcessInstanceWorkflowService.java
Adding a New Workflow
1. Add the bpmn file
2. Update the application.yml file
3. Update the UI: update the limitsWorkflowMap in limits-ui.LimitsSettings.ts
limitsWorkflowMap: {
FourEyes: {
name: "FourEyes",
participants: ["Examiners"],
},
SixEyes: {
name: "SixEyes",
participants: ["Examiners", "Approvers"],
},
StraightThrough: {
name: "StraightThrough",
participants: [],
},
},