Creating a hierarchical property

You define a hierarchical property in an extension model file and attach it to a rule model element.

About this task

To define a hierarchical property, create it in an extension model file and then specify the values of the hierarchy in an extension data file.

Attention:

Do not use a reserved SQL keyword as the name of a property.

Procedure

To create a hierarchical property:

  1. Create or open an extension model file.
  2. In the Rule Model Extension Editor, right-click the extension model entry and then click New Child  > Hierarchy.

    The tree displays a new Hierarchy item.

  3. Select the Hierarchy item and, in the Properties view, set the Name property to the name of the new hierarchy.
  4. Right-click the rule model element to which you want to attach the hierarchical property and then click New Child  > Property.

    The tree displays a new Property item.

  5. Select the Property item and, in the Properties view, set these properties:
    • Set the Name property to the name of the item as you want it to display in the Properties view.

    • Set the Type property to the name of the hierarchy.

  6. Save the extension model file and then create or open an extension data file.
  7. In the Rule Model Extension Editor, right-click the extension data entry and then click New Child  > Hierarchy Data.

    The tree displays a new Hierarchy Data item.

  8. Select the Hierarchy Data item and, in the Properties view, set the Name property to the name you gave to the hierarchy in the extension model file.
  9. Right-click the Hierarchy Data item and then click New Child  > Node.
  10. Set the Name property of the Node item. You can add child nodes to this node to create the hierarchy data.
  11. Save the extension data file.
    Note:

    A hierarchical property cannot have multiple values (many=true), as it represents a path. An example is the 'package' information: a rule cannot be several packages.

Results

You have now created a hierarchical property and attached it to a rule model element.

In XML, you create a hierarchy as follows:

  • In the extension model file:

    <class extends="ActionRule" name="MyRule">
      <property name="location" type="Location"/>
    </class>
    <hierarchy name="Location"/>
  • In the extension data file:

    <hierarchy-data>
      <node name="Location">
        <node name="Europe">
          <node name="France"/>
        </node>
        <node name="USA">
          <node name="Dakota"/>
        </node>
      </node>
    </hierarchy-data>