[rules-users] Example of contains operator...

jdepaul jjdepaul at us.ibm.com
Mon Feb 12 18:06:56 EST 2007


Still having trouble with the contains operator...  I have the following rule
in place:


rule "Shipper List Match"
	when
		$shipperGO : GateOut ( customerId == "Walmart", partnerList contains
("2900") ) 

	then
		myService.sendNotification($shipperGO, Constants.SHIPPER_MATCH);	
end
--------------------------------------------------------------------------------------------------
and the folllowing code that builds the partnerList collection object:

        GateOut walmartGO = new GateOut();
        walmartGO.setCustomerId("Walmart");
        walmartGO.setContainerId("2939392");
        walmartGO.setMatched(false);
        walmartGO.setSourceLocation("SHGH");
        walmartGO.setDestLocation("SFCO");
        
        Partner shipper = new Partner();
        shipper.setPartnerId("2900");
        shipper.setPartnerName("Yellow Freight");
        shipper.setPurpose(Partner.FORWARDER);
        
        HashMap hm = new HashMap();
        hm.put(shipper.getPartnerId(), shipper);
        
        walmartGO.setPartnerList(hm);

-----------------------------------------------------------------------

At runtime, I get the ClassCastException:

at
com.maersk.nam.gems.gatein.walmart.GateOutWalmartExample.main(GateOutWalmartExample.java:62)
Caused by: java.lang.ClassCastException: java.util.HashMap

Can someone help with the proper expression?

James

-- 
View this message in context: http://www.nabble.com/Example-of-contains-operator...-tf3202978.html#a8935042
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list