How to Create and Use Decision Point Instances
7.3.4 How to Create and Use Decision Point Instances
The DriverCheckerRunnable instances call the checkDriver method. Example 7–5 shows the checkDriver method that is defined in CarRentalWithDecisionPoint . The checkDriver method handles invoking Decision Point with a Driver instance. Example 7–5 Code to Create a Decision Point Instance with getInstance public class CarRentalWithDecisionPoint extends CarRental { protected static DecisionPoint m_decisionPoint; public static void checkDriverfinal Driver driver { try { DecisionPointInstance instance = m_decisionPoint.getInstance; instance.setInputsnew ArrayListObject { { adddriver; } }; ListObject outputs = instance.invoke; if outputs.isEmpty System.err.printlnOops, no results; java.util.ListDenial denials = java.util.ListDenialoutputs.get0; if denials.isEmpty { System.out.printlnRental is allowed for + driver.getName; } else { for Denial denial : denials { System.out.printlnRental is denied for + denial.getDriver.getName + because + denial.getReason; } } } catch RLException e { e.printStackTrace; } catch SDKException e { e.printStackTrace; } } } Example 7–5 shows the following: 7-14 Oracle Fusion Middleware Users Guide for Oracle Business Rules ■ Getting a DecisionPointInstance from the static DecisionPoint defined with the DecisionPointBuilder, with the following code. DecisionPointInstance instance = m_decisionPoint.getInstance; ■ Add inputs according to the signature of the decision function associated with the Decision Point. This defines one argument of type List as the input. This List contains the Driver instances: instance.setInputsnew ArrayListObject { { adddriver; } }; ■ Invoke the Decision Point and store the return value. The return type follows the same pattern as the decision function which is being called in the Decision Point. ListObject outputs = instance.invoke; In this case the invoke returns a List of length one, containing a List of Denial instances. ■ If the return is a List of any other size than one, then this is an error: if outputs.isEmpty System.err.printlnOops, no results; ■ The first entry that is returned from the Decision Point is caste it to a List of type ListDenial : java.util.ListDenial denials = java.util.ListDenialoutputs.get0; ■ If the denials list is empty, then no Denial instances were asserted by the rules. This indicates that it is OK to rent a car to the driver. Otherwise, print the reasons why the driver rental was rejected: if denials.isEmpty { System.out.printlnRental is allowed for + driver.getName; } else { for Denial denial : denials { System.out.printlnRental is denied for + denial.getDriver.getName + because + denial.getReason; } }7.4 Running the Car Rental Sample
Parts
» Oracle Fusion Middleware Online Documentation Library
» What Are Rule Conditions? What Are Rule Actions?
» What Are Decision Tables? What Are Facts and Bucketsets? What Are Rulesets?
» Oracle Business Rules SDK Rules Designer
» Declarative Rules The RETE Algorithm
» How to Display and Edit XML Facts How to Reload XML Facts with Updated Schema
» What You Need to Know About XML Facts
» How to Display and Edit Java Facts What You Need to Know About Java Facts
» What You Need to Know About List of Values Bucketsets What You Need to Know About Range Bucketsets
» What You Need to Know About Bucketset Allowed in Actions Option
» In the Filter Query field, click insert test to insert a default test as
» How to Add Rules How to Define a Test in a Rule
» What You Need to Know About Advanced Mode Rules
» Introduction to Tree Mode Rules
» What You Need to Know About Tree Mode Rules
» How to Use Bucketsets to Provide Options for Test Expressions
» From the list next to the Add icon, select Rule.
» Introduction to Decision Table Operations
» Introduction to Decision Point API How to Obtain the Car Rental Sample Application
» How to Create Data Model Elements for Use with a Decision Point
» How to Add a Decision Point Using Decision Point Builder
» How to Create and Use Decision Point Instances
» What You Need to Know About Decision Point and Decision Tracing
» Testing Oracle Business Rules at Runtime Introduction to the Grades Sample Application
» Enter a name and test score and click Submit. This returns results as shown in
» Understanding Oracle Business Rules ADF Business Components Fact Types
» Understanding Oracle Business Rules Decision Point Action Type
» How to Call a Decision Point with ADF Business Components Facts
» How to Call a Decision Function with Java Decision Point Interface
» What You Need to Know About Decision Function Configuration with ADF Business Components
» How to Add the Outside Manager Finder Class
» How to Update ADF META INF for Local Dictionary Access
» How to Add the Employee Raises Java Class
» Working with Decision Component Metadata
» Introduction to Decision Components Decision Service Architecture
» Working with Advanced Mode Options
» Expression Builder Condition Browser
» Editing Decision Table Cells
» Understanding the Validation Panel Updating the Validation Panel
Show more