I have been using Drools for a project and I have run into one snag
that I thought would be possible. I have a list of objects that I need
to collect a single property value from each object. I would think
accumulate would work, but I keep getting an
IncompatibleClassChangeError. Here is an example of the rule
condition:
$b : BaseObject()
ContainingObject($myList : subList) from $b.containingObject
$titleList : ArrayList() from accumulate( m : MyObject() from $myList,
init(
ArrayList tempList = new ArrayList(); ),
action(
tempList.add(m.getTitle()); ),
result( tempList ) )
The basic idea is that the Base Object contains another object
(ContainingObject) that contains a list. This list needs to be
iterated over to get the title from each object in the list. I will
then use the $titleList in the action part of the rule.
Can somebody point me in the right direction?
Thanks.
Rob Diana
Show replies by date