[rules-users] Exclude certain rules

Jamie jshaw at llbean.com
Fri Nov 18 11:39:20 EST 2011


We did something similar - we implemented a table-based mechanism for turning
rules on and off.  The business users have a UI that allows them to toggle
the rules via a simple boolean value.  These values are cached and refreshed
on a regular basis.  Rather than inserting that cache as a fact, I chose to
take advantage of the 'enabled' property, e.g.:

// *****************************************************************
// Rule 001 - Operator Flagged
// When the operator has flagged the order as suspect, add suspect reason
code "O" to 
// the order.
// *****************************************************************
rule "Rule 001 - Operator Flagged"

	enabled (FraudRuleEvaluationHelper.isRuleEnabled("Rule 001 - Operator
Flagged"))

To me, it's cleaner in that it separates the enablement of a rule from the
actual business logic of the rule.  The only drawback to this approach is
that we have to keep the rule name and the string we pass to the enabled
check in sync.  In hindsight, it would have been better to just use rule
numbers instead of the whole name.

I'm not sure it's entirely appropriate for your use case since you have some
business logic involved in the decision, but it may give you some ideas.

--
View this message in context: http://drools.46999.n3.nabble.com/Exclude-certain-rules-tp3517185p3519038.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list