Oracle Fusion Middleware Java API Reference for Oracle Business Rules
11g Release 1 (11.1.1.7)

E10663-11

oracle.rules.sdk2.decisionpoint
Class DecisionPointBuilder

java.lang.Object
  extended by oracle.rules.sdk2.decisionpoint.DecisionPointBuilder

public class DecisionPointBuilder
extends java.lang.Object

Builder for creating a decision point.


Field Summary
static int DECISION_TRACE_DEVELOPMENT
           
static int DECISION_TRACE_OFF
           
static int DECISION_TRACE_PRODUCTION
           
 
Constructor Summary
DecisionPointBuilder()
          Constructor.
 
Method Summary
static void addDataSource(java.lang.String datasrc, java.lang.String url, java.lang.String user, java.lang.String pw)
          setup a jndi data source for unit test
 DecisionPoint build()
          Constructs and returns a DecisionPoint instance from the values specified in this builder.
static void createDecisionPointMetadata(java.lang.String fileName, java.lang.String decisionPointName, java.lang.String topViewDefName, java.util.List<java.lang.String> javaClassNames, boolean forWebService, oracle.jbo.server.DBTransactionImpl2 txn)
          Deprecated.  
 java.lang.ClassLoader getClassLoader()
          The classloader to be used by this decision point.
 java.util.Map getConfig()
          Retrieve the config map to be used for the RuleSession.
 java.util.Calendar getCurrentDate()
          Return the current date used by this decision point
 java.lang.String getDecisionFunction()
          Return the name of the decision function to be executed in this decision point.
 int getDecisionTraceLevel()
          Retrieve the decision trace level.
 int getDecisionTraceLimit()
          Retrieve the decision trace limit.
 RuleDictionary getDictionary()
          The rule dictionary instance, when loaded by client code instead of through MDS.
 DictionaryFQN getDictionaryFQN()
          Return the fully-qualified name of the dictionary that this decision point is using.
 java.util.Calendar getEffectiveDate()
          Return the effective date used by this decision point
 java.util.Map<java.lang.String,java.lang.Object> getProperties()
          Return all properties accessible by the DecisionPointInstance
 java.lang.Object getProperty(java.lang.String name)
          Return a single property value
 boolean isDebug()
          Deprecated.  
static DecisionPointInstance processWebInputs(RuleSession rs, DecisionPointInputs dpinputs)
          Create a new DecisionPointInstance using the RuleSession and DecisionPointInputs instances passed as parameters.
static DecisionPointInstance processWebInputs(RuleSession rs, SimpleDecisionPointInput dpinput)
          Create a new DecisionPointInstance using the RuleSession and SimpleDecisionPointInput instances passed as parameters.
 DecisionPointBuilder setClassLoader(java.lang.ClassLoader loader)
          Set the classloader to be used by this decision point.
 DecisionPointBuilder setConfig(java.util.Map<?,?> config)
           
 DecisionPointBuilder setCurrentDate(java.util.Calendar currentDate)
          Set the current date to be used by this decision point
 DecisionPointBuilder setDebug(boolean debug)
          Deprecated.  
 DecisionPointBuilder setDecisionFunction(java.lang.String decisionFunction)
          Set the unqualified name of the decision function to call as part of this decision point.
 DecisionPointBuilder setDecisionTraceLevel(int level)
          Set the decision trace level.
 DecisionPointBuilder setDecisionTraceLimit(int limit)
          Set the decision trace limit.
 DecisionPointBuilder setDictionary(RuleDictionary dict)
          Sets the rule dictionary instance, when loaded by developer code instead of through MDS.
 DecisionPointBuilder setDictionaryFQN(DictionaryFQN fqn)
          This will cause the decision point to retrieve the dictionary with the indicated name from the MDS repository.
 DecisionPointBuilder setEffectiveDate(java.util.Calendar effectiveDate)
          Set the effective date to be used by this decision point
 DecisionPointBuilder setInitialSize(int size)
          Set the initial size of the rule session pool managed by the decision point.
 DecisionPointBuilder setProperty(java.lang.String name, java.lang.Object value)
          Set a single property value.
 DecisionPointBuilder setShouldPool(boolean shouldPool)
          Set the value of the pooling attribute.
 DecisionPointBuilder setShouldRefresh(boolean shouldRefresh)
          Set the value of the dictionary refresh attribute.
 DecisionPointBuilder setSoftMaxSize(int size)
          Set the soft maximum size of the rule session pool managed by the decision point.
 boolean shouldPool()
          By default, the decision point will manage a pool of RuleSession instances.
 boolean shouldRefresh()
          By default, the decision point will detect changes to the rule dictionary identified by the DictionaryFQN.
