[rules-users] Bulk modification

Wolfgang Laun wolfgang.laun at gmail.com
Wed Aug 31 03:27:22 EDT 2011


On 31 August 2011 03:39, Rodrigo Goncalves <
rodrigo.goncalves at 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 at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110831/b5f7286b/attachment.html 


More information about the rules-users mailing list