Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 8 Using Sub-Processes and Process Interfaces : Embedded Sub-Processes

Embedded Sub-Processes
See "Embedded Sub-Processes" in TIBCO Business Studio Concepts.
To create an embedded sub-process, refactor one or more objects in your process as described in Creating a New Embedded Sub-Process.
If you want to use the chained execution resource pattern, you can do so by selecting the Chained Execution check box in the Properties view for the embedded sub-process. For more information, see Chained Execution- Multiple Parallel Paths in a Chaining Group.
Adding Local Data Fields
You can add data fields that are local to a sub-process (they are not used in the process that contains the embedded sub-process). By default, activities in the embedded sub-process have access to all local data and process data. However, using the Interface tab, a subset of data can be selected.
To add local data fields to an embedded sub-process:
1.
Click the Data Fields tab in the Properties view for the embedded sub-process.
2.
At the right of the Data Fields tab, click to add local data fields. The properties of the data fields that you create are the same as for process data (see Adding Data Fields or Parameters to a Package or Process).
For example:
In this example, the data fields Status, Status2, Status3, and Field are local to the embedded sub-process. On the Interface tab for activities within the embedded sub-process, you can access the local data as well as the process data:
In this case the address data fields (process data) and the local data defined on the Data Fields tab are both available.
You can quickly create an embedded sub-process that has local data by using the fragment BPMN Process Fragments > Basic Fragments > Embedded Sub-Process with Data Fields. For more information about fragments, see Process Fragments.
Using Local Data Fields in Loops
When using local data fields in loops, the value taken by the local data field during each iteration depends on the type of loop.
Multi-instance loop
Each instance of a multi-instance loop has a separate instance of the local data field, allowing parallel loops to execute without interfering with each other. However, the local data fields cannot be used in the loop expression.
Standard loop
The local data field is shared between all instances of a standard loop. It can be used to pass data between instances, and can be used in the loop conditional script.
Creating a New Embedded Sub-Process
1.
2.
Right-click and select Refactor > Move into New Embedded Sub-Process.
3.
Complete the dialog as follows:
a.
b.
Select the New Sub-Process is a transaction checkbox if you want the new sub-process to become a transaction and therefore be under transaction control (see User Tasks and Pageflow Processes).
c.
Select the Insert start event in new sub-process and Insert end event in new sub-process checkboxes to control whether start and end events are added to the refactored sub-process.
4.
Click Finish. The objects that you selected are placed within a new embedded sub-process (with start and end events if those options were selected):
Creating a New Reusable Sub-Process
1.
In this example, the two user tasks have the following parameters (two data fields and one formal parameter):
The user tasks also have a participant associated with them.
Select all three tasks.
2.
Right-click and select Refactor > Extract into New Reusable Sub-Process.
3.
4.
Complete the dialog as follows:
Select the New Sub-Process is a transaction checkbox if you want the new sub-process to become a transaction and therefore be under transaction control (see User Tasks and Pageflow Processes).
Select the Insert start event in new sub-process and Insert end event in new sub-process checkboxes to control whether start and end events are added to the refactored sub-process.
5.
Click Finish. The objects that you selected are copied to the new sub-process and the selected objects are replaced with a task that calls the reusable sub-process.
If you chose to create formal parameters for the data fields, you can see them in the Project Explorer, under the sub-process:
In addition, if you click the task in the parent process that calls the sub-process and go to the Properties view, you can see the mappings that have been created between data fields and formal parameters of the parent process and the formal parameters created in the sub-process. For example:
Notes on Refactoring Objects into Reusable Sub-Processes
Note the following when refactoring objects into reusable sub-processes:
If a data field is referenced only in the selection that you are refactoring, you have the option of moving or copying it. Data fields that are copied into the sub-process are created as formal parameters and mapped. Data fields that are moved into the sub-process are created as data fields. By default, data fields are moved. In order to copy them as formal parameters, you must uncheck the selection boxes on the dialog.
Changes in Process Logic
When refactoring objects into a reusable sub-process, you can potentially change the logic of the process flow. Consider the following process:
In this process, flow proceeds from User Task 1 to the gateway without necessarily waiting for Task A to finish. If User Task 1 and Task A are refactored into a reusable sub-process, an end event is inserted into the sub-process, effectively synchronizing the flow. TIBCO Business Studio prompts you to confirm this change to the process:
Inline Sub-Process Content
This option creates an embedded sub-process from a reusable sub-process. The reason for making a reusable sub-process inline is that in some cases the tasks in the sub-process execute relatively quickly and the overhead of invoking a sub-process can be comparatively high.
To refactor a reusable sub-process into an embedded sub-process, do the following:
1.
Right-click the reusable sub-process task, and select Refactor > Inline Sub-Process Content.
2.
Select Inline into Embedded Sub-Process and click Finish.
You can see the location of each problem by highlighting it. If you select all of the problems in this dialog, the Finish button is enabled and you can refactor the sub-process.
Because t he errors cannot be resolved, click Cancel, resolve the problems manually, and retry the refactoring.
3.
If the sub-process implements a process interface (see Process Interfaces), the start or intermediate events that implement interface-defined events are changed so that they are no longer flagged as such.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved