What You Need to Know About Decision Point and Decision Tracing

7-16 Oracle Fusion Middleware Users Guide for Oracle Business Rules Similar to the steps in Example 7–1 , Example 7–7 shows the following: 1. The first step is to create a DecisionPointBuilder instance with. new DecisionPointBuilder 2. The with method using a String argument defines the name of the decision function that the Decision Point executes. Calling this method is mandatory. .withDF_NAME The DF_NAME specifies the name of the decision function you define for your application. For example for the car rental application this is defined in CarRental.java a CarRentalDecisionFunction. 3. Call only one of the other two with methods. In this case the sample code calls a DictionaryFQN to access an MDS repository. Example 7–8 shows the routing that uses the dictionary package and the dictionary name to create the DictionaryFQN . .withDICT_FQN 4. Call the build method to construct and return a DecisionPoint instance. Example 7–8 Using the DictionaryFQN Method with MDS Repository protected static final String DICT_PKG = com.example.rules.demo; protected static final String DICT_NAME = CarRental; protected static final DictionaryFQN DICT_FQN = new DictionaryFQNDICT_PKG, DICT_NAME; protected static final String DF_NAME = CarRentalDecisionFunction;

7.6 What You Need to Know About Decision Point and Decision Tracing

The Rules SDK API contains methods to assist with processing a decision trace. These methods process a decision trace to replace the RL names used in the trace with the aliases used in the associated dictionary. This makes the decision trace naming consistent with the naming used in the Oracle Business Rules dictionary. The basic API for processing a decision trace requires a RuleDictionary object and a DecisionTrace object: RuleDictionary dict = ...; DecisionTrace trace = ...; dict.processDecisionTracetrace; This code shows the processing call that converts the naming in the decision trace to use the same names, with aliases, as in the dictionary. The Rules SDK Decision Point API contains methods that allow you configure decision tracing and retrieve the resulting trace when you invoke a decision point. The trace you retrieve from the Decision Point is internally processed using the processDecisionTrace method, thus you do not need to call this method to process the decision trace when you are working with a decision trace from a Decision Point. Working with Rules SDK Decision Point API 7-17 Table 7–2 shows the Decision Point API methods for setting decision trace options. For more information on these methods, see Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules. Example 7–9 shows a sample usage of decision tracing with DecisionPoint API. Example 7–9 Using Decision Trace from Decision Point API DecisionPoint dp = new DecisionPointBuilder .withnew DictionaryFQNcom.foo, Bar .withMyDecisionFunction .setDecisionTraceLevelDecisionPointBuilder.DECISION_TRACE_DEVELOPMENT .setDecisionTraceLimit24000 .build; ... DecisionPointInstance dpi = dp.getInstance; dpi.invoke; DecisionTrace trace = dpi.decisionTrace; with aliases replaced For more information on decision tracing, see Tracing Rule Execution in Fusion Middleware Control Console in Oracle Fusion Middleware Administrators Guide for Oracle SOA Suite and Oracle Business Process Management Suite. Table 7–2 Decision Point Decision Tracing Methods Method Description decisionTrace Get the decision trace produced from the call to invoke. Returns DecisionTrace getDecisionTraceLevel Get the decision trace level to be used by the RuleSession. This value defaults to DECISION_TRACE_OFF, which means no trace information is gathered. Possible values are: DECISION_TRACE_OFF DECISION_TRACE_DEVELOPMENT DECISION_TRACE_PRODUCTION Return Type: String getDecisionTraceLimit Get the decision trace limit, or maximum number of trace elements which are retrieved for the trace. Return Type: int setDecisionTraceLevel Set the decision trace level to be used by the RuleSession. This parameter value is a String. Possible values are: DECISION_TRACE_OFF DECISION_TRACE_DEVELOPMENT DECISION_TRACE_PRODUCTION setDecisionTraceLimit Set the decision trace limit, or maximum number of trace elements which are retrieved for the trace. 7-18 Oracle Fusion Middleware Users Guide for Oracle Business Rules 8 Testing Business Rules 8-1 8 Testing Business Rules You can test your rules and Decision Tables from Rules Designer by creating an Oracle Business Rules Function. In an SOA application or in an application that accesses Oracle Business Rules with a decision function with a web service, you can test the rules at runtime with Oracle Enterprise Manager Fusion Middleware Control Console using the Test function. This chapter includes the following sections: ■ Section 8.1, Testing Oracle Business Rules at Design Time