|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The job of the FindingStrategy is to locate and return those rules which
meet the search criteria which is given. The FindingStrategy may be specified
using the TriggerPoint.setFindiningStrategy()
method.
To specify one of the predefined finding strategies, use the static constants
on this interface.
There are two FindingStrategy classes provided by BRBeans:
DefaultClassifierFindingStrategy
and DefaultNonClassifierFindingStrategy
.
Both of these strategies perform a case-sensitive search for Rules marked ready that match the
given search criteria, returning the results ordered by precedence, from highest to lowest
(the first rule in the array has the numerically smallest precedence, the next rule has the next
smallest precedence, etc.). If no rules are found, then an empty array is returned. The former
strategy only returns classifier rules (classifier=true) and the latter only returns non-classifier
rules (classifier=false).
Clients may implement their own finding strategies to find rules using a custom
algorithm. It is recommended that this be done by creating a class that extends one of the
finding strategies provided by BRBeans, DefaultClassifierFindingStrategy
or
DefaultNonClassifierFindingStrategy
, and overriding the appropriate methods.
Note that, since the finding 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
FindingStrategy implementation must implement the Serializable interface.
Field Summary | |
static FindingStrategy |
DEFAULT_CLASSIFIER
The default FindingStrategy which is used to find classifier rules. |
static FindingStrategy |
DEFAULT_NONCLASSIFIER
The default FindingStrategy which is used to find non-classifier rules. |
Method Summary | |
IRule[] |
findRules(TriggerPoint tp,
java.lang.Object ruleIdInfo,
java.lang.Object classificationInfo,
java.util.Date asOfDate)
Finds rules which are marked ready and match the criteria specified by the parameters. |
Field Detail |
public static final FindingStrategy DEFAULT_CLASSIFIER
public static final FindingStrategy DEFAULT_NONCLASSIFIER
Method Detail |
public IRule[] findRules(TriggerPoint tp, java.lang.Object ruleIdInfo, java.lang.Object classificationInfo, java.util.Date asOfDate) throws BusinessRuleBeansException
Finds rules which are marked ready and match the criteria specified by the parameters.
The ruleIdInfo parameter can be any object that can be used by the finding strategy to
identify rules to be found. It is passed directly from the trigger...()
method
on the TriggerPoint. Normally this will be a single String (a single fully-qualified
rule name) or an Object[] containing Strings (a list of fully-qualified rule names). However,
if a custom finding strategy is being used, this object can be whatever type is expected by
that strategy.
The classificationInfo parameter can be any object that can be used by the finding strategy to determine the classifications of the rules to be found, or null. Normally the classificitionInfo will be one of the following: a single String (found rules should have this classification), an Object[] which contains Strings (found rules should be classified by any of these classifications), or null (found rules should not have any classification). Again, if a custom finding strategy is being used, this object can be whatever type is expected by that strategy.
The asOfDate, if passed, indicates that the rules found should be in effect as of this date. If a null asOfDate is specified, rules found should be in effect as of the current date and time. The ruleIdInfo, the classificationInfo, and the asOfDate are passed on the TriggerPoint call.
tp
- the trigger point which is used to make this callruleIdInfo
- an object that can be used to identify the rules to be found; normally
a fully-qualified name or an array of fully-qualified namesclassificationInfo
- an object that can be used to determine the classification of the rules
to be found, or null for unclassified rulesasOfDate
- rules returned should be in effect as of this date; null means use
the current date and timeBusinessRuleBeansException
- if any exceptions occur
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |