On 31 August 2011 03:39, Rodrigo Goncalves
<rodrigo.goncalves@coffeebeantech.com> wrote:
Hi,
How can I modify all objects resulted from a collect operation?
I would like to do something like this: (The following does not work)
Why does it not work?
-W
rule "test"
when
exists (MyClass());
$l : ArrayList() from collect (MyClass (attribute == false));
$r : AnotherClass();
then
$r.doSomething($l);
for(Object o : $l) {
MyClass o2 = (MyClass) o;
modify(o2) { setAttribute(true); } ;
}
end
I do not want to do:
rule "test"
when
$o : MyClass(attribute == false)
$r : AnotherClass()
then
$r.doSomething($o);
modify(o) {setAttribute(true);};
end
because I need to do a bulk operation… Doing it one by one is extremely inefficient in my case.
Thanks!
Rodrigo.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users