An embedded sub-process is mainly used to simplify the process model by grouping activities together into an embedded sub-process that can be collapsed or expanded to hide and show the implementation details.
Another common use of the embedded sub-process is to define loops which will be the case with the sample process that we will implement as part of this blog post.
We will be implementing a very simple process which will make use of the embedded sub-process to loop through a list of order items for review.
Create the basic BPM application and BPM project (i named it OracleBPM12cEmbeddedSubProcessDemoApp and OracleBPM12cEmbeddedSubProcessDemo respectively) and choose "Empty Composite" in step 3 of the "Create BPM Application" wizard since we will first create the the XSD schema file to describe our process's input and output parameters.
In the "Create XML Schema" window provide a name for your schema (for example Order.xsd), a target namespace (in my example I've defined it to http://www.antonis-antoniou.blogspot.com/order) and an optional prefix (for example, ord).
In the second step of the "BPMN 2.0 Process" wizard, with the "Input" tab selected click on the green plus icon to add a new input argument. Give your input argument a name, for example order, and in the type click on "Browse". We need to first create a business object from the schema we've created above. So click on the "Business Object" button next to the "Find" search field to create a new business object.
We will create a business object for the order element, so give your business object a meaningful name, for example OrderBO and choose an appropriate destination module to store your business object (i create a new module called "Data"). Base your business object on your order external schema (and order element).
Create an "Order" type process data objects to store the process input argument for reference throughout the process.
As you can see from the screenshot below I have used the count function to define the number of iterations to be equal to the number of order items defined in the request message.
Notice how the human task activity is marked as incomplete. That’s because it hasn’t been implemented yet. So let’s create a human task definition.
Double click on the “Review Order” human task and from the “Properties” window go to the “Implementation” tab and click on the green “Add” button to create a new definition. Specify a name, (for example ReviewOrderHT) and leave the rest on defaults.