Iteration Activities

Iteration activities are another type of loop activity.

RepeatUntil Activity

The repeatUntil activity is used to define that the child activity is to be repeated until the specified <condition> becomes true. The <condition> is tested after the child activity completes. The repeatUntil activity is used to execute the child activity at least once.

Syntax:

<repeatUntil standard-attributes>
 standard-elements
 activity
 <condition expressionLanguage="anyURI"?>bool-expr>/condition>
</repeatUntil>

ForEach Activity

The forEach activity iterates its child scope activity exactly N+1 times where N equals the <finalCounterValue> minus the <startCounterValue>. If parallel="yes" then this is a parallel <forEach> where the N+1 instances of the enclosed <scope> activity should occur in parallel. An implicit flow is dynamically created with N+1 copies of the <forEach>'s <scope> activity as children. A <completionCondition> may be used within the <forEach> to allow the <forEach> activity to complete without executing or finishing all the branches specified.

Syntax:

<forEach counterName="BPELVariableName" parallel="yes|no"
 standard-attributes>
 standard-elements
 <startCounterValue expressionLanguage="anyURI"?>
   unsigned-integer-expression
 </startCounterValue
 <finalCounterValue expressionLanguage="anyURI"?>
   unsigned-integer-expression
 </finalCounterValue>
 <completionCondition>?
   <branches expressionLanguage="anyURI"?
   successfulBranchesOnly="yes|no"?>
   unsigned-integer-expression
   </branches>
 </completionCondition>
 <scope > </scope>
</forEach>

Mapping

You design a repeatUntil activity and a forEach activity using a process with a "Loop" implementation type and respectively a "RepeatUntil" or "Foreach" loop type.

The following specific WS-BPEL 2.0 extended attribute is available from the property sheet of the process object with a "Loop" implementation type and a "While", "Until" or "Foreach" loop type. The other attributes in that tab are the same as the ones for BPEL4WS 1.1:

Name

Internal code

Description

Expression language

expressionLanguage

Specifies the expression language used in the condition. When this attribute is not specified for one of the iteration elements, the attribute inherits its value from the <process> element. The default value for this attribute is: "urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0", which represents the usage of [XPath 1.0] within WS-BPEL 2.0.

In addition, the following extended attributes are available from the property sheet of the process object with a "Loop" implementation type and a "Foreach" loop type:

Name

Internal code

Description

Counter name

counterName

Defines the variable used by the <forEach> activity to store the counter of the loop. During each repetition, a variable of the xsd:unsignedInt attribute is implicitly declared in the <forEach> activity's child <scope>. The name of the implicit variable is specified in the CounterName attribute

Start counter value

startCounterValue

Allows you to compute the initial value of the counter variable used by the <forEach> activity. It is evaluated when the <forEach> activity starts

Final counter value

finalCounterValue

Allows you to compute the final value of the counter variable used by the <forEach> activity. It is evaluated when the forEach activity starts.

Parallel

parallel

If the value of the parallel attribute is no then the activity is a serial <forEach>. If the value of the parallel attribute is yes then the activity is a parallel <forEach>.

Successful branches only

SuccessfulBranchesOnly

The <branches> element of the <forEach> activity represents an unsigned-integer expression used to define a completion condition. If the value of the successfulBranchesOnly attribute is no, all the <scope>'s which have completed (successfully or unsuccessfully) must be counted. If the successfulBranchesOnly attribute is yes, only <scope>'s which have completed successfully must be counted


Created October 7, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com