This section gives an overview of using Tasks and Parameters. It explains how to pass data into Tasks and how to take data out of Tasks after they have completed.
The Task Mappings editor can be opened by clicking one of the curly arrows under the Task.
Tasks and the Case File
Data in a case resides in the Case File. Tasks can take their input from the Case File. The CMMN specification is a bit cumbersome in this area, but in essence it gives a lot of flexibility to handle data.
In the picture we see the
Greeting input parameter taken from the Case File and mapped directly into the task parameter
This is the most straightforward and probably also the most applied pattern.
The details of the CMMN specification distinguish between 3 important elements.
- Case File Item
- Task Parameter
- Implementation Parameter - in the picture labeled as
Model Input Parameter
Model Input Parameter is not defined in the case model itself, but in the underlying task.
Furthermore, inside the picture we do not see the label
Task Parameter, but only a label
Case File Item.
The editor is hiding some of the complexity of the CMMN specification.
In the above scenario, we just want the Greeting to be passed to the Human Task. The Case File of HelloWorld contains an item named Greeting. And the SendResponse human task works only on input parameters named Greeting.
Note: in order to have a
Model Input Parametershow up in the mapping editor, it first must be defined in the underlying task implementation.
The list of input parameters in the mapping editor is read only and populated from the input parameters of the implementation.
Although the editor tries to hide some of the complexity of the specification by choosing smart defaults, it is important to understand the underlying mapping and binding aspects.
- Binding Refinement - from Case File to Task Input Parameter
- Transformation - from Task Input Parameter to Model Input Parameter
- Transformation - from Model Output Parameter to Task Output Parameter
- Binding Refinement - from Task Output Parameter to Case File
Between steps 2 and 3 the underlying task execution is done. The implementation is responsible for it's own mapping.
The transformations enable binding the same task input parameter to be mapped to multiple different input parameters. And for output parameters of the underlying model, the same is applicable. One implementation output parameter can be mapped into multiple different Task Output Parameters and through that update multiple Case File Items.
During mapping of a Task Parameter to the Model Input Parameter, a transformation can be applied.
This can be used for example to pass only specific properties of a Case File Item into the underlying task implementation. It can also be used to entirely override the given Case File Item, e.g. to pass the task id or case id or a timestamp "now" into the implementation parameter.
Cafienne supports multiple expression languages. You can read more about it in the Expression chapter.
The CMMN specification enables you to choose a different language at the level of each individual expression.
In the parameter mapping editor you can choose to deviate from the default expression language of the case by pressing the small
L button at the left of the transformation. If the choosen language differs from the default language, the
L button gets a small blue underlining.
Binding Refinement (Operations)
Cafienne provides a small set of operations to enable various patterns of binding the Case File Item to a Task Input Parameter. Also for binding Task Output Parameters back to the Case File Item a number of operations is supported.
A critical element in choosing the right operation is the multiplicity of the Case File Item.
If the multiplicity is
*, the Cafienne engine treats the Case File Item as an array.
Details are described in the below screenshots.
Binding Refinement on Task Input Parameters
Binding Refinement on Task Output Parameters