<br> Paul,<br> <br> My advice for you is rename your rules file from .drl to .dslr. This way, the IDE plugin will correctly open it with the DSLR editor and you have a "tab" in the lower part of the editor where you can see the DRL preview. Looking at the preview, it will be easy for you to see the problems.
<br> Also, seems you are using a lot of top-level eval(), and that is bad. In 4.0 we have increased the expressiveness of the language and you can avoid most of them now. I suggest you update your mappings for such syntax.
<br><br> []s<br> Edson<br><br><div><span class="gmail_quote">2007/9/4, Paul Smith <<a href="mailto:paul.t.smith@gmail.com">paul.t.smith@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Forgive me if this one comes through a second time but I seem to be having a few difficulties getting my mails to go through.<div><span class="e" id="q_114d008914a5941e_1"><br><span class="gmail_quote"><br></span>Hi Guys,
<br><br>I've decided to bite the bullet and try and move up to
4.01 but I'm having trouble getting the rules to compile. I have the following drl<br><br>/*******************<br>Code type rules<br>********************/
<br>package au.com.codeprotechnology.online.ejb3.logic.common<br><br>import au.com.codeprotechnology.online.bi.exception.ValidationError<br>import au.com.codeprotechnology.online.ejb3.logic.constants.CodeTypeConstants<br>
import au.com.codeprotechnology.online.persistence.ejb.core.CodeType<br><br>expander common.dsl<br><br>rule "Code type is mandatory"<br><br> when<br> The code types type is null or empty<br> then<br>
Send the message that the code types type is mandatory<br>end<br><br>rule "Long name is mandatory"<br><br> when<br> The code types long name is null or empty<br> then<br> Send the message that the code types long name is mandatory
<br><br>end<br><br>rule "Short name is mandatory"<br><br> when<br> The code types short name is null or empty<br> then<br> Send the message that the code types short name is mandatory<br><br>
end<br><br>rule "Short name too long"<br><br> when<br> The short name for the code type is too long<br> then<br> Send the message that the code types short name is too long<br> <br>end
<br><br>rule "Sort order is mandatory"<br><br> when<br> The code types sort order is null or zero<br> then<br> Send the message that the code types sort order is mandatory<br><br>end<br><br>
<br>
With the corresponding dsl<br><br>#Common domain specific language.<br>[when]The code types type=$obj : CodeType(val : codeType)<br>[when]The code types long name=$obj : CodeType(val : longName)<br>[when]The code types short name=$obj : CodeType(val : shortName)
<br>[when]The short name for the code type is too long=$obj : CodeType(val : shortName -> (val != null && val.trim().length() > CodeTypeConstants.MAX_SHORT_NAME_LENGTH))<br>[when]The code types sort order=$obj : CodeType(val : sortOrder)
<br>[when]The documentation text=$obj : Documentation(val : documentationText)<br>[when]The documentation type is null=$obj : Documentation(val : type -> (val == null))<br>[when]is null or empty=eval(val == null || val.trim
().length() == 0);<br>[when]is null or zero=eval(val == null || val.longValue() == 0);<br>[when]is not null=eval($obj != null);<br>[when]is not numeric=eval(!isNumeric(val));<br>[when]is not a valid expiry date=eval(!isValidExpiry(val));
<br>[when]length is greater than {len}=eval(val.length() > {len});<br>[when]length is less than {len}=eval(val.length() < {len});<br>[then]Print the message '{msg}'=System.out.println("{msg}");<br>
[then]Send the message that the code types type is mandatory=$obj.addValidationError(new ValidationError(CodeTypeConstants.MSG_KEY_CODE_TYPE_MANDATORY,CodeTypeConstants.MSG_CODE_TYPE_MANDATORY));<br>[then]Send the message that the code types long name is mandatory=$obj.addValidationError(new ValidationError(
CodeTypeConstants.MSG_KEY_LONG_NAME_MANDATORY,CodeTypeConstants.MSG_LONG_NAME_MANDATORY));<br>[then]Send the message that the code types short name is mandatory=$obj.addValidationError(new ValidationError(CodeTypeConstants.MSG_KEY_SHORT_NAME_MANDATORY
,CodeTypeConstants.MSG_SHORT_NAME_MANDATORY));<br>[then]Send the message that the code types short name is too long=$obj.addValidationError(new ValidationError(CodeTypeConstants.MSG_KEY_SHORT_NAME_TOO_LONG,CodeTypeConstants.MSG_SHORT_NAME_TOO_LONG
));<br>[then]Send the message that the code types sort order is mandatory=$obj.addValidationError(new ValidationError(CodeTypeConstants.MSG_KEY_SORT_ORDER_MANDATORY,CodeTypeConstants.MSG_SORT_ORDER_MANDATORY));<br>[then]Send the message that the documentation text is mandatory=$obj.addValidationError(new ValidationError(
DocumentationConstants.MSG_KEY_TEXT_MANDATORY,DocumentationConstants.MSG_TEXT_MANDATORY));<br>[then]Send the message that the documentation type is mandatory=$obj.addValidationError(new ValidationError(DocumentationConstants.MSG_KEY_TYPE_MANDATORY
,DocumentationConstants.MSG_TYPE_MANDATORY));<br><br>But I keep getting the following errors when trying to build the package<br><br>unknown:14:36 Unexpected token 'val'<br>unknown:14:60 Unexpected token ')'
<br>unknown:14:61 Unexpected token '.'<br>unknown:14:71 mismatched token: [@106,457:458='==',<75>,14:71]; expecting type THEN<br>unknown:23:36 Unexpected token 'val'<br>unknown:23:60 Unexpected token ')'
<br>unknown:23:61 Unexpected token '.'<br>unknown:23:71 mismatched token: [@171,723:724='==',<75>,23:71]; expecting type THEN<br>unknown:33:37 Unexpected token 'val'<br>unknown:33:61 Unexpected token ')'
<br>unknown:33:62 Unexpected token '.'<br>unknown:33:72 mismatched token: [@236,995:996='==',<75>,33:72]; expecting type THEN<br>unknown:53:37 Unexpected token 'val'<br>unknown:53:66 Unexpected token ')'
<br>unknown:53:68 Unexpected token '=='<br><br>These are the errors from PackageBuilder. Used to work fine with 3 and I can't see any drastic differences between this and your examples in the documentation.<br>
<br><br><br>
</span></div><br>_______________________________________________<br>rules-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org
</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br></blockquote></div>
<br><br clear="all"><br>-- <br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">
www.jboss.com</a>