Skip navigation links

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

E10663-05


oracle.rules.sdk2.decisionpoint
Class DecisionPointInstance

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


public class DecisionPointInstance
extends java.lang.Object

DecisionPoint is a helper class which manages the server-side portions of implementing Decision Points (calling OBR Decision Functions) from developers' Java code.


Method Summary
 DecisionPointInstance addInput(java.lang.Object input)
          Adds a fact object to be asserted as the Decision Point is run.
 DecisionPointInstance addResult(java.lang.String name, java.lang.Object value)
          addResult spools a named output value for return to the caller of the Decision Function.
 DecisionPointInstance addResults(java.util.List<DecisionPoint.NamedValue> toadd)
          addResults is used to spool a list of output values, guaranteeing that the resultant values will be spooled together regardless of what other Action Type instances may also be spooling values.
 void assertViewObjectsForWS()
          Assert a set of ViewObjects from a SimpleDecisionPointInput
 void assertViewObjectsForWS(java.util.List<ViewObjectRef> lvor)
          Assert a set of ViewObjects from a list of ViewObjectRef
 void cleanup()
          If invoke is called with the parameter false, then this method must be called before the decision point instance reference goes out of scope, otherwise a memory leak will occur.
 void clearInputs()
          Clear the fact objects input list
 DecisionTrace decisionTrace()
           
 int getActivationID()
          Get the activation id for the ADF-BC objects used in this decision point instance.
 DecisionPoint getDecisionPoint()
          Return the template DecisionPoint which created this DecisionPointInstance
 RuleDictionary getDictionary()
          set dictionary to use for trace analysis
 java.util.List<java.lang.Object> getInputs()
          Get the list of facts to be input to the decision function.
 java.util.Map<java.lang.String,java.lang.Object> getProperties()
          Return the map of properties local to this DecisionPointInstance.
 java.lang.Object getProperty(java.lang.String name)
          Return a property value of the given name.
 java.util.List<DecisionPoint.NamedValue> getResults()
          Get the NamedValue results of executing this decision point
 oracle.jbo.server.DBTransactionImpl2 getTransaction()
          Returns the transaction object to be used by this decision point instance.
 oracle.jbo.ViewObject getViewObject()
          Return the view object to use for this DecisionPointInstance
 ViewObjectReference getViewObjectReference()
          Return the view object reference to use for this DecisionPointInstance
 java.util.List<java.lang.Object> invoke()
          Executes the decision function, marshalling its parameters to the rules engine and returning any values spooled back by the ActionType instances.
 java.util.List<java.lang.Object> invoke(boolean ret)
          Executes the desired Decision Function, marshalling its parameters to the OBR rules engine and returning any values spooled back by the ActionType instances.
 boolean isAutoCommit()
           
 RuleSession ruleSession()
          Returns the RuleSession instance that was or will be used by this DecisionPointInstance.
 DecisionPointInstance setActivationID(java.lang.Integer id)
          Set the activation id for the ADF-BC objects used in this decision point instance.
 void setAutoCommit(boolean m_autoCommit)
           
static void setCurrentDate(RuleSession rs, java.util.Calendar cal)
          Set the rule set current date to be used by this decision point
 void setDictionary(RuleDictionary dict)
          set dictionary to use for trace analysis
static void setEffectiveDate(RuleSession rs, java.util.Calendar cal)
          Set the rule set effective date to be used by this decision point
 DecisionPointInstance setInputs(java.util.List<java.lang.Object> input)
           
 DecisionPointInstance setProperty(java.lang.String name, java.lang.Object value)
          Set a property value only in this DecisionPointInstance.
 DecisionPointInstance setRuleSession(RuleSession session)
          Set the RuleSession to use explicitly.
 DecisionPointInstance setTransaction(java.sql.Connection connection)
          Bootstraps and sets a transaction object from given a database Connection.
 DecisionPointInstance setTransaction(oracle.jbo.server.DBTransactionImpl2 newtransaction)
          Sets the transaction object to be used by this decision point instance.
 DecisionPointInstance setTransaction(java.lang.String dataSrcName)
          Bootstraps and sets a transaction object given a J2EE data source name.
 DecisionPointInstance setViewObject(oracle.jbo.ViewObject viewObject)
          Adds a view object to be asserted as the Decision Point is run.
 DecisionPointInstance setViewObjectReference(ViewObjectReference viewObjectRef)
          Sets a view object reference to be used to load a view object, which can then load datbase rows.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Method Detail

