[rules-users] Example of contains operator...
Michael Neale
michael.neale at gmail.com
Mon Feb 12 23:55:36 EST 2007
contains works on the Collection interface. So if parnerList is a ArrayList
of String, then you could do:
parnerList contains "2900"
On 2/13/07, jdepaul <jjdepaul at us.ibm.com> wrote:
>
>
> 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.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070213/736ba129/attachment.html
More information about the rules-users
mailing list