Debugging the right-hand side of a rule
As we already know, the right-hand side of a rule in Drools may contain a combination of the following elements:
Java sentences: Any regular Java sentence that is allowed in a Java method can also be used on the right-hand side of a rule in Drools.
MVEL expressions: If the dialect of the rule is set to
mvel
, MVEL expressions are enabled on the right-hand side of the rule in Drools.Predefined variables and methods: Variables such as
drools
andkcontext
and methods such asinsert
,update
, anddelete
are also allowed. The specialmodify(){}
structure could also be used on the right-hand side of the rule in Drools.
In the previous section, we introduced the notion of how, when compiled, the left-hand side of all the rules in a KIE Base is converted into a network of nodes. For the right-hand side of the rules, the situation is different. When a KIE Base is compiled, the right-hand side of each of the rules that it contains is converted into a Java class....