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.<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>