static DictionaryFQN stringToFqn(java.lang.String fqn)
           
 DecisionPointBuilder with(DictionaryFQN fqn)
          Fluent interface method which aliases the DecisionPointBuilder.setDictionaryFQN(oracle.rules.sdk2.repository.DictionaryFQN) method.
 DecisionPointBuilder with(RuleDictionary dict)
          Fluent interface method which aliases the DecisionPointBuilder.setDictionary(oracle.rules.sdk2.dictionary.RuleDictionary) method.
 DecisionPointBuilder with(java.lang.String decisionFunction)
          Fluent interface method which aliases the DecisionPointBuilder.setDecisionFunction(java.lang.String) method.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DECISION_TRACE_OFF

public static final int DECISION_TRACE_OFF
See Also:
Constant Field Values

DECISION_TRACE_PRODUCTION

public static final int DECISION_TRACE_PRODUCTION
See Also:
Constant Field Values

DECISION_TRACE_DEVELOPMENT

public static final int DECISION_TRACE_DEVELOPMENT
See Also:
Constant Field Values
Constructor Detail

DecisionPointBuilder

public DecisionPointBuilder()
Constructor.

Method Detail

with

public DecisionPointBuilder with(DictionaryFQN fqn)
Fluent interface method which aliases the DecisionPointBuilder.setDictionaryFQN(oracle.rules.sdk2.repository.DictionaryFQN) method. This will cause the decision point to retrieve the dictionary with the indicated name from the MDS repository.

Parameters:
fqn - the name of the dictionary to be used
Returns:
self

with

public DecisionPointBuilder with(RuleDictionary dict)
Fluent interface method which aliases the DecisionPointBuilder.setDictionary(oracle.rules.sdk2.dictionary.RuleDictionary) method. This will cause the decision point to use the specified dictionary.

Parameters:
dict - the caller-loaded dictionary to be used
Returns:
self

with

public DecisionPointBuilder with(java.lang.String decisionFunction)
Fluent interface method which aliases the DecisionPointBuilder.setDecisionFunction(java.lang.String) method. This will cause the decision point to use the specified decision function.

Parameters:
decisionFunction - the unqualified name of the decision function to call
Returns:
self

build

public DecisionPoint build()
                    throws SDKException
Constructs and returns a DecisionPoint instance from the values specified in this builder.

Returns:
a new DecisionPoint instance
Throws:
SDKException - if the builder has not been properly specified

setDecisionTraceLevel

public DecisionPointBuilder setDecisionTraceLevel(int level)
Set the decision trace level. This defaults to DECISION_TRACE_OFF

Parameters:
level - the decision trace level, as defined in RuleSession
Returns:
this

getDecisionTraceLevel

public int getDecisionTraceLevel()
Retrieve the decision trace level.

Returns:
the decision trace level

setDecisionTraceLimit

public DecisionPointBuilder setDecisionTraceLimit(int limit)
Set the decision trace limit. This defaults to 10000.

Parameters:
limit - the decision trace limit, as defined in RuleSession
Returns:
this

getDecisionTraceLimit

public int getDecisionTraceLimit()
Retrieve the decision trace limit.

Returns:
the decision trace limit

setConfig

public DecisionPointBuilder setConfig(java.util.Map<?,?> config)
Parameters:
config - the Map instance to use
Returns:
this

getConfig

public java.util.Map getConfig()
Retrieve the config map to be used for the RuleSession.

Returns:
the config map

shouldPool

public boolean shouldPool()
By default, the decision point will manage a pool of RuleSession instances. This returns the value of whether or not it should do this.

