[rules-users] Class Casting in a Collection data

VinuJay vinod.jayendra at wipro.com
Mon Jun 15 22:55:01 EDT 2009


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.




More information about the rules-users mailing list