Creating handlers for extractable properties

To define how your business-specific rule properties are extracted to and processed by the rule engine, you implement an extractable property handler interface and associate it with a rule model property through a key.

About this task

For example, you can transform the value of an extracted property into a value that has a String representation, to make it easier to use for the rule engine, or to make it more specific to your needs.

Procedure

To define a handler for extractable properties:

  1. Implement the interface IlrExtractablePropertyHandler. This interface provides a method to retrieve the value of an extracted property:
    getGeneratedPropertyValue(IlrElement element, String propertyName)
  2. Open the extension model file in which you defined the property.
  3. In the Rule Model Extension Editor, right-click the property for which you want to define a handler and then click New Child  > Annotation.

    The tree displays a new Annotation item.

  4. Select the Annotation item and, in the Properties view, set these properties:
    • Set the Id property to extractablePropertyHandler.

    • Set the Value property to a key that you will use in Rule Designer or Decision Center to reference the implementation of the interface IlrExtractablePropertyHandler.

  5. Save the extension model file.

Results

In XML, you associate the property to the key that references the implementation as follows:

<?xml version="1.0" encoding="UTF-8"?>
<model:extension-model xmlns:model="http://ilog.rules.brms.extension/model" 
name="myExtension" nsURI="http://ilog.rules.brms.extension/myExtension">
  <add-property className="BusinessRule">
    <property extractable="true" name="priority" type="String">
      <annotation id="extractablePropertyHandler" value="genHandlerID"/>
    </property>
  </add-property>
</model:extension-model>

You have implemented a handler for extractable properties. You must now integrate this implementation into Rule Designer and Decision Center.

Integration into Rule Designer

Integration into Decision Center

Create a Rule Designer plug-in with an extractable property handler extension point.

Integrating extractable property handlers into Rule Designer

Repackage the Decision Center archive to integrate and declare the extractable property handlers.

Integrating extractable property handlers into Decision Center