Understanding Oracle Business Rules Decision Point Action Type

Working with Oracle Business Rules and ADF Business Components 10-3 trade-off is that related view objects become inaccessible and, should related view object access be required, these relationships must be explicitly managed. ■ Internally in Oracle Business Rules, when you use ADF Business Components fact types these fact types are created as instances of RL fact types. Thus, you cannot assert ADF Business Components view object instances directly to a Rule Session, but must instead use the helper methods provided in the MetadataHelper and ADFBCFactTypeHelper classes. For more information, see Oracle Fusion Middleware Java API Reference for Oracle Business Rules.

10.1.2 Understanding Oracle Business Rules Decision Point Action Type

With Rules SDK, the primary way to update a view object within a Decision Point is with an action type. An action type is a Java class that you import into the rule dictionary data model in the same way you import a rule pattern fact type Java class. A new instance of this action type is then asserted in the action of a rule and then processed by the Postprocessing Ruleset in the DecisionPointDictionary. A Java class to be used as an action type must conform to the following requirements: ■ The Java fact type class must subclass oracle.rules.sdk2.decisionpoint.ActionType or oracle.rules.sdk2.decisionpoint.KeyedActionType . By subclassing KeyedActionType the Java class inherits a standard oracle.rules.sdk2.decisionpoint.KeyChain attribute, which may be used to communicate the rule facts primary keys and parent-keys to the ActionType instance. ■ The class has a default constructor. ■ The class implements abstract exec method for the ActionType. The exec method should contain the main action which you want to perform. ■ The Java class must have properties which conform to the JavaBean interface that is, each property must have a getter and setter method. Example 10–1 shows a sample ActionType implementation. Example 10–1 Implementing an ActionType package com.example; import oracle.jbo.domain.Number; import oracle.rules.sdk2.decisionpoint.ActionType; import oracle.rules.sdk2.decisionpoint.DecisionPointInstance; public class RaiseAction extends ActionType { private double raisePercent; public void execDecisionPointInstance dpi { Number salary = NumbergetViewRowImpl.getAttributeSalary; salary = Numbersalary.multiply1.0d + getRaisePercent.scale100,2, new boolean[]{false}; dpi.addResultraise for + this.getViewRowImpl.getAttributeEmployeeId, getRaisePercent + = + salary ; getViewRowImpl.setAttributeSalary, salary; } public void setRaisePercentdouble raisePercent { this.raisePercent = raisePercent; } 10-4 Oracle Fusion Middleware Users Guide for Oracle Business Rules public double getRaisePercent { return raisePercent; } } In Example 10–1 , there is an oracle.rules.sdk2.decisionpoint.DecisionPointInstance as a parameter to the exec method. Table 10–1 shows the methods in DecisionPointInstance that an application developer might need when implementing the ActionType exec. Using Rules Designer you can select parameters appropriate for the ActionType you are configuring.

10.2 Using Decision Points with ADF Business Components Facts