addInput

public DecisionPointInstance addInput(java.lang.Object input)
Adds a fact object to be asserted as the Decision Point is run. The fact objects added MUST be added in the same order as declared in the decision function input table. If a ViewObject is added to the list, ALL database rows represented by the ViewObject will be loaded and asserted to the rule session simultaneously.
Parameters:
input -
Returns:
self

getInputs

public java.util.List<java.lang.Object> getInputs()
Get the list of facts to be input to the decision function.
Returns:
the list of facts

setInputs

public DecisionPointInstance setInputs(java.util.List<java.lang.Object> input)

clearInputs

public void clearInputs()
Clear the fact objects input list

setViewObject

public DecisionPointInstance setViewObject(oracle.jbo.ViewObject viewObject)
Adds a view object to be asserted as the Decision Point is run. This will call the decision function once for each row returned by the decision function, one only one row asserted at a given time.
Parameters:
viewObject - the ViewObject to use to load rows
Returns:
self

getViewObject

public oracle.jbo.ViewObject getViewObject()
Return the view object to use for this DecisionPointInstance
Returns:
the view object

setViewObjectReference

public DecisionPointInstance setViewObjectReference(ViewObjectReference viewObjectRef)
Sets a view object reference to be used to load a view object, which can then load datbase rows. Setting this has the same semantics as setViewObject.
Parameters:
viewObjectRef - the ViewObjectReference to use to load a ViewObject
Returns:
self

getViewObjectReference

public ViewObjectReference getViewObjectReference()
Return the view object reference to use for this DecisionPointInstance
Returns:
the view object reference

getTransaction

public oracle.jbo.server.DBTransactionImpl2 getTransaction()
Returns the transaction object to be used by this decision point instance. If not previously set, attempts to create a transaction and sets autoCommit to true.
Returns:
the transaction

setTransaction

public DecisionPointInstance setTransaction(oracle.jbo.server.DBTransactionImpl2 newtransaction)
Sets the transaction object to be used by this decision point instance.
Parameters:
newtransaction - the transaction to use
Returns:
self

setTransaction

public DecisionPointInstance setTransaction(java.sql.Connection connection)
                                     throws SDKException
Bootstraps and sets a transaction object from given a database Connection. This option is less efficient than setting the transaction via an ApplicationModule's in-built transaction object.
Parameters:
connection - the Connection instance to use
Returns:
self
Throws:
SDKException - if a NamingException occurs when trying to create a Transaction object from this Connection

setTransaction

public DecisionPointInstance setTransaction(java.lang.String dataSrcName)
                                     throws SDKException
Bootstraps and sets a transaction object given a J2EE data source name. The data source name must be registered to the J2EE container or else an exception will occur.
Parameters:
dataSrcName - name of the data source
Returns:
self
Throws:
SDKException - if the data srouce cannot be found or an exception coccurs when trying to create new transaction from the decision point

getDecisionPoint

public DecisionPoint getDecisionPoint()
Return the template DecisionPoint which created this DecisionPointInstance
Returns:
the decision point

getProperties

public java.util.Map<java.lang.String,java.lang.Object> getProperties()
Return the map of properties local to this DecisionPointInstance. This will not include the properties which are set in the parent DecisionPoint
Returns:
the map of properties

getProperty

public java.lang.Object getProperty(java.lang.String name)
Return a property value of the given name. If a property of the given name exists in this DecisionPointInstance, the value is returned. Otherwise, the value set for the property in the parent DecisionPoint is returned. If the property is not set in either, null is returned.
Parameters:
name - the name of the property to retrive
Returns:
the property value

setProperty

public DecisionPointInstance setProperty(java.lang.String name,
                                         java.lang.Object value)
Set a property value only in this DecisionPointInstance.
Parameters:
name - the name of a property to set
value - the value of the property to set
Returns:
self

setRuleSession

public DecisionPointInstance setRuleSession(RuleSession session)
                                     throws SDKException,
                                            RLException
Set the RuleSession to use explicitly. This is most commonly used only when calling the DecisionPoint from a web service that manages its own pool of RuleSessions.
Parameters:
session - the rule session to use
Throws:
SDKException - if there is an error generating the RL for the rule session
RLException - if the rulesession throws an RLException

ruleSession

public RuleSession ruleSession()
                        throws SDKException
