4.12. Assignment

The assignment mechanism allows you to pass data into, and retrieve data out of, Activities in Business Processes. Assignments that pass data into Activities are executed before the Activity itself is executed. Assignments map from Business Process variables to local data items in activities, known as DataInputs. Assignments that retrieve data from Activities are executed after the Activity has executed. They map from local data items in activities, known as DataOutputs, to Business Process variables.

4.12.1. Data I/O Editor

The Data I/O Editor is the dialog used to define Activity DataInputs and DataOutputs, as well as the mappings between them and process variables.
Like Process Variables, DataInputs and DataOutputs have a name and data-type, such as Integer, String, or a subclass of Java Object, such as a user-defined Data Object created within JBoss BPM Suite. The data-types of DataInputs and DataOutputs should match the data-types of the Process Variables which they are mapped to or from. Their names may be the same as the corresponding Process Variables, but this is not a requirement.
Process Variables are defined in the Variable Definitions property of the Business Process. Element DataInputs and DataOutputs are defined in one of three properties of Activities, depending on the element type:
  • Elements such as User Tasks and Call Activities, which have both DataInputs and DataOutputs, use a property called Assignments.
  • Elements such as Start Events and Intermediate Catch Events, which have DataOutputs but do not have DataInputs, use a property called DataOutputAssociations.
  • Elements such as End Events and Intermediate Throw Events, which have DataInputs but do not have DataOutputs, use a property called DataInputAssociations.
The Assignments, DataOutputAssociations, and DataInputAssociations properties are all edited in the Data I/O Editor. DataInputs can have values assigned to them either by mapping from process variables or by assigning constant values to them. DataOutputs are mapped to Process Variables.
To define the DataInputs, DataOutputs and Assignments for an Element, select the Element in the Business Process and click the button to open the Data I/O Editor. Data Input Assignments and Data Output Assignments can be added by clicking the Add button.
You can also open the Data I/O Editor to edit the Data Inputs and/or Outputs by editing the appropriate property for the activity: Assignments, DataOutputAssociations, or DataInputAssociations.

Note

The Data I/O Editor tool is available in Red Hat JBoss BPM Suite 6.2 or better.

4.12.2. Data I/O Editor Example

In the following example, the Data I/O Editor has been used to create some Data Inputs and Data Outputs for the User Activity 'Check Invoice'. The example makes use of two Process Variables that have been defined in the process:
  • invoice with type org.kie.test.Invoice.
  • reason with type String.
The following Inputs have been added:
  • invoice
  • reason
  • maxamount
  • myvar
The Data Inputs and Outputs are linked to the corresponding Process Variables by setting the Source and Target fields in the dialog.
The Data I/O Editor allows you to create and assign a constant to a DataInput when setting the Source column for a DataInput. This is demonstrated by the'maxamount' DataInput, that has the constant 1000.00, which will be assigned to it at runtime.
The 'myvar' DataInput and DataOutput demonstrates a custom Data Type'com.test.MyType', which is entered in the dialog by the user.