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 <[EMAIL PROTECTED]> 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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to