Hi All, I am using drool 4.0.1,I am facing some problem in using or operator
i am using 2 maps by inserting in to working memory: 1) ErrorMap<"String","String"> 2) validationmap<String,Object> my requirment is to generate error when rule fails for this i am taking following steps: 1) i insert one entry in error map in when part and if that rule is success 2)i remove that entry from map and 3) at the end on the basis of this map i generates validation errors. import java.util.Map; import com.IValidationField; rule "ValueAllowed_G10.3" when IValidationField(attributeId =="G10.3") $map : Map( keySet contains "ErrorMap" ) eval($map.put("G10.3_V","E_V_ALLOWED") == null || true) (or Map( this["G10.2"] not in("5")) Map( this["G10.2"] in("5"))) then map.remove("G10.3_V"); System.out.println("comming here----------------------------------------->"); end this file is giving classcast exception org.drools.RuntimeDroolsException: java.lang.ClassCastException: com.ValidationFieldImpl at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:75) at org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java:141) at org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple(SingleTupleSinkAdapter.java:20) at org.drools.reteoo.JoinNode.assertTuple(JoinNode.java:120) but when i replace "or" with "and" operator then it is working fine: import java.util.Map; import com.IValidationField; rule "ValueAllowed_G10.3" when IValidationField(attributeId =="G10.3") $map : Map( keySet contains "ErrorMap" ) eval($map.put("G10.3_V","E_V_ALLOWED") == null || true) (and Map( this["G10.2"] not in("5")) Map( this["G10.2"] in("5"))) then map.remove("G10.3_V"); System.out.println("comming here----------------------------------------->"); end -- View this message in context: http://www.nabble.com/Problem-in-using-or-operator-with-values-in-map.-tf4472442.html#a12752031 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