IBM Support

How to create a user-defined type

Product Documentation


Abstract

You can create your own user-defined types with unique attributes and associations. Up to seven custom rich text fields can be added to the “Detail Information” section. Other elements can be referenced (using the “References” tab), and these will appear in the treebrowser. You can add additional custom attributes, tables, and relationships by further modifying the user-defined type (see topic “Modifying an Existing Type”).

Content

1.0 Create User-Defined Type Definition File

  1. In Rational Method Composer, click File > Create UDT definition to either open the wizard for a new definition file or open the existing definition file.

  2. If no definition file exists
    1. You will be prompted to select the parent folder where the new user-defined type file should be placed.

    2. Select either the configuration directory (for a standard library), or a configuration project folder (for a workspace-based library).

      Note: The definition file will always be named “user_defined_types.xml”.

    3. Click Finish to open the definition file.



  3. RMC will open the definition file in its built-in text editor.

    Note: You may also open it from any other text editor, including XML editors.

  4. The definition file is ready for modifying existing types, or creating/modifying user-defined types.



    Once you finish modifying the types:
    1. Save the work
    2. Click on File > Update UDT Elements
    3. Click OK to continue

    The changes you specified will now take effect.



2.0 Creating User-Defined Types

To create user-defined types, create <type></type> tags and nest them inside the pre-existing <types></types> tag.

Note: There is no “s” for the nested tags. The new user-defined types will be available for the entire library to use.

In order to demonstrate the creation process and usage, walk through the following example:

XML:

<type name="Work Product State" id="com.ibm.rmc.state">
<rte_1>State main description</rte_1>
<rte_2>Not used - leave blank and field will not be published</rte_2>
<rte_3>Not used - leave blank and field will not be published</rte_3>
<rte_4>Not used - leave blank and field will not be published</rte_4>
<rte_5>Not used - leave blank and field will not be published</rte_5>
<rte_6>Not used - leave blank and field will not be published</rte_6>
<rte_7>Not used - leave blank and field will not be published</rte_7>
<reference_qualifiers>
<qualifier id="com.ibm.rmc.state.substate">Sub-state</qualifier>
<qualifier id="com.ibm.rmc.state.guidance">Guidance</qualifier>
</reference_qualifiers>
<node_icon>/udt_images/state_node.gif</node_icon>
<shape_icon>/udt_images/state_shape.gif</shape_icon>
</type>


name and id attributes:

The name and id attributes are mandatory. The name is displayed in editors and published pages. The id attribute is needed if you want to further modify the type (see topic “Modifying an Existing Type”). In this example, a type named “State” with id “com.ibm.rmc.state” was created.

<rte_#> tag:

For each new user-defined type, you can define up to 7 rich text field. Using the <rte_#> tag, you can give a name for the rich text field (enclose the name in the <rte_#>tags). Leaving blank for the name will give the rich text field the name “Rich Text Field #”. If you don't need all the fields, consider naming unused fields as “Not used - leave blank and field will not be published” in order to make the usage self-explanatory.

<node_icon> and <shape_icon> tags:

The <node_icon> and <shape_icon> are for adding graphic icons for the user-defined type. The images file must be stored in the same configuration folder that contains the user_defined_types.xml file, or in a sub-folder of this folder).

<reference_qualifiers> tag:

The reference_qualifiers tag is optional. It is used to further qualify a referenced element. In the example above, two qualifiers: “Sub-state” and “Guidance” were added.

RMC Editor:

In the RMC Editor, you can now add a new element with type “State”, as shown below.






For example, you can create a new State element, call it example_state, and add presentation name and brief description like any other element.



As defined in the XML, the main description you can put content in the rich text field and you can leave the other rich text fields empty so that they do not publish.

Next, you can add references to this element (click on the reference tab). You can optionally qualify these references as Guidance or Sub-state, which are qualifiers we specified in the type definition.



Browsing Results:

Click on the preview tab to see the results of this example:

[{"Product":{"code":"SS7DVG","label":"IBM Engineering Lifecycle Optimization - Method Composer"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Authoring","Platform":[{"code":"PF033","label":"Windows"},{"code":"PF016","label":"Linux"}],"Version":"7.5.2","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Product Synonym

Rational Method Composer

Document Information

Modified date:
17 June 2018

UID

swg27027351