When a business rule triggers other business rules as part of its implementation,
then the rules that are triggered are called dependent rules of the
first rule. An example is the RuleAND
rule implementor supplied
with BRBeans. It uses two or more dependent rules, each of which is assumed
to return a true or false value. When a rule with RuleAND
as
its implementor is triggered, each of its dependent rules performs a logical
AND operation on all the returned results. The result of this AND operation
is returned as the result of the top-level rule.
Dependent rules are specified in the attributes of the top-level rule where
the fully-qualified name of each dependent rule is listed. When the top-level
rule is triggered, an array of dependent rule names is passed to the rule
implementor's init
method. They are stored here until they are
triggered by the fire
method. Note that the BRBeans framework
does not ensure that the dependent rules specified in the EJB are actually
triggered.
Dependent rules can be nested within other dependent rules. In other words,
a dependent rule of some particular rule can have its own dependent rules
which, in turn, can have their own dependent rules, and so on. The BRBeans
framework does not place any restriction on the number of levels that dependent
rules can be nested. The only practical restriction is the complexity of
the rule set that is built up when dependent rules are nested many levels
deep.