Java Reference
In-Depth Information
Choosing an Activity to Execute Based on Runtime
Conditions
Problem
You want to perform conditional logic within your process, for example, by testing values
within messages.
Solution
Use the <if> activity. Specify the primary condition you're testing for using a nested <con-
dition> element. The <if> can be followed by a series of <elseif> s and a single <else> .
Discussion
This operates just as you would expect from using conditional logic in any language. While
the basic ideas are the same (unlimited “else-if” statements and a single “else” statement), the
syntactical structure is what's unusual.
Here's a basic example:
<if name="IfInsufficientQty">
<condition>
( ($ProcessAppOut.appResponse/status/statusName='INSUFF_QTY' )
or
($ProcessAppOut.appResponse/status/statusName='OUT_OF_STOCK') )
</condition>
<sequence name="EmailErrorSequence">
//make email message here using assign, etc...
<invoke name="InvokeSendEmail" partnerLink="EmailPartner"
operation="sendEmail" portType="emailws:Email"
inputVariable="SendEmailIn"/>
</sequence>
</if>
This example supposes that a service has been previously invoked that returns a type with an
element of appResponse that holds, among other things, status information. So create an <i-
f> block that will only be executed if the expression specified inside the <condition> block
Search WWH ::




Custom Search