As of my current understanding of Drools, an instance of a bean class is
acted upon when it is asserted onto a DRL file (using: assertObject).
However, the limitation in such a scenario is that the bean class cannot
accept a dynamic data-set. If say, my input parameters are varying in number
then I can't possibly capture the data in a properly defined bean class. On
the other hand, I can capture the data in a data structure like HashMap.
But my problem arises when I try to use the value for a HashMap key in the
DRL file, since in the "when" part I can only use "getter" methods
accept no parameters. I did try to circumvent this problem by setting
a key value
in a particular getter method before asserting the bean object and then
retrieving the value through a getValue method which would return the value
from the HashMap for the key value associated with the current instance of
the asserted bean class. But this too leads to another problem; at any given
instant I can only associate a single key value with a bean instance, thus,
if I need a rule to have multiple conditions (AND/OR) based on different
key-values stored in the HashMap, I can't access them simultaneously.
I was wondering, is there a way by which I can access a method, of the
asserted Bean class, from the "when" part of a rule, in the DRL file, which
can accept a parameter input? If no, is there any part of the source code
where I can make some changes to allow this behaviour (pointers to the class
Any and all assistance would be hugely appreciated.
Show replies by date