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

Anstis, Michael (M.) manstis1 at ford.com
Wed Oct 3 02:38:41 EDT 2007


If you're using Java dialect, you should be able to use eval (for which I
think MVEL provides syntax sugar???):-
 
rule "Test"
    when
        $e : Especialista()
        eval($retratoUser.lstCarac.get(0).codCarac != 0 )
    then 
        System.out.println ("test");
end

or return value expressions (if I'm correct):-
 
rule "Test"
    when
        $e : Especialista( ($retratoUser.lstCarac.get(0).codCarac != 0 ) )
    then 
        System.out.println ("test");
end

Somebody correct me if I'm completely wrong (I'm trying to refresh myself
following a stay of absence).


  _____  

From: rules-users-bounces at lists.jboss.org
[mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Edson Tirelli
Sent: 03 October 2007 01:40
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 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20071003/30b5a378/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4159 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20071003/30b5a378/attachment.bin 


More information about the rules-users mailing list