com.ibm.websphere.brb.implementor
Class RuleIfThenElse
java.lang.Object
|
+--com.ibm.websphere.brb.implementor.RuleIfThenElse
- All Implemented Interfaces:
- RuleImplementor
- public class RuleIfThenElse
- extends java.lang.Object
- implements RuleImplementor
Combination rule comprised of three rules. The first, a constraint-type rule, is fired to determine
which of the other two rules to fire. If the first rule returns a true ConstraintReturn or a
java.lang.Boolean with a value of true, then the second rule is fired. Otherwise the third rule
is fired. If the first rule returns an object other than a ConstraintReturn or a java.lang.Boolean,
then an exception is thrown.
When triggering the first dependent rule (the "if-condition" rule), if more than one rule with
the given name is found or if no rules are found, an exception will be thrown.
Constructor Summary |
RuleIfThenElse()
Parameterless constructor for RuleIfThenElse. |
Method Summary |
java.lang.Object |
fire(TriggerPoint tp,
java.lang.Object target,
IRuleCopy rule,
java.lang.Object[] parms)
Performs the algorithm of the IfThenElse rule by triggering two of the three dependent rules. |
java.lang.String |
getDescription()
The programmer's description of what the algorithm does. |
void |
init(java.lang.Object[] parms,
java.lang.String[] dependentRules,
java.lang.String userDefinedData,
IRuleCopy rule)
Initializes with persistent parameters used by this rule. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
dependentRules
protected java.lang.String[] dependentRules
RuleIfThenElse
public RuleIfThenElse()
- Parameterless constructor for RuleIfThenElse.
fire
public java.lang.Object fire(TriggerPoint tp,
java.lang.Object target,
IRuleCopy rule,
java.lang.Object[] parms)
throws BusinessRuleBeansException
- Performs the algorithm of the IfThenElse rule by triggering two of the three dependent rules.
The first rule, a constraint-type rule, is triggered to determine
which of the other two rules to triggered. If the first rule returns a true ConstraintReturn
or a java.lang.Boolean with a value of true, then the second rule is triggered. Otherwise the
third rule is triggered. If the first rule returns an object other than a ConstraintReturn or
a java.lang.Boolean, then an exception is thrown.
When triggering the first dependent rule (the "if-condition" rule), if more than one rule
with the given name is found or if no rules are found, an exception will be thrown.
- Specified by:
fire
in interface RuleImplementor
- Following copied from interface:
com.ibm.websphere.brb.RuleImplementor
- Parameters:
tp
- the trigger point which is firing this rule implementor.target
- the target object of the trigger pointrule
- the rule that the implementor is running on behalf offiringParams
- the firing parameters, i.e. those parameters that are passed
to the BRBeans framework at the trigger point- Returns:
- The result of firing the rule implementor. Implementors that carry out
classifications must return a single String. Implementors which check
constraints should generally return a ConstraintReturn, especially if
the results are to be combined and returned by the BRBeans framework.
- Throws:
com.ibm.brb.BusinessRuleBeansException
- Thrown when an error condition is associated
with the fired Rule implementation.
getDescription
public java.lang.String getDescription()
- The programmer's description of what the algorithm does.
- Specified by:
getDescription
in interface RuleImplementor
- Following copied from interface:
com.ibm.websphere.brb.RuleImplementor
- Returns:
- A description of this rule implementor.
init
public void init(java.lang.Object[] parms,
java.lang.String[] dependentRules,
java.lang.String userDefinedData,
IRuleCopy rule)
throws BusinessRuleBeansException
- Initializes with persistent parameters used by this rule. This rule has
three dependent rules whose IDs are provided and retained.
- Specified by:
init
in interface RuleImplementor
- Following copied from interface:
com.ibm.websphere.brb.RuleImplementor
- Parameters:
initParams
- the parameters needed to initialize this RuleImplementordependentRules
- the names of the dependent rules to this rule; if there are none,
null is passeduserDefinedData
- userDefinedData property from the Rulerule
- the Rule on whose behalf the rule implementor is running