-
Notifications
You must be signed in to change notification settings - Fork 4
maker checker basics
As stated in Wikipedia:
"Maker-checker (or Maker and Checker, or 4-Eyes) is one of the central principles of authorization in the information systems of financial organizations.The principle of maker and checker means that for each transaction, there must be at least two individuals necessary for its completion. While one individual may create a transaction, the other individual should be involved in confirmation/authorization of the same. Here the segregation of duties plays an important role. In this way, strict control is kept over system software and data, keeping in mind functional division of labor between all classes of employees."
Currently OE-Workflow Engine and Activiti are supported. Refer for Activiti Endpoints.
Note: We are exploring the possibility of supporting other bpmn engines like
jBPM
using generic models.
- You need to know How to create a model.
- Basic understanding of BPMN2.0.
Below is the definition of a model, which we will use for our demo.
Schema of Product
Model:
{
"name": "Product",
"base": "BaseEntity",
"strict": false,
"plural": "Products",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"code": {
"type": "string"
},
"name": {
"type": "string"
},
"category": {
"type": "string"
},
"price": {
"type": "number"
},
"offeredSince": {
"type": "date"
},
"active": {
"type": "boolean"
},
"description": {
"type": "string"
}
}
}
Follow this Workflow Creation Guide to create a workflow and attach it to a model.
Workflow Model applied on Product model
Note: To make your own workflow you should have knowledge of
BPMN2.0
and OE-Workflow Modeler.
To configure any model to use workflow, we have to do a POST on an API [/workflowManagers/workflow]
of workflowManager model.
Sample Data for oe-workflow Engine POST /workflowManagers/workflow
{
"modelName" : "Product",
"workflowBody" : {
"workflowDefinitionName": "productWorkflow"
},
"operation" : "create",
"wfDependent" : true
}
Note:
workflowBody
contains the name of the workflow along with other optional params which will be used to create Process Instances when data is created in the model.
Similarly POST on /Activiti_Manager/workflow to attach workflow with activiti engine.
{
"modelName" : "Product",
"workflowBody" : {
"processDefinitionKey": "productWorkflow"
},
"operation" : "create",
"wfDependent" : true
}
User can configure it for update and delete also. Whenever there is any create or update or delete on the model, it will create a WorkflowInstance
in workflow engine for the configured WorkflowDefinition
.
Example
{
"modelName": "Product",
"workflowBody" : {
"workflowDefinitionName": "productWorkflow"
},
"operation" : "update",
"wfDependent" : true
}
{
"modelName": "Product",
"workflowBody" : {
"workflowDefinitionName": "productWorkflow"
},
"operation" : "delete",
"wfDependent" : true
}
When a workflow is attached to a model, the model instance goes through various stages, depending on what operation the workflow is attached and how it is attached(wfDependent={True/False}).
When a workflow is attached on create operation to a model, the posted model instance will be instantly visible if it does not depend on workflow(wfDependent=false). But if it is dependent on workflow, the posted data will only be visible after the execution of the workflow if it is accepted. In case of rejection, the instance will not be created.
When a workflow is attached on update operation of a model, any changes to a model instance will be instantly visible if it is workflow independent(wfDependent=false). But if it is dependent on workflow, the posted changes will only be visible after the execution of the workflow if it is accepted. In case of rejection, the posted changes will not be reflected.
When a workflow is attached on delete operation of a model, the deleted model instance will be deleted instantly(_isDeleted=true), if it is workflow independent(wfDependent=false). If there is a dependency on the workflow, the instance will only be deleted after the execution of the workflow if it is accepted. In case of rejection, the instance will not be deleted.
To create a record, use api - POST /Products
Instance posted by USER
{
"code": "HC1001",
"name": "Caffe Latte",
"description": "Strong Blend Espresso filled up with...",
"category": "",
"id": "58b0111b317319fc3ad4131a" ,
"price": 1.23,
"offeredSince": "01-01-2012",
}
Imtermediate Instance
{
"id": "58b0111b317319fc3ad4131a" ,
"code": "HC1001",
"name": "Caffe Latte",
"category": "",
"price": 1.23,
"offeredSince": "2011-12-31T18:30:00.000Z",
"description": "Strong Blend Espresso filled up with...",
"_createdBy": "user",
"_createdOn": "2011-12-31T18:30:00.000Z",
"_modifiedBy": "user",
"_status": "private"
}
Final Data {Approved}
{
"id": "58b0111b317319fc3ad4131a" ,
"code": "HC1001",
"name": "Caffe Latte",
"category": "",
"price": 1.23,
"offeredSince": "2011-12-31T18:30:00.000Z",
"description": "Strong Blend Espresso filled up with...",
"_createdBy": "user",
"_createdOn": "2011-12-31T18:30:00.000Z",
"_modifiedBy": "user",
"_modifiedOn": "Strong Blend Espresso filled up with...",
"_status": "public"
}
Observation
_status
changed to "public"