[Enterprise Extensions only]
  Next topic

Filtering strategy

The job of the FilteringStrategy is to take the list of rules which were found by the FindingStrategy and filter out those rules which should not be fired. There are three sets of filtering strategies used in TriggerPoint:

  1. strategy for zero rules found
  2. strategy for one rule found
  3. strategy for multiple rules found

A different strategy can be used for each of these scenarios, along with different strategies for classifier and non-classifier rules. The zero rules strategy is invoked if no rules are found by the finding strategy, the one rule strategy is invoked if exactly one rule is found, and the multiple rules strategy is invoked if more than one rule is found.

BRBeans provides several filtering strategies that can be used:

Instances of these filtering strategies are stored in static constants defined in the FilteringStrategy interface. You can use these for setting the strategies on a TriggerPoint.

As an example, here is one common way to use filtering strategies. Say you want to ensure that exactly one rule is found on a TriggerPoint call. You would set all three strategies (zero rules, one rule, and multiple rules) for this TriggerPoint to FilteringStrategy.ACCEPT_ONE. This strategy throws an exception if the number of rules is not exactly one. The following sequence of method calls would accomplish this for TriggerPoint tp:

tp.setNoRulesFilteringStrategy(FilteringStrategy.ACCEPT_ONE, TriggerPoint.ALL_RULES);
tp.setOneRuleFilteringStrategy(FilteringStrategy.ACCEPT_ONE, TriggerPoint.ALL_RULES);
tp.setMultipleRulesFilteringStrategy(FilteringStrategy.ACCEPT_ONE, TriggerPoint.ALL_RULES);

  Next topic