A.5.1. Node Type

Engineering Knowledge Manager

User's Guide | Appendix A. Defining a Process Template Using XML | A.5. Defining Nodes |

A.5. Defining Nodes |  | A.5.2. Auto Node Type
Prev |  | Next

### A.5.1. Node Type

A node type definition has the following required attributes:

`name`

  specifies the name of the node. This will be displayed in the graph and the Elements tree. Names cannot contain these characters:

  `/ \ : [ ] % * ' " | > < ?`

`description`

  specifies a description of the node. It helps a user understand the task that must be done.

The node type definition has the following optional attributes:

`assignee`

  specifies the user or group who will be assigned the task corresponding to the node. You can further control who gets assigned the task through the following rules:

  - If the `assignee` is not specified or is incorrectly specified, then the person who initiates this node (usually the `assignee` of the previous node in the process) is assigned the task. For example suppose you define a process containing nodes A and B and a transition going from A to B. You specify `joe` as the `assignee` for A but do not specify an `assignee` for B. `joe` will automatically be assigned the task corresponding to B.

  - If the `assignee` is specified as `*` then the person who starts the process is assigned the task.

  - If the `assignee` is specified as `*` followed by a node name, then the `assignee` of that node is assigned the task. This is typically used to let a user who has executed a previous step in the process also execute a follow-up step. For example, suppose you define a process containing nodes A, B and C and transitions going from A to B and from B to C. You specify the assignee of A as group `g1`, the assignee of B as group `g2`, and the assignee of C as `*A`. Now let's suppose that user `joe` belongs to group `g1` and starts the task corresponding to node A. When the task corresponding to node C is created, then `joe` will be automatically assigned to it.

  - If the assignee is specified as `$` followed by a macro name, then the `assignee` of that node will be determined with the execution of that macro. The macro must take an argument that is the node name, and must return a string that is the name of the assignee. For example, you would specify `foo(Run Analysis)` when defining a macro named `foo` that will extract the assignee from a node named Run Analysis. To use the `foo` macro for determining an assignee for a task, you would enter `$foo` as the value of the `assignee` attribute.

`assigneeModifiable`

  specifies whether or not the assignee can be changed. If set to `true`, the process creator or an `admin` user can change the task's assignee in the Process Monitor. This attribute is optional; if not specified, the default value is `true`.

`completionMacro`

  specifies the macro that will initialize a custom dialog box and the `XHTML` file (or files if there are multiple inputs) that defines the custom user interface. By default, when a task is completed the assigned user is prompted to enter the values of all output variables in a standard dialog box. A user interface dialog box is automatically generated based on the output variables specified in the definition of the node that corresponds to the task. You can use a macro to customize the dialog box that is presented to a user on task completion using this attribute. For example, you may want the user to provide inputs that would be processed and actions executed in the background before the task completes. The completion macro must have the following two arguments:

  - instance of `ModelObjectInterface` that specifies the task object from which the dialog box is spawned.

  - instance of `DialogInterface` that specifies the dialog box that must be initialized.

  You must initialize the dialog box and specify the `XHTML` file associated with each step in the body of the macro as shown in the following listing:

      completionMacro(object, dialog) {
            dialog.addStep("Dialog header", "ui-file.xhtml", "");
         }

  The macro shown above adds a single step to the dialog box and specifies the user interface file that goes along with it. The third argument of the `addStep()` method of the `DialogInterface` is the name of an action macro that will be called when the dialog box is submitted by the user. If required you can specify the name of another macro that you have defined as this argument, otherwise you can specify an empty string in its place. That macro must take an instance of `DialogInterface` as argument. For the Task Completion dialog box, you do not need to define the variables in the dialog box initialization macro because EKM will automatically add all the output variables of the node as variables of the dialog box. When the dialog box is submitted by the user, the action macro if specified in the `addStep()` method will be executed. Finally all the values of the dialog’s variables will be stored in the process and the process will advance to the next tasks. See Assigning Custom Dialog Resource Files to a Process Template for details on how to upload process templates that also have resource files for custom user interfaces.

The node type definition has the following optional child elements:

`inputVar`

  This element specifies the name of a variable that is an input to this node. The name must correspond to a variable that you have defined for the process. Input variables are used to allow the assignee of a task to easily find the values of variables that may be required to complete the task. No checks are performed to verify whether the value of input variables has been specified or not.

  In the following example listing, the `Mesh Name` variable is defined as an input variable of the current node. You can specify any number of `inputVar` elements.

      <inputVar>Mesh Name</inputVar>

`outputVar`

  This element specifies the name of variable that is an output of this node. The name must correspond to a variable that you have defined for the process. When the task is completed, the assigned user is prompted to enter the values of all output variables. In the example listing shown below, the `Mesh File` variable is defined as an output variable of the current node. You can specify any number of `outputVar` elements.

  This element contains an optional `displayOrder` attribute that can be used when you want the variable to appear in a particular order. If unspecified, the default value is 2147483647, which will display the property alphabetically by name. Display order values start at `0`. Variables are displayed on the Status tab when viewing a process on the Processes/Process Monitor page. The listing shown below specifies a display order for the two output variables, with `Mesh File` being displayed first, with the `Is Mesh Acceptable?` variable appearing second.

      <outputVar displayOrder="0">Mesh File</outputVar>
      <outputVar displayOrder="1">Is Mesh Acceptable?</outputVar>

`validation`

  This element defines a validation that must be performed before the task can be completed. It used to validate the values entered by the user who is completing the task. This element consists of two attributes: `expression` for specifying a validation expression, and `errorMessage` for specifying the message that will be displayed if validation fails.

  Example: The following listing shows an example of a validation expression. Note that any number of validation elements can be defined.

      <validation expression="dim1 @gt 2*dim2"
            errorMessage="Dimension 1 should be more than double of Dimension 2"/>

The following listing shows an example of a node definition. The name of the node is `Check Mesh`. It has two input variables named: `Mesh Folder` and `Mesh Name` and two output variables named: `Mesh File` and `Is Mesh Acceptable?`. It also has a validation expression for checking whether the `meshFile` has been specified when the mesh is acceptable. Because the two output variables have space character in their names, the IDs of these variables are defined in the expression.

Example 6: Node Definition

    <node name="Check Mesh" description="">
          <inputVar>Mesh Folder</inputVar>
          <inputVar>Mesh Name</inputVar>
          <outputVar>Mesh File</outputVar>
          <outputVar>Is Mesh Acceptable?</outputVar>
          <validation expression='!(isMeshAcceptable @and meshFile == void)'
             errorMessage="Mesh file should be specified if mesh is acceptable" />
    </node>

Contains proprietary and confidential information of ANSYS, Inc. and its subsidiaries and affiliates.

Prev | Up / Contents | Next

Release 18.2 - © ANSYS, Inc. All rights reserved.