Developer Guide to the BPEL Designer: The BPEL Mapper

Contributed by Bob May, maintained by Irina Filippova
December 2007

Contents

Developer Guide to the BPEL Designer

Content on this page applies to the NetBeans 6.0 IDE

About the BPEL Mapper

The BPEL Mapper provides a framework for processing and directing BPEL process data. This framework consists of the following components:

The BPEL Mapper window opens when you select one of the elements listed above in the Design view. If this window is not visible, you can invoke it manually, by choosing Window > Other > BPEL Mapper from the main menu.

top


Creating BPEL Mappings

You can create a mapping from the source tree pane directly to the destination tree pane, without using any of the functions. This type of mapping can be any of the following:

You can also create a mapping that uses one or more XPath functions from the BPEL Mapper's menu bar. For example, if the BPEL process includes a Wait activity that waits for a period of time, then you can use the Duration Literal function to specify the duration.

To create a mapping without using any functions:

  1. In the source tree pane, expand the tree component until the node that you want to map from appears.
  2. If the destination tree pane contains a tree component, then expand the tree component until the node that you want to map to appears.
  3. Select the node in the source tree pane and drag the pointer to the node in the destination tree pane.
    A link connects the nodes.

To use a function in a mapping:

  1. Click the drop-down menu that contains the function.
  2. Click the function.
    A function box appears in the mapping pane.
  3. Map any arguments into the appropriate connector on the left side of the function box. The source can be a node in the source tree pane or the output from another function box. If an argument is optional, then a question mark appears after the argument name.
  4. Map the result from the right side of the function box. The destination can be a node in the destination tree pane or the input into another function box.

To delete a link or function in a mapping:

  1. Select the link or function.
  2. Press Delete.

top


Working with Predicates

The BPEL Mapper enables you to create a predicate that consists of XPath functions.

A predicate applies a condition to a node that can have multiple values. The result is the subset of nodes that satisfy the condition.

For example, assume that a node represents the number of products. If you want to select all products whose number is greater than 50, then you can use the greater than and number literal functions to define the condition.

Only certain types of nodes allow you to create predicates. The pop-up menu of these nodes contains the New Predicate option. When you expand the tree component in the source tree pane, the nodes that can have predicates are marked with an asterisk (*).

Once you create a predicate, you can use the predicate in an assignment. For example, you can copy data from a predicate in the source tree pane to a node in the destination tree pane.

You can edit or delete an existing predicate.

To create a predicate:

  1. In the source tree pane, right-click a node that is marked with an asterisk (*) and choose New Predicate.
    The Predicate Editor appears.
  2. Use XPath functions to create the condition for the predicate. Map the result to the predicate node in the destination tree pane.
  3. Click OK.
    The editor adds the predicate node immediately below the original node. The condition appears in brackets.

To edit a predicate:

  1. In the source tree pane, right-click the predicate node and choose Edit Predicate.
  2. Modify the condition.
  3. Click OK.

To delete a predicate:

  1. In the source tree pane, right-click the predicate node and choose Delete Predicate.
  2. Click Yes.

top


XPath Function Reference

A collection of XPath functions are available in the BPEL Mapper's menu bar. These functions are based on the XPath 1.0 specification.

Each function has zero or more arguments. Each function returns a single result.

The menu bar contains the following drop-down menus: Datetime, Operator, Boolean, String, Nodes, and Number.

Datetime

The Datetime menu contains the following functions:

Operator

The Operator menu contains the following functions:

Boolean

The Boolean menu contains the following functions:

String

The String menu contains the following functions:

Nodes

The Nodes menu contains the following functions:

Number

The Number menu contains the following functions:

top


Mapping Examples

These examples illustrate several mapping scenarios:


Assign Activity Scenario

Assume that you want a BPEL process to copy data received from a partner. Do the following tasks:

  1. Add an Assign activity after the Receive activity.
  2. In the Design view, select the Assign activity and use the BPEL Mapper to define one or more copy assignments.

The following example shows a copy assignment that does not use any XPath functions. The itinerary part of the ItineraryIn variable is copied to the itinerary part of the ItineraryOut variable. Notice that the left pane and the right pane contain the same tree component.

Screen capture of mapping for Assign activity with direct mapping
Click to enlarge

The following example shows a copy assignment that uses the concat XPath function. The input variable paramA is concatenated to the end of the string literal Parameter A: and copied to the output variable paramA.

Screen capture of mapping for Assign activity with concat XPath function
Click to enlarge

If Activity Scenario

Assume that you want to execute a series of steps only if a certain condition is true. Do the following tasks:

  1. Add an If activity to the BPEL process.
  2. In the Design view, select the If activity and use the BPEL Mapper to define the Boolean condition.
  3. Add the steps inside the If activity.

The following example shows a mapping for the condition. The mapping uses the Not XPath function, which is available from the Boolean node on the menu bar. If the itinerary has an airline reservation, then the Not XPath function returns true. The result is mapped to the Result node in the right pane.

Screen capture of mapping for If activity
Click to enlarge

Predicate Scenario

Assume that you want a BPEL process to copy itinerary data from itineraries of customers with no more than two in their party. The input records include a variable that specifies the number of passengers in the customer's party. Do the following tasks:

  1. In the left pane of the BPEL Mapper window, right-click the repeating node that is marked with an asterisk (*) and choose New Predicate.
    The Predicate Editor window appears.
  2. Add the Less Than XPath function to the middle pane.
  3. Add the number literal XPath function to the middle pane. Set the value to 3.
  4. Map the variable node to the first argument of the Less Than XPath function.
  5. Map the result of the number literal XPath function to the second argument of the Less Than XPath function.
  6. Map the result of the Less Than XPath function to the Result node in the right pane.
  7. Click OK.

The following example shows how the mapping appears in the Predicate window. Once you click OK, you can use the predicate node in a copy assignment.

Screen capture of mapping for predicate
Click to enlarge

If the BPEL process received the following XML, then the predicate would select the first Air tag.

<Air>
    <NumberInParty>2</NumberInParty>
</Air>
<Air>
    <NumberInParty>4</NumberInParty>
</Air>
<Air>
    <NumberInParty>6</NumberInParty>
</Air>

Send Us Your Feedback

top