Action nodes

An action node (often called simply an action) represents a step in a collaboration. It is the basic building block of collaboration logic. The breakdown of the collaboration's logic into action nodes is completely up to you. You can write many lines of complex code in a single action or divide the logic into numerous individual actions. Breaking a collaboration's logic into action nodes is analogous to developing program code. You can write a program with a short main routine that invokes a series of subroutines or method calls to carry out the program function. Or, you can write a longer main routine that includes all program logic inline.

Adding an action to a diagram

To add an action node to an activity diagram:

  1. In the Symbols toolbar, click the Action button.
  2. Click in the workspace to place the Action symbol.

Note:
An action node can make a service call if you attach the Service Call symbol to the action. For information on service calls, refer to "Service calls".

Defining action node properties

After the action node appears in the activity diagram, use the Action Properties dialog box to define any of the following properties for the node:

Open the Action Properties dialog box by doing one of the following:

The Action Properties dialog displays with the name of the action node at the top of the dialog. This name has the following format:

Action_UID

where UID specifies the unique identifier for the action node. Figure 33 shows the Action Properties dialog box.

Figure 33. Action Properties dialog


Adding activity definitions to an action node

Action nodes contain activity definitions. Activity definitions (also called code fragments) consist of calls to the collaboration API or other Java code, and can contain operations such as the following:

Activity definitions can contain any of the Java programming language constructs.

Activity definitions can be added to action nodes in two ways:

Adding an activity definition in the Action Properties dialog box

To add Java code directly to the Code Fragment window in the Action Properties dialog box, do the following:

  1. Enable direct editing of the Code Fragment window as follows:
    1. In Process Designer, click View --> Preferences. The User Preferences dialog box opens.
    2. In the Diagram tab, select the Enable in-place editing for new action nodes and Enable in-place editing for existing action nodes options.
    3. Click Apply, and then click OK.
  2. Right-click the action node to display its context menu.
  3. From the context menu, click Properties. The Action Properties dialog box is displayed.
  4. Type your Java code into the Code Fragment window.
  5. Click Apply to save your changes.

Adding an activity definition in Activity Editor

To add an activity definition using Activity Editor, do the following:

  1. Right-click the action node to display its context menu.
  2. From the context menu, click Properties. The Action Properties dialog box is displayed.
  3. Click Edit to open the Activity Editor. By default, the Activity Editor displays the Graphical view.
    Note:
    If you have already created an activity definition for this node, and if that definition contains custom Java code that is not recognized by the Graphical view, Activity Editor displays the Java view.
  4. Add the activity definition. See Activity definitions for more information.
  5. Close the Activity Editor. The Action Properties dialog box is still open, and it now displays the code fragment associated with the activity definition.
  6. Click Apply to save your changes.

Using Java relational operators in activity definitions

You can use the Java operators in activity definitions, particularly the relational and conditional operators along with the arithmetic operators.

All Java classes inherit from the base Object class. As such, every class has an equals() method available to it. Its signature is as follows:

public boolean equals(Object obj);

The equals() method is concerned with value equality. It compares the object calling the method and the object referenced by obj for equality, returning true if they have the same value and false if they do not. Note that this differs from the equality operators == and !=. These two equality operators determine if two references refer to the same object, regardless of the value of the object. This is an important distinction.

Table 33 summarizes the available equality operators. Each equality or relational operator yields a boolean value result.

Table 33.

Java relational operators
Relational operator Meaning
> greater than
>= greater than or equal to
< less than
<= less than or equal to
== equal to
!= not equal to
! unary operator, which inverts a boolean value.

Note that results of boolean expressions can be joined with the conditional AND (&&) and the conditional OR (||) symbols.

Table 34 summarizes the arithmetic operators, including the increment and decrement operators.

Table 34.

Java arithmetic and assignment operators
Arithmetic operator Meaning
+ addition
- subtraction
* multiplication
/ division
% remainder
- unary, for negation or inverting the sign of a number
++ increment operator
-- decrement operator
= assignment operator

Using Web services in activity definitions

If you want to use a Web service in a collaboration template's activity definition, you must first export the Web service from the Integration Component Library (ICL) project in System Manager. Each method in the Web service is exported as a function block to Activity Editor, where it can be placed in the activity definition. For more information, see Web services function blocks.

Finding more information on activity definitions

For more information on coding logic for an action node, refer to the following table:

Table 35. Obtaining more information on code fragments

Additional resources Location
Detailed description of Activity Editor, including examples of using function blocks Using Activity Editor
Examples of code fragments Coding tips and examples
Reference pages for individual function blocks "Business object function blocks" through "Utilities function blocks"
Reference pages for individual methods in the collaboration API "BaseCollaboration class" through "StateManagement class"

Copyright IBM Corp. 2004