Data contract: Using data dictionary in CMMN and BPMN models
A Data Dictionary can be used in CMMN and BPMN models to define variables of a specific type. The Data Dictionary model will then contain the type definitions while a Data Contract defines the usage of the types in relation to the runtime variables. This also means Data Dictionary models can be reused in many models, maintaining consistency throughout.
Using types of a Data Dictionary in CMMN and BPMN models
The following example shows how to define a variable to be of a specific type defined in a data dictionary. The linkage between a Data Dictionary and a CMMN or BPMN model is done via its data contract.
- Initiate the data contract dialog by selecting the Data Contract button in the palette:
- Select the data dictionary and the type to be used in the model by clicking on the link to an existing one link. As an alternative, you can directly generate a new data dictionary model from within this dialog.
- In the Data Contract Variables section, click on the
+
button to add a data dictionary variable. Key in a name and pick the data dictionary type from the dropdown menu.
In the example above, the variable order is designated as type Order, as defined in the data dictionary model.
What does this imply?
When a variable named order
will be instantiated during process or case instance execution,
it will adhere to the type Order
as specified in the linked Data Dictionary model.
The runtime engine will ensure that the variable aligns with the type definition.
All required properties will be verified, constraints will be validated, and variable property assignments will be checked for compatibility.
In practical terms, this means that the variable order can only be created, when the orderId
property available and set to a string of at least 5 characters, because this is how the data dictionary type Order
is defined.
Otherwise the runtime would generate an error indicating that the variable does not adhere to the data dictionary definition.
Data dictionary variables of type Object
can be used in the model similar to JSON variables.
Data dictionary variables of standard types like string, long, etc. are used as usual, except that they are validated against the constraints defined for the type.