uCosminexus Service Platform, Basic Development Guide

[Contents][Glossary][Index][Back][Next]

5.6.13 While Activity

This activity defines repeated processing of one or more activities according to a given condition.

The following figure shows repeated processing that uses while activities.

Figure 5-12 Repeated processing using while activities

[Figure]

When a while activity is defined, one or more processes can be repeated according to a given condition. You can also define a repeating process inside another repeating process, as exemplified by Repetition 3 in the above figure.

Organization of this subsection
(1) Repetition method
(2) Definition procedure
(3) Notes on definition
(4) Notes when defining (only in case of list specification method)

(1) Repetition method

In the while activity, you can select either of the following repeat method.

Repeat process using the condition specification method and list specification method is described as follows:

(a) Condition specification method

Following figure shows the repeat process using the condition specification method.

Figure 5-13 Repeat method using the condition specification format

[Figure]

In condition specification method, specify the repetition condition expression in XPath format. Activity within the while activity is repeated till the evaluation result of condition expression is true.

(b) List specification method

Following figure shows the repetition process using the list specification method.

Figure 5-14 Repetition process using the list specification method

[Figure]

In list specification method, repetition process is executed in the following flow:

  1. Repetition list is generated based on variables specified in XPath.
  2. Activity within the while activity is repeated only for the number of times equal to the number of nodes included in the generated repetition list.
  3. Every time when the repeat is executed, elements of repetition list are stored one by one in the repetition element variable.

Create variables and repeat element variable for generating repetition list, in the development environment and specify those in Repetition list settings dialog.

(2) Definition procedure

To define a receive activity:

(a) Condition specification method
  1. Schedule the while activity to the canvas.
    For details on how to schedule the activity, see "5.4.1 Deploying Activities".
  2. Select and right click the while activity on the canvas and select Settings.
    While activity dialog is displayed.
  3. Enter any activity name in While activity dialog.
    For details on the While activity dialog, see "1.4.19 While activity dialog" in the "Service Platform Reference Guide".
  4. Select Condition specification method radio button and click the Repetition condition settings button.
    Repetition condition settings dialog for setting up the repetition condition is displayed. For display/input contents of Repetition condition setting dialog, see "1.4.21 Repetition condition settings dialog" in the "Service Platform Reference Guide".
  5. Specify the required information and click OK button.
  6. Display the canvas for setting up the repetition process, by either of the following methods:
    • Double click the while activity of the canvas.
    • Select and right click the while activity of the canvas and select Open.
    Tab of the while activity name is displayed in the lower part of the canvas and the canvas for setting up the while process is displayed.
  7. Deploy, link and define any activity and set the repetition process.
(b) List specification method
  1. Define the message type (XML) variable for generating the repetition list.
    Create variables by schema having repetition element as child element. All the child elements must have the same format.
    For details on defining variables, see "5.5.1(6)(a) Defining new variables".
    Creation example (unify the name attribute of child attribute and specify elements count in maxOccurs attribute)
     
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema
        elementFormDefault="qualified"
        targetNamespace="http://example.com/sample"
        xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="loop-element">
        <xs:complexType>
          <xs:sequence>
            <xs:element maxOccurs="5" minOccurs="0" name="child-element"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>
     
  2. Define the message type (XML) variable of repetition element.
    Create variables for storing the element of repetition list generated by variables created in step 1.
    Creation example
     
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema
        elementFormDefault="qualified"
        targetNamespace="http://example.com/sample"
        xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="child-element"/>
    </xs:schema>
     
  3. Schedule the while activity to the canvas.
    For details on scheduling the activity, see "5.4.1 Deploying Activities".
  4. Select and right click the while activity of the canvas and select Settings.
    While activity dialog is displayed.
  5. Enter any activity name in the while activity dialog.
    For details on while activity dialog, see "1.4.19 While activity dialog" in the "Service Platform Reference Guide".
  6. Select List specification method radio button and click repetition list settings button.
  7. Repetition list settings dialog for setting the repetition list is displayed.
    For details on display/input contents of Repetition list settings dialog, see "1.4.20 Repetition list settings dialog" in the "Service Platform Reference Guide".
  8. Specify the path of element of the variable defined in step.1, in the Expression of Repetition list of Repetition list settings dialog, in XPath format.
    For details on specifying XPath format, see "5.6.18(2)(d) Specifying in the repetition list settings dialog".
  9. In Variable name of Repetition variable, specify the variable defined in step.2.
  10. Set Maximum repetition count as and when required.
  11. Click OK button.
  12. Display canvas for setting the repetition process, by either of the following methods:
    • Double click while activity of the canvas.
    • Select and right click the while activity of the canvas and select Open.
    Tab of the while activity name is displayed in the lower part of canvas and the canvas for setting the repetition process is displayed.
  13. Deploy, link and define any activity and set the repetition process.

(3) Notes on definition

(4) Notes when defining (only in case of list specification method)

You must consider following points at the time of definition, when specifying the list specification method.