ActiveVOS Designer User’s Guide

If

An if container executes an activity based on one or more conditions defined by the if and optional else if elements, followed by an optional else element. The conditions are evaluated in order, and the first one to evaluate to true has its activity executed. The if container is a good choice if all conditionals can be evaluated to a true or false condition.

If you do not define a branch, an implied else executes an empty activity.

Required and optional properties for If

Required Properties

Optional Properties

If Condition

Name. See Selecting Activity Labels

Else if Condition, Else Condition

Join Condition. See Creating a Join Condition for an Incoming Link

Suppress Join Failure. See Process Properties

Comment. See Adding Comments to a Process

Documentation. See Adding Documentation to a Process

Setting Visual Properties and Using Your Own Library of Images

Execution State. See Viewing the Execution State of an Activity or Link

Extension Attributes and Elements. See Declaring Extension Elements and Attributes.

To build an if:

  1. From the Container palette, drag an If activity to the Process Editor canvas.
  2. Right-click on the activity and select Add>Other>If Condition.
  3. Double-click the If Condition container to open the Expression Builder.
  4. Alternately, in the Properties view, click the Dialog Button next to If Expression.

  5. Select the variables, functions and operators to build a Boolean expression. For details, see Using the Expression Builder.
  6. From the Activity palette, drag an activity to the If Condition container, and select activity properties.
  7. Repeat Steps 2 through 5 for the Else If or Else branches, if desired.

The following illustration shows an example of an if activity.

Switch activity displayed in Outline view

XML Syntax

<if standard-attributes> 
    standard-elements
    <condition expressionlanguage=”anyURI”?>
       bool-expr
    </condition>
      activity
  <elseif>*
    <condition expressionlanguage=”anyURI”?>
       bool-expr
    </condition>
      activity
  </elseif>
  <else>?
   activity
  </else>
</if>

Example

<if xmlns:inventory="http://supply-chain.org/inventory"
    xmlns:FLT="http://example.com/faults">
  <condition>
    bpel:getVariableProperty('stockResult',
     'inventory:level') > 100
  </condition>
    <flow>
      <!-- perform fulfillment work -->
    </flow>
  <elseif>
    <condition>
      <bpel:getVariableProperty('stockResult',
       'inventory:level') >= 0
    </condition>
     <throw faultName="FLT:OutOfStock"
        variable="RestockEstimate" />
  </elseif>
  <else>
     <throw faultName="FLT:ItemDiscontinued" />
  </else>
 </if>