[rules-users] Inserting Collection into WorkingMemory

VinuJay vinod.jayendra at wipro.com
Mon Jun 15 05:37:40 EDT 2009


Hi Antis,

Thanks for the reply.

My incoming fact object does have key-value for business data  -->
HashTable<String,Object> 
I had misunderstood the input and quoted out of context here. 

Now i am facing one more problem, My business data can be of String,
Integer, Boolean etc ... In my rule file if i try to use mathematical
operators on Integer business data ( represented as generic object) 

Exception in thread "main" org.drools.RuntimeDroolsException: Exception
executing predicate eval( businessData['LOANAMOUNT'] < 5000 )
Caused by: java.lang.ClassCastException: java.lang.Integer

How to provide the casting input in the rules file or specify the drools API
to do implicit casting.




Anstis, Michael (M.) wrote:
> 
> Correct me if I misunderstand:-
> 
> (1) You have a list of Strings accessible using a generic "businessData"
> property.
> 
> (2) Nestled within the list *you happen to know* one of the values
> represents a SSN and another the loan amount.
> 
> (3) You expect Drools to read your mind and workout how to determine the
> meaning of individual items in the list.
> 
> You can check whether the "businessData" contains a value using the
> "contains" operator. Whether the value is however a SSN or a loan amount
> is anyones guess as demonstrated below. If you don't have discrete
> accessors for individual businessData items then I believe a map is your
> best option.
> 
> Rule "read my mind"
> When
> 	$p : ProcessRequest(businessData contains "1234")
> Then
> 	System.println("ProcessRequest contains '1234' however I have no
> idea whether it is a SSN or loan amount");
> End
> 
> With kind regards,
> 
> Mike 
> 
> -----Original Message-----
> From: rules-users-bounces at lists.jboss.org
> [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of VinuJay
> Sent: 11 June 2009 07:39
> To: rules-users at lists.jboss.org
> Subject: Re: [rules-users] Inserting Collection into WorkingMemory
> 
> 
> Hi Andrew,
> 
> Thanks for the reply.
> 
> My problem is i don't have any input values for businessdata, i need to
> evaluate only on the key (name) of business data.  Like if SSN == 1234
> &&
> LoanAmount > 50000 assign to jcooper 
> 
> So List<String,String> businessData in my Fact object would not be
> useful. I
> need the values for the business data to be picked up from the rules
> file
> (.drl) itself.
> 
> -- 
> View this message in context:
> http://www.nabble.com/Inserting-Collection-into-WorkingMemory-tp23975474
> p23976147.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
> 
> _______________________________________________
> 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/Inserting-Collection-into-WorkingMemory-tp23975474p24031580.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list