[rules-users] Class Casting in a Collection data

2009-06-15 Thread VinuJay

Hi my fact object looks like this,

class ProcessRequest {
 
  Long requestId;

  String processType;

  String assigneeUsers;

  HashTableString,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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Class Casting in a Collection data

2009-06-15 Thread Edson Tirelli
   What versions of Drools and MVEL are you using?

   []s
   Edson

2009/6/15 VinuJay vinod.jayen...@wipro.com


 Hi my fact object looks like this,

 class ProcessRequest {

  Long requestId;

  String processType;

  String assigneeUsers;

  HashTableString,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@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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users