Wednesday, August 31, 2011

BPM11g looping Subprocess

the ubiquitous example of an order and its order lines -


Test XML input

In the BPM process I need to loop thru the order lines.

The basic process looks as follows -

I created a fileAdapter(Read) which triggers the process.

I created the following process variables -

To begin with, I copy the incoming order to the v_order variable.

Then I get the count of incoming order lines -

Now to the looping subprocess -

The loop condition is defined as follows -

Note we have this sub-process variable loopCounter generated for us.

Now to the actual processing - I just copy the orderLine[n] to a variable.

Deploy and test

Wednesday, August 10, 2011

Adding ADF BC components to a BPM Human Task Form

Here is what we need to do...
The BPM process only contains the orderID in the payload. We will need to retrieve the order details from the database via ADF BC and display them on the task form page. My table is called am_order and is defined as follows -

Thanks to Mireille D. and Angelo S. for their input!

The high level steps are as follows –

Auto-generate the Human Task form from the BPM task definition.
- This creates a new project in your JDeveloper application.

In the new project, expose the am_order table as an ADF BC
- Tailor it to add a View Criteria
- e.g. Am_order.order_id = orderID

Add a new bounded ADF task flow to the project
- Here we will display the order details
- The task flow will include a parameter (#pageFlowScope.in_orderID)
-- The view used will be a page fragment

Add the new bounded ADF task flow to the auto-generated taskDetails.jspx
- It will be dropped as a Region
-- Specify the bindings to orderID

Auto-generating the task form is a piece of cake - the real "baking" (pardon the pun) is in the creation of the extra ADF Task form to display the order details.

Amend the ADF BC View as follows -

1. Add a bind variable e.g. (bpm_orderID)
2. Add a new View Criteria that will leverage it.

3. Specify use at app module level

So to execute a query on the view we need to pass in a value for

Create the new task flow

This bounded task flow will have the following parameter-

So the task flow expects to be passed in a String (orderID). We call this in_orderID and it is stored in the variable pageFlowScope.in_orderID

Drop the ExecuteWithParams operation from the ViewObject on to the task flow diagram.

Here we specify the value for the view bind variable (bpm_orderID). Naturally this is set to pageFlowScope.in_orderID

We then add a view to the task flow to display the order details

That's it for the task flow.

Now open the auto-generated task form and drop in the new task flow as a region.

I position it after after the orderID.

When dropping we will need to bind the input parameter (in_orderID) we defined earlier. So we bind it to the the existing orderID on the page -

Monday, August 8, 2011

Using timers in BPM 11g Part 2


A typical batch style process -
The process starts at 10 am and writes out a report every hour.
It ends 6 hours later at 4 pm.

Now for testing purposes I will start at 2:40 pm, write a report every 1 minute and then end 5 minutes later - but you can extrapolate as required.

The process is as follows -

Start is set to 14:40

The variable v_endTimeString will be set to startTime (i.e. 14:40) + 5 minutes.
I use this later for comparison purposes. I'm not the XPath guru so I essentially
store the end date as a String in the format YYYYMMDDHHMM and then exit the reporting loop when currentDateTime > v_endTimeString.

Wait 1 minute configured as follows -

The COB? (Close Of Business) condition for "Still within business hours" is set as follows -

xp20:format-dateTime(string(xp20:current-dateTime()), '[Y0001][M01][D01][H01][m01]') < bpmn:getDataObject('v_endTimeString')

Deploy and test

The output report should contain 5 entries for the time period 14:40 - 14:45.

Wednesday, August 3, 2011

Using Timers in BPM11g

Here is the only occasion where I must admit the official docs left me somewhat puzzled.

It shows examples such as 'now' + 20 which one could take as an indication on how to set a timer for current date time + 20 (hours, seconds ??)

My scenario is very simple - accept a file, wait a certain amount of time and then write the file.

So now I want to set this wait to 15 seconds -

This may seem pretty cryptic -

xp20:add-dayTimeDuration-to-dateTime(xp20:current-dateTime(), string('PT15S'))

PT15S - PT are just constants -


so 3 days are P3D
3 hours PT3H

Check out Antony's blog posting for the why's etc.