2011-01-20

Conditional assignment in Java and BPEL

Java:

if (i > 1000) i = 0;


BPEL (in JDeveloper with Oracle 11g SOA suite):

Drag in a "Switch".
Doubleclick the "case" side of the switch.
Select "Variable" for left hand side.
Click your way through a tree structure to find the variable 'i', and select that.
Click the operator drop-down.
Select >.
Select "Expression" for right hand side.
Click on button to open the expression builder.
Type 1000.
Close the expression builder.
Drag in an assignment icon and drop it in the case side of the switch.
Double click it.
Click the plus button and select copy from the menu that appears.
Select "Expression" for the "from" side.
Click on button to open the expression builder.
Type 0 (zero).
Close the expression builder.
Select "Variable" for the "to" side.
Click your way through a tree structure to find the variable 'i', and select that.
Back to the BEPL diagram and click the "otherwise" side of the switch.
Press delete.
Click OK to confirm that you want to delete the "otherwise" side of the switch.

Now you've got a diagram with an icon showing that there is a condition and another one showing that if the condition is satisfied an assignment will be performed.
To see exactly what the condition is you will have to double click the switch icon.
To see what gets assigned to what you will have to double click the assignment icon.

They made all those tools for us so that we could be more agile!
Now, that's progress!

The above description of the procedure for adding a conditional assignment in a BPEL diagram i JDeveloper may not be 100% correct. It's close, but I probably forgot a few steps, and I don't have the time or the hardware to install all that crap and check.
You probably get the idea anyway.

No comments: