|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The job of the CombiningStrategy is to take the results of the rules which were
fired by the FiringStrategy
and to combine them to form a reasonable
result to the TriggerPoint
caller. The CombiningStrategy may be specified
using the TriggerPoint.setCombiningStrategy()
method.
To specify one of the predefined combining strategies, use the static constants
on this interface.
BRBeans provides several combining strategies to be used in applications.
Some of them, ThrowViolationCombiningStrategy
,
ReturnOrCombiningStrategy
, and ReturnAndCombiningStrategy
assume that the results which are passed are either ConstraintReturn
objects
or java.lang.Boolean objects. Exceptions are thrown if this is not the case.
Clients may implement their own combining strategies to combine results using a custom
algorithm. This may be done by creating a class that implements the CombiningStrategy
interface and providing an implementation for the combineResults
method.
Note that, since the combining strategy is stored as part of the TriggerPoint and the
TriggerPoint may be passed on a remote method call to the rule when it is fired, any
CombiningStrategy implementation must implement the Serializable interface.
Field Summary | |
static CombiningStrategy |
RETURN_ALL
Returns an array containing the results from all of the applicable rules. |
static CombiningStrategy |
RETURN_AND
Returns the logical AND of all the results. |
static CombiningStrategy |
RETURN_FIRST
Returns the first result; if no rules are found, returns null. |
static CombiningStrategy |
RETURN_LAST
Returns the last result; if no rules are found, returns null. |
static CombiningStrategy |
RETURN_OR
Returns the logical OR of all the results. |
static CombiningStrategy |
THROW_VIOLATION
Throws a RuleViolation containing all failed ConstraintReturns or returns true when no constraints fail. |
Method Summary | |
java.lang.Object |
combineResults(TriggerPoint tp,
java.lang.Object[] results)
Takes the results of firing the rules and combines them to form a single result. |
Field Detail |
public static final CombiningStrategy RETURN_ALL
public static final CombiningStrategy RETURN_FIRST
public static final CombiningStrategy RETURN_LAST
public static final CombiningStrategy RETURN_AND
public static final CombiningStrategy RETURN_OR
public static final CombiningStrategy THROW_VIOLATION
Method Detail |
public java.lang.Object combineResults(TriggerPoint tp, java.lang.Object[] results) throws BusinessRuleBeansException
Takes the results of firing the rules and combines them to form a single result. This single result may, however, still be an array of Objects.
tp
- the trigger point which is used to make this callresults
- the list of results of firing the rulesBusinessRuleBeansException
- if any exceptions occur
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |