This seems a bug. May I ask you please to open a JIRA for it and attach
a self contained test showing the problem?
At the same time, I think there is a conceptual error in your rules: no
object should be changed in the LHS of the rules. This will surely cause you
problems in the future, so, I strongly advise you to rethink your rules.
[]s
Edson
2007/9/18, Gaurav2007 <gaurav.a.joshi(a)capgemini.com>:
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.-tf...
Sent from the drools - user mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @
www.jboss.com