<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
in theory for nested accessors it should switch to the MVEL dialect
automatically. You only need to specify the MVEL dialect explicitely
for eval, return value and consequences.<br>
<br>
Mark<br>
Manjax23 wrote:
<blockquote cite="mid:12179132.post@talk.nabble.com" type="cite">
<pre wrap="">
I think you should use dialect "mvel" when accessing the nested accessors.
and I had some trouble with "mvel" dialect in 4M2 release.
Please let me know if it works for you..
Thanks,
Manjax23
Richard Hoberman wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I'm using Drools 4 (M2), which is supposed to support nested accessors*
This works: when Claim( submissionInfo == null), but not this: when
Claim( submissionInfo.date == null)
Rule file, SubmissionInfo.java and exception are below.
What am I missing?
Richard
* See
<a class="moz-txt-link-freetext" href="http://article.gmane.org/gmane.comp.java.drools.user/8079/match=nested+properties">http://article.gmane.org/gmane.comp.java.drools.user/8079/match=nested+properties</a>,
which states "Support to nested accessors, property navigation and
simplified collection, arrays and maps syntax"
Rule File
---------------------------------------------------------------------------------------
package mvanamibia.claim;
import java.lang.Object;
import java.lang.String;
import java.lang.Double;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import com.sadalbari.mvanamibia.beans.Claim;
import com.sadalbari.mvanamibia.beans.Mandate;
import com.sadalbari.mvanamibia.beans.SubmissionInfo;
import com.sadalbari.mvanamibia.inspector.ClaimEvaluation;
global ClaimEvaluation evaluation;
rule "hasDateReceived"
when
Claim( submissionInfo.date == null )
then
evaluation.getFailures().add("missing: date received");
end
-----------------------------------------------------------------------------------
Exception
-----------------------------------------------------------------------------------
org.drools.rule.InvalidRulePackage: [19,23]: <a class="moz-txt-link-freetext" href="unknown:19:23">unknown:19:23</a> mismatched
token: [@137,471:471='.',<69>,19:23]; expecting type RIGHT_PAREN
at org.drools.rule.Package.checkValidity(Package.java:368)
at
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:250)
at
com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:33)
at
com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testMandateClaim(UnregisteredClaimValidationTest.java:56)
... Removed 22 stack frames
FAILED: testEmptyClaim
org.drools.rule.InvalidRulePackage: [19,23]: <a class="moz-txt-link-freetext" href="unknown:19:23">unknown:19:23</a> mismatched
token: [@137,471:471='.',<69>,19:23]; expecting type RIGHT_PAREN
at org.drools.rule.Package.checkValidity(Package.java:368)
at
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:250)
at
com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:33)
at
com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testEmptyClaim(UnregisteredClaimValidationTest.java:42)
... Removed 22 stack frames
------------------------------------------------------
SubmissionInfo (relevant bits)
public class SubmissionInfo implements Serializable {
private Date date;
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>