Returns the RuleSession instance that was or will be used by this DecisionPointInstance. If the RuleSession was not explicitly set or if one can not be obtained from the pool, null is returned.
Returns:
the rule session in use for this instance
Throws:
SDKException

setDictionary

public void setDictionary(RuleDictionary dict)
set dictionary to use for trace analysis

getDictionary

public RuleDictionary getDictionary()
set dictionary to use for trace analysis

cleanup

public void cleanup()
             throws SDKException
If invoke is called with the parameter false, then this method must be called before the decision point instance reference goes out of scope, otherwise a memory leak will occur. Preferrably, the call to this should be placed in a finally block.
Throws:
SDKException

getActivationID

public int getActivationID()
Get the activation id for the ADF-BC objects used in this decision point instance.
Returns:
the id

setActivationID

public DecisionPointInstance setActivationID(java.lang.Integer id)
Set the activation id for the ADF-BC objects used in this decision point instance.
Parameters:
id - the activation id
Returns:
self

decisionTrace

public DecisionTrace decisionTrace()
                            throws SDKException
Throws:
SDKException

invoke

public java.util.List<java.lang.Object> invoke()
                                        throws RLException,
                                               SDKException
Executes the decision function, marshalling its parameters to the rules engine and returning any values spooled back by the ActionType instances. This is the perferred invoke method. This method has the same effect of calling invoke(true), meaning that it returns the RuleSession to the pool after finishing with it.
Returns:
a list of NamedValue objects, which may be empty but will never be null
Throws:
RLException - if the rule session throws an RLException
SDKException - if there is an error accessing the dictionary or with specified parameters

invoke

public java.util.List<java.lang.Object> invoke(boolean ret)
                                        throws RLException,
                                               SDKException
Executes the desired Decision Function, marshalling its parameters to the OBR rules engine and returning any values spooled back by the ActionType instances. This method should only be used in advanced usage cases. The majority of uses should use the no-arg method of the same name.
Parameters:
ret - if true, the rule session is returned to the pool after execution. If false, the rule session used by execution is not returned to the rule session pool. If method cleanup() is not subsequently called, this can lead to a memory leak.
Returns:
a list of NamedValue objects, which may be empty but will never be null
Throws:
RLException - if the rule session throws an RLException
SDKException - if there is an error accessing the dictionary or with specified parameters

addResult

public DecisionPointInstance addResult(java.lang.String name,
                                       java.lang.Object value)
addResult spools a named output value for return to the caller of the Decision Function. Output is not a map, so the name need not be distinct.
Parameters:
name - The name of the output
value - The value of the output
Returns:
self

addResults

public DecisionPointInstance addResults(java.util.List<DecisionPoint.NamedValue> toadd)
addResults is used to spool a list of output values, guaranteeing that the resultant values will be spooled together regardless of what other Action Type instances may also be spooling values.
Parameters:
toadd - A list of NamedValue objects to add to this instance
Returns:
self

getResults

public java.util.List<DecisionPoint.NamedValue> getResults()
Get the NamedValue results of executing this decision point
Returns:
a list with NamedValue objects

assertViewObjectsForWS

public void assertViewObjectsForWS(java.util.List<ViewObjectRef> lvor)
                            throws RLException,
                                   SDKException
Assert a set of ViewObjects from a list of ViewObjectRef
Parameters:
lvor - list containing the view object refs
Throws:
RLException - if the rule session throws an RLException
SDKException - if there is an error accessing the dictionary or with specified parameters

assertViewObjectsForWS

public void assertViewObjectsForWS()
                            throws RLException,
                                   SDKException
Assert a set of ViewObjects from a SimpleDecisionPointInput
Throws:
RLException - if the rule session throws an RLException
SDKException - if there is an error accessing the dictionary or with specified parameters

setEffectiveDate

public static void setEffectiveDate(RuleSession rs,
                                    java.util.Calendar cal)
                             throws RLException
Set the rule set effective date to be used by this decision point
Parameters:
rs - the rulesession in which to set the effective date
cal - the date representation to set
Throws:
RLException

setCurrentDate

public static void setCurrentDate(RuleSession rs,
                                  java.util.Calendar cal)
                           throws RLException
Set the rule set current date to be used by this decision point
Parameters:
rs - the rulesession in which to set the current date
cal - the date representation to set
Throws:
RLException

setAutoCommit

public void setAutoCommit(boolean m_autoCommit)

isAutoCommit

public boolean isAutoCommit()

Skip navigation links

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

E10663-05


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