|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An IRuleCopy is a copy of a Rule that does not persist changes to
the persistent Rule until the method updatePersistentRule
is
called. The IRuleCopy gives you local access to the data in the Rule.
Not having to make remote method calls to access the data results
in increased performance in many situations. Similarly, when updating
a Rule, all changes can be forwarded to the remote Rule in one method
call. Again, this is a performance consideration.
The method updatePersistentRule
contains options for
handling the case where the persistent Rule has changed between the
time this copy was retrieved and the time that updatePersistentRule
was called. See the constants RULE_CHANGED...
in this class.
Field Summary | |
---|---|
static int |
RULE_CHANGED_FORCE
Rule change option - Force the changes in the copy to be saved. |
static int |
RULE_CHANGED_RETURN_BOOLEAN
Rule change option - Return true if the persistent Rule has not changed prior to updatePersistentRule being called and the update completed successfully. |
static int |
RULE_CHANGED_THROW_EXCEPTION
Rule change option - Throw a RuleChangedException if the
persistent Rule has changed prior to the updatePersistentRule method being called. |
Fields inherited from interface com.ibm.websphere.brb.mgmt.IRule |
---|
DATE_STATUS_EXPIRED, DATE_STATUS_IN_EFFECT, DATE_STATUS_INVALID, DATE_STATUS_NO_START_DATE, DATE_STATUS_PENDING, FIRE_ANYWHERE, FIRE_LOCAL, FIRE_REMOTE, TYPE_COPY, TYPE_REFERENCE |
Method Summary | |
---|---|
void |
addInitParameter(ConstantParameter initParameter)
Adds the given init parameter to the end of the list of init parameters. |
java.util.Vector |
checkRuleData()
Check for errors in the data for this rule. |
IRule |
copy(int ruleReturnType)
Creates a new rule initialized with the contents of this rule. |
void |
delete()
Deletes this rule. |
java.lang.Object |
fire(TriggerPoint tp,
java.lang.Object target,
java.lang.Object[] firingParams)
Fires this rule. |
java.lang.String |
getBusinessIntent()
Returns the business intent of this rule. |
java.lang.String |
getClassification()
Returns the classification of this rule. |
int |
getDateStatus()
Determine the rule's status. |
java.lang.String[] |
getDependentRules()
Returns the names of the dependent rules of this rule. |
java.lang.String |
getDescription()
Returns the description of this rule. |
java.util.Date |
getEndDate()
Returns the date when this rule expires. |
int |
getFiringLocation()
Returns the firing location for this rule. |
IParameter[] |
getFiringParameters()
Returns the firing parameters for this rule. |
java.lang.String |
getId()
Returns the primary key of this rule. |
ConstantParameter[] |
getInitParameters()
Returns the init parameters for this rule. |
java.lang.String |
getJavaRuleImplementorName()
Returns the full class name of the Java rule implementor of this rule. |
java.lang.String |
getOriginalRequirement()
Returns the initial business analyst requirement of this rule. |
IRule |
getPersistentRule()
Get a reference to the actual persistent rule. |
int |
getPrecedence()
Returns the relative priority of this rule. |
IRule |
getRuleAtFiringLocation()
FOR IBM INTERNAL USE ONLY. |
IRuleCopy |
getRuleCopy()
Creates a copy of this rule and returns it. |
IRuleFolder |
getRuleFolder()
Returns the folder in which this rule is stored. |
java.lang.String |
getRuleName()
Returns the name of this rule. |
java.util.Date |
getStartDate()
Returns the date this rule comes into effect. |
java.lang.String |
getUserDefinedData()
Returns any user-defined data for this rule. |
boolean |
isClassifier()
Returns a value indicating if this rule is a classifier rule. |
boolean |
isMarkedForDeletion()
Determine whether or not this rule is marked for deletion. |
boolean |
isReady()
Returns a value indicating whether this rule is ready for use. |
void |
move(IRuleFolder newRuleFolder)
Moves this rule to the given rule folder. |
void |
removeInitParameter(int index)
Removes the init parameter that is at the given index. |
void |
setBusinessIntent(java.lang.String newBusinessIntent)
Sets the business intent of this rule. |
void |
setClassification(java.lang.String newClassification)
Sets the classification of this rule. |
void |
setClassifier(boolean isClassifier)
Sets a value indicating if this rule is a classifier rule. |
void |
setDependentRules(java.lang.String[] newDependentRules)
Sets the names of the dependent rules of this rule. |
void |
setDescription(java.lang.String newDescription)
Sets the description of this rule. |
void |
setEndDate(java.util.Date newEndDate)
Sets the date when this rule expires. |
void |
setFiringLocation(int newFiringLocation)
Sets the firing location for this rule. |
void |
setFiringParameters(IParameter[] parameters)
Sets the firing parameters for this rule. |
void |
setInitParameters(ConstantParameter[] newInitParameters)
Sets the init parameters for this rule. |
void |
setJavaRuleImplementorName(java.lang.String newRuleImplementor)
Sets the full class name of the Java rule implementor of this rule. |
void |
setOriginalRequirement(java.lang.String newOriginalReq)
Sets the initial business analyst requirement of this rule. |
void |
setPrecedence(int newPrecedence)
Sets the relative priority of this rule. |
void |
setReady(boolean ready)
Sets a value indicating whether this rule is ready for use. |
void |
setRuleName(java.lang.String newRuleName)
Sets the name of this rule. |
void |
setStartDate(java.util.Date newStartDate)
Sets the date this rule comes into effect. |
void |
setUserDefinedData(java.lang.String newUserDefinedData)
Sets the user-defined data for this rule. |
java.lang.String |
toXML()
Returns the XML representation of this rule. |
void |
updatePersistentRule()
Update the persistent Rule with the values in this copy. |
boolean |
updatePersistentRule(IRuleCopy originalRule,
int changeOption)
Update the persistent Rule with the values in this copy with options as to how to handle the case where changes have been made to the persistent Rule. Parameter changeOption indicates how to handle the case where
changes have been made to the persistent Rule. |
Field Detail |
public static final int RULE_CHANGED_FORCE
public static final int RULE_CHANGED_THROW_EXCEPTION
RuleChangedException
if the
persistent Rule has changed prior to the updatePersistentRule method being called.
public static final int RULE_CHANGED_RETURN_BOOLEAN
Method Detail |
public void addInitParameter(ConstantParameter initParameter) throws BusinessRuleBeansException
IRule
addInitParameter
in interface IRule
initParameter
- an init parameter to add to this rule
BusinessRuleBeansException
public java.util.Vector checkRuleData()
IRule
checkRuleData
in interface IRule
public IRule copy(int ruleReturnType) throws BusinessRuleBeansException, java.rmi.RemoteException
IRule
IRuleCopy
is returned. In this case,
the persistent rule is not created on the server until method
updatePersistentRule
is called on the
IRuleCopy
.
When returning a reference, the persistent rule is created on the server immediately.
copy
in interface IRule
ruleReturnType
- indicates whether to return a local copy (IRule.TYPE_COPY) or a reference (IRule.TYPE_REFERENCE)
BusinessRuleBeansException
java.rmi.RemoteException
public void delete() throws BusinessRuleBeansException
IRule
updatePersistentRule
must be called before the
rule will be deleted from persistent storage.
delete
in interface IRule
BusinessRuleBeansException
public java.lang.Object fire(TriggerPoint tp, java.lang.Object target, java.lang.Object[] firingParams) throws BusinessRuleBeansException, java.rmi.RemoteException
IRule
FiringStrategy
.
fire
in interface IRule
tp
- the trigger point with which this rule is calledtarget
- the target object passed by the applicationfiringParams
- the parameters passed by the application
BusinessRuleBeansException
- if a problem occurs
java.rmi.RemoteException
public java.lang.String getBusinessIntent()
IRule
getBusinessIntent
in interface IRule
public java.lang.String getClassification()
IRule
getClassification
in interface IRule
public int getDateStatus()
IRule
getDateStatus
in interface IRule
public java.lang.String[] getDependentRules()
IRule
rule implementor
as the dependentRules
parameter on the init
method. Generally a rule implementor that handles dependent rules (for example
RuleAND
and
RuleIfThenElse
) will fire
each of the named rules.
getDependentRules
in interface IRule
public java.lang.String getDescription()
IRule
getDescription
in interface IRule
public java.util.Date getEndDate()
IRule
getEndDate
in interface IRule
public int getFiringLocation()
IRule
getFiringLocation
in interface IRule
public IParameter[] getFiringParameters()
IRule
getFiringParameters
in interface IRule
public java.lang.String getId()
IRule
getId
in interface IRule
public ConstantParameter[] getInitParameters()
IRule
getInitParameters
in interface IRule
public java.lang.String getJavaRuleImplementorName()
IRule
getJavaRuleImplementorName
in interface IRule
public java.lang.String getOriginalRequirement()
IRule
getOriginalRequirement
in interface IRule
public IRule getPersistentRule()
public int getPrecedence()
IRule
getPrecedence
in interface IRule
public IRule getRuleAtFiringLocation() throws BusinessRuleBeansException
IRule
getRuleAtFiringLocation
in interface IRule
BusinessRuleBeansException
IRule.getFiringLocation()
public IRuleCopy getRuleCopy() throws BusinessRuleBeansException
IRule
getRuleCopy
in interface IRule
BusinessRuleBeansException
- if an exception occurs creating the rulepublic IRuleFolder getRuleFolder()
IRule
getRuleFolder
in interface IRule
public java.lang.String getRuleName()
IRule
getRuleName
in interface IRule
public java.util.Date getStartDate()
IRule
getStartDate
in interface IRule
public java.lang.String getUserDefinedData()
IRule
getUserDefinedData
in interface IRule
public boolean isClassifier()
IRule
triggerClassifier
and the first phase of
triggerSituational
. Classifier rules are not found by
trigger
and the second phase of triggerSituational
.
isClassifier
in interface IRule
public boolean isMarkedForDeletion()
public boolean isReady()
IRule
isReady
in interface IRule
public void move(IRuleFolder newRuleFolder) throws BusinessRuleBeansException
IRule
move
in interface IRule
newRuleFolder
- the new rule folder which will hold this rule
BusinessRuleBeansException
public void removeInitParameter(int index) throws BusinessRuleBeansException
IRule
removeInitParameter
in interface IRule
index
- the index of the init parameter to remove
BusinessRuleBeansException
public void setBusinessIntent(java.lang.String newBusinessIntent)
IRule
setBusinessIntent
in interface IRule
newBusinessIntent
- the new business intentpublic void setClassification(java.lang.String newClassification) throws BusinessRuleBeansException
IRule
setClassification
in interface IRule
newClassification
- the new classification of this rule
BusinessRuleBeansException
public void setClassifier(boolean isClassifier)
IRule
triggerClassifier
and the first phase of
triggerSituational
. Classifier rules are not found by
trigger
and the second phase of triggerSituational
.
setClassifier
in interface IRule
isClassifier
- true if this is a classifier rule, false otherwisepublic void setDependentRules(java.lang.String[] newDependentRules) throws BusinessRuleBeansException
IRule
rule implementor
as the dependentRules
parameter on the init
method. Generally a rule implementor that handles dependent rules (for example
RuleAND
and
RuleIfThenElse
) will fire
each of the named rules.
setDependentRules
in interface IRule
newDependentRules
- an array of full rule names of the dependent rules
BusinessRuleBeansException
public void setDescription(java.lang.String newDescription)
IRule
setDescription
in interface IRule
newDescription
- the new descriptionpublic void setEndDate(java.util.Date newEndDate)
IRule
setEndDate
in interface IRule
newEndDate
- the new end date, or null if the rule should not expirepublic void setFiringLocation(int newFiringLocation) throws BusinessRuleBeansException
IRule
setFiringLocation
in interface IRule
newFiringLocation
- the location at which this rule's implementor is fired
BusinessRuleBeansException
public void setFiringParameters(IParameter[] parameters) throws BusinessRuleBeansException
IRule
setFiringParameters
in interface IRule
parameters
- the firing parameters, or null if the firing parameters are passed directly
from the trigger point.
BusinessRuleBeansException
public void setInitParameters(ConstantParameter[] newInitParameters) throws BusinessRuleBeansException
IRule
setInitParameters
in interface IRule
newInitParameters
- the new init parameters
BusinessRuleBeansException
IRule.addInitParameter(ConstantParameter)
public void setJavaRuleImplementorName(java.lang.String newRuleImplementor) throws BusinessRuleBeansException
IRule
setJavaRuleImplementorName
in interface IRule
newRuleImplementor
- the full class name of the Java rule implementor of this rule
BusinessRuleBeansException
public void setOriginalRequirement(java.lang.String newOriginalReq)
IRule
setOriginalRequirement
in interface IRule
newOriginalReq
- the new original requirement of this rulepublic void setPrecedence(int newPrecedence)
IRule
setPrecedence
in interface IRule
newPrecedence
- the relative priority of this rulepublic void setReady(boolean ready)
IRule
setReady
in interface IRule
ready
- boolean indicating whether this rule is ready for usepublic void setRuleName(java.lang.String newRuleName) throws BusinessRuleBeansException
IRule
setRuleName
in interface IRule
newRuleName
- the name of this rule
BusinessRuleBeansException
- if the newRuleName
is invalid. A valid rule name cannot be null, cannot contain a '/' character, and cannot be
empty or all blanks.public void setStartDate(java.util.Date newStartDate)
IRule
setStartDate
in interface IRule
newStartDate
- the new start date of this rulepublic void setUserDefinedData(java.lang.String newUserDefinedData)
IRule
setUserDefinedData
in interface IRule
newUserDefinedData
- the user-defined datapublic java.lang.String toXML() throws BusinessRuleBeansException, java.rmi.RemoteException
IRule
toXML
in interface IRule
BusinessRuleBeansException
java.rmi.RemoteException
public void updatePersistentRule() throws BusinessRuleBeansException, java.rmi.RemoteException
BusinessRuleBeansException
- If the Rule could not be updated.
java.rmi.RemoteException
public boolean updatePersistentRule(IRuleCopy originalRule, int changeOption) throws BusinessRuleBeansException, java.rmi.RemoteException
changeOption
indicates how to handle the case where
changes have been made to the persistent Rule. The three choices are:
IRuleFolder lifeFolder = root.getSubFolder("com/acme/insurance/life"); IRuleCopy originalRuleCopy = (IRuleCopy) lifeFolder.findRulesByName("isSeniorCitizen", true, IRule.TYPE_COPY); IRuleCopy changedRule = originalRuleCopy.getRuleCopy(); // Change senior citizen status from 62 to 65 ConstantParameter[] initParms = { new ConstantParameter(Integer(65)) }; changedRule.setInitParameters(initParms); // Tell the local copy of the rule to update itself, expect to get back an // exception if the rule has changed. try { changedRule.updatePersistentRule(originalRuleCopy, IRuleCopy.RULE_CHANGED_THROW_EXCEPTION); } catch (RuleChangedException) { throw new RuntimeException("Could not update the SeniorCitizen Rule"); }
originalRule
- A copy of the original rule data before changes were made. The method
compares the persistent rule against this copy to determine if any changes have been made
since the rule was originally retrieved. This parameter is ignored if RULE_CHANGED_FORCE is
specified for the change option.changeOption
- indicates how to handle the case where changes have been made to the persistent Rule
changeOption
is IRuleCopy.RULE_CHANGED_RETURN_BOOLEAN, then false is
returned in the case where the persistent rule has changed. Otherwise true is returned.
com.ibm.websphere.brb.RuleChangedException
- If the Rule has changed and the option RULE_CHANGED_THROW_EXCEPTION was specified
BusinessRuleBeansException
- If the Rule could not be updated.
java.rmi.RemoteException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |