Rules Editor

The RULES_DEFINITION domain produces the rules editor. This control has a default HTML-only view or, if the FIELD 's CONTROL attribute is set to DYNAMIC, an SVG view. See Default Rules View and Dynamic Rules View for more information.

This widget uses the CONFIG attribute to specify an ID attribute value matching the ID attribute value of a CONFIG element in the RulesEditorConfig.xml file. This XML configuration file is merged during the build process in a similar method to other XML configuration files. The following is a sample of RulesEditorConfig.xml:

Figure 1. Sample RulesEditorConfig.xml File
<RULES-CONFIG DEFAULT="DefaultConfig">
  <CONFIG ID="DefaultConfig" HYPERLINK-TEXT="true">
    <TYPE NAME="Product"
          SUCCESS-ICON="Images/product-16x16.gif"
          FAILURE-ICON="Images/productFail.gif"
          EDIT-PAGE="RatesNewColumn"/>
    <TYPE NAME="Assessment"
          SUCCESS-ICON="Images/default-16x16.gif"
          FAILURE-ICON="Images/defaultFail.gif"
          EDIT-PAGE="RatesNewColumn"/>
    <TYPE NAME="SubRuleSet"
          SUCCESS-ICON="Images/default-16x16.gif"
          FAILURE-ICON="Images/defaultFail.gif"
          EDIT-PAGE="RatesNewColumn"/>
    <TYPE NAME="ObjectiveGroup"
          SUCCESS-ICON="Images/default-16x16.gif"
          FAILURE-ICON="Images/defaultFail.gif"
          EDIT-PAGE="RatesNewColumn"/>
    <TYPE NAME="ObjectiveListGroup"
          SUCCESS-ICON="Images/default-16x16.gif"
          FAILURE-ICON="Images/defaultFail.gif"
          EDIT-PAGE="RatesNewColumn"/>
    <TYPE NAME="Objective"
          SUCCESS-ICON="Images/default-16x16.gif"
          FAILURE-ICON="Images/defaultFail.gif"
          EDIT-PAGE="RatesNewColumn"/>
    <TYPE NAME="SubRuleSetLink"
          SUCCESS-ICON="Images/default-16x16.gif"
          FAILURE-ICON="Images/defaultFail.gif"
          EDIT-PAGE="RatesNewColumn"/>
    <TYPE NAME="RuleGroup"
          SUCCESS-ICON="Images/default-16x16.gif"
          FAILURE-ICON="Images/defaultFail.gif"
          EDIT-PAGE="RatesNewColumn"/>
    <TYPE NAME="RuleListGroup"
          SUCCESS-ICON="Images/rule-group-16x16.gif"
          FAILURE-ICON="Images/ruleGroupFail.gif"
          EDIT-PAGE="RatesNewColumn"/>
    <TYPE NAME="Rule"
          SUCCESS-ICON="Images/rule-16x16.gif"
          FAILURE-ICON="Images/ruleFail.gif"/>
    <TYPE NAME="DataItemAssignment"
          SUCCESS-ICON="Images/default-16x16.gif"
          FAILURE-ICON="Images/defaultFail.gif"
          EDIT-PAGE="RatesNewColumn"/>
  </CONFIG>
  <CONFIG ID="Editor.Config"
          HYPERLINK-TEXT="true"
          OPEN-NODE-PARAM="openNode"
          DECISION-ID-SOURCE="source-Decision-ID"
          DECISION-ID-TARGET="decision-ID">
    <TYPE NAME="Product" EDIT-PAGE="RulesResult"/>
    <TYPE NAME="Assessment" EDIT-PAGE="RulesResult"/>
    <TYPE NAME="SubRuleSet" EDIT-PAGE="RulesResult"/>
    <TYPE NAME="ObjectiveGroup" EDIT-PAGE="RulesResult"/>
    <TYPE NAME="ObjectiveListGroup" EDIT-PAGE="RulesResult"/>
    <TYPE NAME="Objective" EDIT-PAGE="RulesResult"/>
    <TYPE NAME="SubRuleSetLink" EDIT-PAGE="RulesResult"/>
    <TYPE NAME="RuleGroup" EDIT-PAGE="RulesResult"/>
    <TYPE NAME="RuleListGroup" EDIT-PAGE="RulesResult"/>
    <TYPE NAME="Rule"/>
    <TYPE NAME="DataItemAssignment" EDIT-PAGE="RulesResult"/>
 </CONFIG>
</RULES-CONFIG>

Note that the RULES-CONFIG root element only contains the DEFAULT attribute. This attribute is mandatory and should match an ID on a CONFIG element in this document. The default configuration contains the icon information as well as the default nodes to link to if no configuration is present for a widget. These are covered by the SUCCESS-ICON, FAILURE-ICON, and EDIT-PAGE attributes respectively.

Each CONFIG element has a HYPERLINK-TEXT attribute which is used to specify whether the text next to a rules node in the widget is also to be used as a hyperlink to the link page set by the EDIT-PAGE for the TYPE in question.

Note that the CONFIG with the ID of value of Editor.Config has the optional attribute OPEN-NODE-PARAM. This attribute is the name of a page parameter whose value is the ID of a node to open to when the page is opened.

The CONFIG attributes DECISION-ID-SOURCE and DECISION-ID-TARGET are used to identify a page parameter whose value will be the source for a new parameter (named by the DECISION-ID-TARGET) appended to each link on the widget. The above example will look for a page parameter called source-Decision-ID and pass on its value as a parameter to any links on the widget. This new value will be identified by a parameter named decision-ID.

The decision ID parameter may also be sourced from a field on a server bean instead of from a page parameter. This is achieved by adding DECISION-ID-SOURCE-BEAN and DECISION-ID-SOURCE-FIELD attributes to the CONFIG element instead of a DECISION-ID-SOURCE attribute. A validation error is thrown if all three are present. The DECISION-ID-SOURCE attribute should be the name of a bean on the page and the DECISION-ID-SOURCE-FIELD attribute should be the full name of a field providing the decision ID value. The following is an example of this configuration:

Figure 2. Example of Decision ID Sourced from a Bean
<CONFIG ID="Decision.ID.Bean.Source"
        HYPERLINK-TEXT="true"
        OPEN-NODE-PARAM="openNode"
        DECISION-ID-TARGET="decision-ID"
        DECISION-ID-SOURCE-BEAN="DISPLAY"
        DECISION-ID-SOURCE-FIELD="dtls$decision-ID">
  <TYPE NAME="PRODUCT" EDIT-PAGE="RulesResult"/>
  <TYPE NAME="ASSESSMENT" EDIT-PAGE="RulesResult"/>
  <TYPE NAME="SUBRULESET" EDIT-PAGE="RulesResult"/>
  <TYPE NAME="OBJECTIVE_GROUP" EDIT-PAGE="RulesResult"/>
  <TYPE NAME="OBJECTIVE_LIST_GROUP" EDIT-PAGE="RulesResult"/>
  <TYPE NAME="OBJECTIVE" EDIT-PAGE="RulesResult"/>
  <TYPE NAME="RULE_GROUP" EDIT-PAGE="RulesResult" />
  <TYPE NAME="RULE_LIST_GROUP" EDIT-PAGE="RulesResult"/>
  <TYPE NAME="RULE" EDIT-PAGE="RulesResult"/>
</CONFIG>