Returns:
true if the decision point will manage a pool, false otherwise

setShouldPool

public DecisionPointBuilder setShouldPool(boolean shouldPool)
Set the value of the pooling attribute. If set to false, the caller must supply a RuleSession instance configued with the necessary RL code to the DecisionPointInstance before calling the invoke method. Not using the pool management capabilities of decision point is considered an advanced usecase.

Returns:
self

shouldRefresh

public boolean shouldRefresh()
By default, the decision point will detect changes to the rule dictionary identified by the DictionaryFQN. When a change is detected, the dictionary is reloaded and the pool of RuleSession instances is refreshed if shouldPool() is true. This is only applicable if the DecisionPointBuilder has the DictionaryFQN set.

Returns:
true if the decision point respond to dictionary changes.

setShouldRefresh

public DecisionPointBuilder setShouldRefresh(boolean shouldRefresh)
Set the value of the dictionary refresh attribute. If set to false, the dictionary is loaded once and not reloaded if the dictionary is modified. This is only applicable if the DecisionPointBuilder has the DictionaryFQN set.

Returns:
self

setInitialSize

public DecisionPointBuilder setInitialSize(int size)
Set the initial size of the rule session pool managed by the decision point. This should only be changed after thorough performance analysis.

Returns:
self

setSoftMaxSize

public DecisionPointBuilder setSoftMaxSize(int size)
Set the soft maximum size of the rule session pool managed by the decision point. This should only be changed after thorough performance analysis.

Returns:
self

setDebug

@Deprecated
public DecisionPointBuilder setDebug(boolean debug)
Deprecated. 

Previously controlled debug output. Now a noop.

Parameters:
debug - true to turn debug output on, false to turn it off
Returns:
self

isDebug

@Deprecated
public boolean isDebug()
Deprecated. 

Previously controlled debug output. Now a noop.

Returns:
true to turn debug output on, false to turn it off

getDictionaryFQN

public DictionaryFQN getDictionaryFQN()
Return the fully-qualified name of the dictionary that this decision point is using.

Returns:
fully-qualified name of dictionary

setDictionaryFQN

public DecisionPointBuilder setDictionaryFQN(DictionaryFQN fqn)
This will cause the decision point to retrieve the dictionary with the indicated name from the MDS repository.

Parameters:
fqn - the name of the dictionary to be used.
Returns:
self

setDictionary

public DecisionPointBuilder setDictionary(RuleDictionary dict)
Sets the rule dictionary instance, when loaded by developer code instead of through MDS. The preferred way of loading the rule dictionary is to configure MDS and then set only the name of the dictionary which this decision point should use. Do not call setDictionaryName in this case.

Parameters:
dict - a reference to a RuleDictionary to be used by this DecisionPoint
Returns:
self

getDictionary

public RuleDictionary getDictionary()
The rule dictionary instance, when loaded by client code instead of through MDS.

Returns:
the specified dictionary

setDecisionFunction

public DecisionPointBuilder setDecisionFunction(java.lang.String decisionFunction)
Set the unqualified name of the decision function to call as part of this decision point. This is the name only, and not the fully-qualified name.

Parameters:
decisionFunction - name of the decision function to call
Returns:
self

getDecisionFunction

public java.lang.String getDecisionFunction()
Return the name of the decision function to be executed in this decision point.

Returns:
the name of the decision function

setClassLoader

public DecisionPointBuilder setClassLoader(java.lang.ClassLoader loader)
Set the classloader to be used by this decision point. Typically, this does not need to be set explictly, as the environment will contain an appropriate classloader.

Parameters:
loader - ClassLoader instance from which to load the built-in rules DecisionPointDictioanry
Returns:
self

getClassLoader

public java.lang.ClassLoader getClassLoader()
The classloader to be used by this decision point.

Returns:
the classloader instance to be used by this decision point, or null if the default one is to be used

getProperties

public java.util.Map<java.lang.String,java.lang.Object> getProperties()
Return all properties accessible by the DecisionPointInstance

Returns:
a map of all properties

getProperty

