[rules-users] Class Casting in a Collection data

Edson Tirelli tirelli at post.com
Tue Jun 16 08:19:07 EDT 2009


   My suggestion is that you try Drools 5.0.1 with MVEL 2.0.10. If you need
to stay on Drools 4, then try replacing the mvel jar by MVEL 1.3.9.

   []s
   Edson

2009/6/15 VinuJay <vinod.jayendra at wipro.com>

>
> Hi Edson,
>
> Thanks for the reply.
>
> I am using Drools 4.0.7 and mvel 1.3.1-java1.4.jar
>
>
> Edson Tirelli-3 wrote:
> >
> >    What versions of Drools and MVEL are you using?
> >
> >    []s
> >    Edson
> >
> > 2009/6/15 VinuJay <vinod.jayendra at wipro.com>
> >
> >>
> >> Hi my fact object looks like this,
> >>
> >> class ProcessRequest {
> >>
> >>  Long requestId;
> >>
> >>  String processType;
> >>
> >>  String assigneeUsers;
> >>
> >>  HashTable<String,Object> businessData;
> >>
> >>  //Getters and Setters
> >>
> >> }
> >>
> >> My businessdata can be of type Integer, String, Boolean, hence i have
> >> used
> >> generic Object for the business data value.
> >>
> >> But if i use any mathematical operator in the rules (.drl) file like,
> >> rule "Assign"
> >> when
> >> p: ProcessRequest(processType == "LoanFlowPlus" &&
> >> businessData['LOANAMOUNT'] < 5000)
> >> then
> >>        p.setAssigneeUsers("jcooper");
> >> end
> >>
> >>
> >> i get an error
> >> Exception in thread "main" org.drools.RuntimeDroolsException: Exception
> >> executing predicate eval( businessData['LOANAMOUNT'] < 5000 )
> >> Caused by: java.lang.ClassCastException: java.lang.Integer
> >>
> >>
> >> Shouldn't the drools API handle this class cast conversion internally
> ..?
> >> or
> >> how to specify the class casting in rules file
> >>
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Class-Casting-in-a-Collection-data-tp24031803p24031803.html
> >> Sent from the drools - user mailing list archive at Nabble.com.
> >>
> >> _______________________________________________
> >> rules-users mailing list
> >> rules-users at lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >
> >
> >
> > --
> >  Edson Tirelli
> >  JBoss Drools Core Development
> >  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
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Class-Casting-in-a-Collection-data-tp24031803p24046788.html
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 Edson Tirelli
 JBoss Drools Core Development
 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/20090616/075ea67a/attachment.html 


More information about the rules-users mailing list