Using the BPEL Designer and Service Engine

Using the If Element

The If activity supports conditional behavior of a business process instance. The If activity consists of conditional branches defined by the If and Else If elements, followed by an optional Else branch. The conditions on If and Else If branches are evaluated in the order they appear. During execution, the first branch whose condition holds true is taken and provides the activity specified for the If activity. In other words, if there are several Else If branches whose conditions hold true, only the first of them will be executed.

If none of the branches evaluates to true, then the Else path is chosen. If the Else branch is not explicitly specified, this branch is considered to contain an Empty activity. The If activity is complete when the activity of the selected branch completes.

Usage

  1. In the Design view, drag the If element from the Palette to the diagram.

  2. Double-click the If element on the diagram or select the Mapper tab on the toolbar. The BPEL Mapper opens.

  3. Specify the condition for the If element using the BPEL Mapper. For more information, refer to the If Activity Scenario section of the guide. You can also specify the condition manually in the Properties window, invoked by right-clicking the element and choosing Properties.

  4. (Optional) In the Properties window, enter the name for the If element.

  5. Add the element that will be executed if the condition is true into the If element. Configure the nested element. If you add another element into the If element, the nested elements are automatically wrapped in the Sequence element.

  6. Add other branches (Else If and Else) as described below.

Adding an Else If Branch to the If Element

  1. Right-click the If element and choose Add Else If.

  2. Add an activity to the Else If that will be executed if the condition defined for this Else If element is true. To define a condition, use the BPEL Mapper.

  3. (Optional) Add more Else If activities by choosing Add Else If and add activities to them.

Adding an Else Branch to the If Element

Drag the activity you want to be executed on the Else branch onto the connector path marked with a slash mark. Configure the nested activity.

Reordering Else If Branches

In the Design view, drag the Else If branch that you want reordered and drop it onto the placeholder that appears next to another Else If branch.