public java.lang.Object getProperty(java.lang.String name)
Return a single property value

Parameters:
name - name of the property value to retrieve
Returns:
the value of the property name

setProperty

public DecisionPointBuilder setProperty(java.lang.String name,
                                        java.lang.Object value)
Set a single property value. These properties are local to the decision point and do not affect the JVM system properties.

Parameters:
name - the name of the property to set
value - the value of the property
Returns:
self

getCurrentDate

public java.util.Calendar getCurrentDate()
Return the current date used by this decision point

Returns:
the calendar representing the current date

setCurrentDate

public DecisionPointBuilder setCurrentDate(java.util.Calendar currentDate)
Set the current date to be used by this decision point

Parameters:
currentDate - set the current date of RuleSessions used by this decision point
Returns:
self

getEffectiveDate

public java.util.Calendar getEffectiveDate()
Return the effective date used by this decision point

Returns:
the calendar representing the effective date

setEffectiveDate

public DecisionPointBuilder setEffectiveDate(java.util.Calendar effectiveDate)
Set the effective date to be used by this decision point

Parameters:
effectiveDate - set the effective date of RuleSessions used by this decision point
Returns:
self

createDecisionPointMetadata

@Deprecated
public static void createDecisionPointMetadata(java.lang.String fileName,
                                                          java.lang.String decisionPointName,
                                                          java.lang.String topViewDefName,
                                                          java.util.List<java.lang.String> javaClassNames,
                                                          boolean forWebService,
                                                          oracle.jbo.server.DBTransactionImpl2 txn)
                                        throws SDKException
Deprecated. 

Creates metadata for a decision point within a given dictionary file. If the file does not exist, it will be created. This method creates two decision functions, a technical wrapper decision function called name_W, and a decision function which is configurable. NOTE: This method is not UTF-8 compliant.

Parameters:
fileName - absolute path to file
decisionPointName - the name of the decision point to be created, which will be the name of the decision function created as well.
topViewDefName - the root View Definition of the JBO VO-Tree upon which the Decision Point's rules will be based.
javaClassNames - Java classes, either as ancillary input facts or as ActionTypes
forWebService - if true, the Decision Point will be configured for use via Decision Services as a Decision Component. If false, the D.F. will be set up for use from Java.
txn - a Transaction object to be used to retrieve locale-specific details from the View Object hierarchy. If this value is null, then only the base VO definition in the Default Locale will be used.
Throws:
SDKException

processWebInputs

public static DecisionPointInstance processWebInputs(RuleSession rs,
                                                     DecisionPointInputs dpinputs)
                                              throws RLException,
                                                     SDKException
Create a new DecisionPointInstance using the RuleSession and DecisionPointInputs instances passed as parameters.

Parameters:
dpinputs - the inputs to the decision point
Returns:
the DecisionPointInstance in which the execution was done
Throws:
RLException
SDKException

processWebInputs

public static DecisionPointInstance processWebInputs(RuleSession rs,
                                                     SimpleDecisionPointInput dpinput)
                                              throws RLException,
                                                     SDKException
Create a new DecisionPointInstance using the RuleSession and SimpleDecisionPointInput instances passed as parameters.

Parameters:
rs - rule session to use with the DecisionPointInstance
dpinput - the inputs to the decision point
Returns:
the DecisionPointInstance in which the execution was done
Throws:
RLException
SDKException

stringToFqn

public static DictionaryFQN stringToFqn(java.lang.String fqn)

addDataSource

public static void addDataSource(java.lang.String datasrc,
                                 java.lang.String url,
                                 java.lang.String user,
                                 java.lang.String pw)
                          throws java.sql.SQLException,
                                 javax.naming.NamingException
setup a jndi data source for unit test

Parameters:
datasrc - - name of data source, e.g. jdbc/MyDataSource
url - - the "connect string" to the database, e.g. jdbc:orcl:thin:@localhost:1521:xe
user - - DB user id
pw - - DB password
Throws:
java.sql.SQLException
javax.naming.NamingException

Oracle Fusion Middleware Java API Reference for Oracle Business Rules
11g Release 1 (11.1.1.7)

E10663-11

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.