If
See Also
The If activity supports conditional behavior of a business process
instance. The If activity consists of conditional branches defined by the If and ElseIf elements, followed by an optional Else branch. The conditions on If and ElseIf 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 ElseIf branches whose conditions hold true, only the first of them will be executed.
If none of the branches holds true, then the Else path is chosen. If the Else branch is not explicitly specified, this branch is considered to have an Empty activity. The If activity is complete when the activity of the selected branch completes.
Using the BPEL Designer, you add branches to the If element as follows:
- The If branch is created automatically when you place the If element to the diagram. Insert the activity into the If branch that will be executed if the If condition holds true.
- The ElseIf branch is an additional conditional branch that will be taken if the main then activity is untrue. To add the ElseIf branch, use the pop-up menu. You can add as many ElseIf as your process needs.
- The Else branch is taken if none of the conditions on other branches holds true.
To use the If element:
- In the Design view, drag the If element from the Palette to the diagram.
- Select the If element on the diagram.
The
Properties window shows the If properties (Ctrl-Shift-7).
- (Optional) In the Properties window, enter the name for the If element.
- Drag the activity that will be executed onto the If branch. Configure the activity's properties.
- Specify the condition for the If branch by using either of the following methods:
- In the Properties windows for the If element, click the ellipsis button (...) for the Condition property and add a condition in the text editor window.
- Open the BPEL Mapper window (Window > BPEL Mapper) and specify the condition using the BPEL Mapper.
- Add other branches (ElseIf and Else) as described below.
To add an ElseIf branch to the If element:
- Right-click the If element and choose Add ElseIf..
- Place the ElseIf activity to the target place.
- Add an activity to the ElseIf that will be executed if the condition defined for this ElseIf is true.
To define a condition, use the BPEL Mapper.
- (Optional) Add more ElseIf activities by choosing Add ElseIf and add activities to them.
To add 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 activity using the Properties window.
To reorder ElseIf branches:
- In the Design view, drag an ElseIf branch and drop it onto the placeholder that appears near the second ElseIf branch.
- If you drop an ElseIf branch onto the placeholder that appears on the main If branch, the activity in the dragged ElseIf branch will be swapped with the activity in the main If branch.
- See Also
- About the BPEL Mapper
- BPEL Designer Palette: Structured Activities
- About the Design View of the BPEL Designer
Legal Notices