[rules-users] Using java.util.List in rules

Edson Tirelli tirelli at post.com
Mon Oct 29 12:47:25 EDT 2007


    Anderson,

    What is the error? Can you provide a self contained example?
    Using the "from CE" as showed before works.

    BTW, are you Brazilian? Your name sounds like a Brazilian name.

     []s
     Edson

2007/10/27, Anderson Pazza Mello <payakahn at gmail.com>:
>
> How can I test all elements of the list?
> Can I need to use something like "for (int i.....)"?
>
> I'm trying to do that but it is not working...
>
> "Caracteristica( codCarac != 0 ) from $caracList"
>
>
>
> My test:
>
>         e : Especialista (perguntado == false)
>         Especialista( $moldeList : retratoUser.lstMolde )
>         Molde( tipoMolde == TipoMolde.CABELO) from $moldeList
>
>
> When  the property  "tipoMolde == TipoMolde.CABELO" the rule must to be
> fired. The List $moldeList has 5 elements.
>
> any idea?
>
>
> 2007/10/3, Edson Tirelli < tirelli at post.com>:
> >
> >   Use the "from" CE:
> >
> > rule "This rule will fire once for each Caracteristica whose codCarac is
> > != 0"
> > when
> >     Especialista( $caracList : retratoUser.lstCarac )
> >     Caracteristica( codCarac != 0 ) from $caracList
> > then
> >     ...
> > end
> >
> >    []s
> >    Edson
> >
> > 2007/10/3, Bhattacharya, Sougata < sougata.bhattacharya at capgemini.com>:
> > >
> > >  If I want to test for all ith element,
> > >
> > > Like this
> > >
> > >
> > >
> > > rule "Test"
> > >
> > >     when
> > >         e : Especialista(retratoUser.lstCarac.get(i).codCarac != 0)
> > >     then
> > >         System.out.println ("test");
> > >
> > > end
> > >
> > >
> > >
> > > what should I do
> > >
> > >
> > >
> > >   ------------------------------
> > >
> > > *From:* rules-users-bounces at lists.jboss.org [mailto:
> > > rules-users-bounces at lists.jboss.org] *On Behalf Of *Edson Tirelli
> > > *Sent:* Wednesday, October 03, 2007 6:10 AM
> > > *To:* Rules Users List
> > > *Subject:* Re: [rules-users] Using java.util.List in rules
> > >
> > >
> > >
> > >
> > >    You can't explicitly call methods in the field name. Use MVEL
> > > special notation for lists:
> > >
> > > e : Especialista(retratoUser.lstCarac[0].codCarac != 0)
> > >
> > >     []s
> > >     Edson
> > >
> > >
> > > 2007/10/2, Anderson Pazza Mello < payakahn at gmail.com>:
> > >
> > > Hi everyone,
> > >
> > > I'm trying to use a java.util.List like this:
> > >
> > > rule "Test"
> > >
> > >     when
> > >         e : Especialista(retratoUser.lstCarac.get(0).codCarac != 0)
> > >     then
> > >         System.out.println ("test");
> > >
> > > end
> > >
> > > The property lstCarac is a java.util.List<Caracteristica>. I'm getting
> > > this error :
> > >
> > > org.drools.rule.InvalidRulePackage: [18,44]: unknown:18:44 Unexpected
> > > token '0'[18,46]: unknown:18:46 Unexpected token '.'
> > >     at org.drools.rule.Package.checkValidity(Package.java:419)
> > >
> > > Someone knows what i have to do to fix the problem??
> > >
> > >
> > > --
> > > Anderson Pazza Mello
> > > Tecnologia em Informática - UFPR
> > > _______________________________________________
> > > rules-users mailing list
> > > rules-users at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/rules-users
> > >
> > >
> > >
> > >
> > > --
> > >   Edson Tirelli
> > >   Software Engineer - JBoss Rules Core Developer
> > >   Office: +55 11 3529-6000
> > >   Mobile: +55 11 9287-5646
> > >   JBoss, a division of Red Hat @ www.jboss.com
> > >  This message contains information that may be privileged or
> > > confidential and is the property of the Capgemini Group. It is intended only
> > > for the person to whom it is addressed. If you are not the intended
> > > recipient, you are not authorized to read, print, retain, copy, disseminate,
> > > distribute, or use this message or any part thereof. If you receive this
> > > message in error, please notify the sender immediately and delete all copies
> > > of this message.
> > >
> > >
> > > _______________________________________________
> > > rules-users mailing list
> > > rules-users at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/rules-users
> > >
> > >
> >
> >
> > --
> >   Edson Tirelli
> >   Software Engineer - JBoss Rules Core Developer
> >   Office: +55 11 3529-6000
> >   Mobile: +55 11 9287-5646
> >   JBoss, a division of Red Hat @ www.jboss.com
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
>
> --
> Anderson Pazza Mello
> Tecnologia em Informática - UFPR
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20071029/945632f0/attachment.html 


More information about the rules-users mailing list