can you try with this:<br>[when] There is an Asset=asset:Asset()<br>[when] -name is
empty=eval(StringUtils.isBlank(name))<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font: inherit;" valign="top"><br>[when] -tag is
empty=eval(StringUtils.isBlank(tag))</td></tr></tbody></table><br><br><div class="gmail_quote">2010/8/26 Patricia Bogoevici <span dir="ltr"><<a href="mailto:patriciabogoevici@yahoo.com">patriciabogoevici@yahoo.com</a>></span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font: inherit;" valign="top">
Hi all,<br><br>I am using the latest Guvnor release (5.1), and I have the following DSL expression where I use "-" to have conditions on multiple lines:<br><br>[when] There is an Asset=asset:Asset()<br>[when]- name is empty=eval(StringUtils.isBlank(name))<br>
[when]- tag is empty=eval(StringUtils.isBlank(tag))<br><br>Having these DSL expressions, I wanted to create a rule, but I ran into some issues. <br>To summarize: There seems to be a parsing error, when conditions are added in DSL using "-". Did anybody else run into this problem? I wonder if I do something wrong, but, re-creating the DSL to have the 2 conditions into one expression, is all working fine. It may be a combination of "-" and eval? <br>
<br>Below, is the description of rules created, and error I got.<br><br>First, I created a rule using the above DSL expressions in the BRL editor. While the
rule looked ok in the editor, and it validated fine, only when I checked the source I noticed is wrong. So, the rule source looks like this:<br>rule "test_dsl"<br> dialect "mvel"<br> when<br>
asset:Asset( eval(StringUtils.isBlank(name, eval(StringUtils.isBlank(tag)) )) )<br> then<br> asset.setStatus("INVALID")<br> end<br><br>It looks that the conditions are parsed incorrectly, and the second eval condition is added as a parameter to the StringUtils.isBlank from the first eval. Also, all the right parenthesis are added at the end of the expression. If I add one condition at a time, it all works fine. The error is when I have more than 1 condition. <br>
<br>So, I created a new DSL, that contains both
conditions into one line, eliminating the hyphen between conditions:<br><br>[when] There is an asset with name empty AND tag empty =asset:Asset(eval(StringUtils.isBlank(name)),eval(StringUtils.isBlank(tag)))<br><br>Using BRL editor, I created a second rule using the DSL above. The rule validated ok, and the rule source looks fine:<br>
<br>rule "test_dsl_1"<br> dialect "mvel"<br> when<br> asset:Asset(eval(StringUtils.isBlank(name)),eval(StringUtils.isBlank(tag)))<br> then<br> asset.setStatus("INVALID")<br>
end<br><br>I created a test for this rule, that ran correctly.<br><br><br>Thanks,<br>Patricia<br></td></tr></tbody></table><br>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a 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> - CTO @ <a href="http://www.plugtree.com">http://www.plugtree.com</a> <br> - MyJourney @ <a href="http://salaboy.wordpress.com">http://salaboy.wordpress.com</a><br>
- Co-Founder @ <a href="http://www.jbug.com.ar">http://www.jbug.com.ar</a><br> <br> - Salatino "Salaboy" Mauricio -<br>