Show TOC

Procedure documentationCreating a Ruleset Locate this document in the navigation structure

 

You can create a ruleset to group a set of logically related rules.

Example Example

All rules related to discounts can be grouped under the “discountrules” ruleset.

End of the example.

Procedure

  1. In the Project Explorer view, expand the process composer DC node and the process modeling node and choose New Ruleset in the context menu of the Rules and Functions node.

  2. In the dialog box that appears, enter a function name in the Name field.

    Note Note

    The function namespace is predefined and it is the namespace of the development component (DC) that contains your project.

    End of the note.
  3. Select a function return type from the Return type dropdown menu.

    By default, the Return type drop down menu displays all the XSD types. You can also import XSD files and use them as a return type.

    More Information:

    Note Note

    The return type of a ruleset should be either primitive XSD or should match with the parameter type.

    End of the note.
  4. Choose Add to add function parameters.

  5. Click the parameter's type in the Type field and choose a type from the dropdown menu.

    Note Note

    You can click the parameter's name in the Name filed if you want to rename the parameter.

    End of the note.
  6. (Optional) Select the checkbox in the Multiple Occurrences field if the parameter type is a list of elements.

  7. Choose Finish.

The Ruleset Editor

The Ruleset Editor has tabs such as :

  • Overview: You can create, open, and delete If-Then rules and decision tables in this tab page.

    In the Overview tab, under General Information, enter the description of the ruleset in the Documentation field.

    In the Overview tab, under Signature, choose the Result field and in the drop down menu

    • If the return type matches a parameter type, choose a parameter name

    • If the return type is a primitive XSD type, create a definition and choose a definition name

    Note Note

    You cannot edit the Return Type and Parameters fields in the Overview tab.

    End of the note.
  • Definitions : This tab is a link to the Definition Editor, where you can create and edit definitions.

  • Aliases: This tab is a link to the Ruleset Aliases Editor, which gives an overview of all the ruleset aliases available in the process composer DC.

  • Rules: This tab is a link to the Rule Editor, where you can create and edit rules.

  • Decision Tables: This tab is a link to the Decision Table Editor, where you can create and edit decision tables.

In the context menu of the ruleset node, there are options such as:

  • Open: This option allows you to open the Ruleset Editor

  • Delete : This option allows you to permanently remove a ruleset from the process composer DC

  • Manage Aliases : This option allows you to add the JDK classes for the ruleset

  • New Decision Table: This option allows you to create a decision table in the ruleset

  • New Rule: This option allows you to create a rule in the ruleset

Limitation

Invoking a Ruleset

While invoking a ruleset, the input parameter of a ruleset function whose value is not passed at runtime or whose value is null at runtime will not be taken into consideration by the rule engine. If there are any actions written on these parameters, they will fail.

Example Example

Consider the ruleset function: OrderRules. It has two parameters named orderVolume and success.

orderVolume is a complex XSD type and success is a string type.

If the return type matches a type of parameter, choose a parameter name. In this example, the return type of a ruleset function is string, so success is mapped as a return type. The value of success is set in rules.

If the ruleset function is used in a process and no value is passed for success at runtime, the rules will not fire and there will be an exception from the rule engine.

End of the example.

Note Note

At run time, if a data object passed as a ruleset parameter is of primitive type, it must have an assigned value even if it is an output parameter.

End of the note.