Creating a value translator

You use a value translator to define how IRL is generated for your business-specific BOM types.

About this task

A value translator provides a mechanism for generating IRL source code from a literal value. You can attach a value translator to a BOM class, or to a BOM member with a value info. In the value info implementation, use the method IlrValueInfo.getValueTranslator(String) to reference your value translator implementation.

Note:

Semantic queries run on the IRL code generated from the business rule. If a value translator is attached to a BOM member, the generated IRL uses this translation. Therefore, semantic queries cannot find the BOM member as it does not appear in the IRL code.

Procedure

To create a value translator for a BOM class:

  1. Implement the interface IlrValueTranslator, and redefine the methods translateValue and allowValueWrapping.
    • The method String translateValue(String value, IlrConcept concept, IlrVocabulary vocabulary) generates the text of the IRL code from the specified value, which corresponds to a BOM class. The value is the text as it is stored in the abstract syntax tree.

    • The method boolean allowValueWrapping() indicates if the generated value text can be wrapped and manipulated for value conversion. This method returns false in most cases.

  2. In Rule Designer, in the BOM Editor, open the class for which you want to define the value translator.
  3. In the Custom Properties section, click Add.

    A new custom property is created.

  4. In the Name column, click newProp and then type valueTranslator.
  5. In the Value column, type the key that you will use in Rule Designer and Decision Center to reference your value translator class.

Results

You now have a value translator, which you must integrate into the relevant Operational Decision Manager modules.

Integration into

Rule Designer

Integration into

Decision Center

Create a Rule Designer plug-in with a value translator extension point.

Integrating a value translator into Rule Designer

Repackage the Decision Center archive to integrate and declare the value translator.

Integrating a value translator into Decision Center