<p dir="ltr">You could take a look at drools-templates, and relevant sections in the user guide, as a starter.</p>
<p dir="ltr">If that does not cover your requirements take a look at drools-templates source code on github.</p>
<p dir="ltr">Alternatively have a look for MVEL templates on Google (other search engines are available).</p>
<p dir="ltr">With kind regards, </p>
<p dir="ltr">Mike</p>
<p dir="ltr">Sent on the move</p>
<div class="gmail_quote">On 15 Jan 2014 09:20, "neal" <<a href="mailto:swapnilaute@gmail.com">swapnilaute@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I came to know through drool user forum that a drl file can be created using<br>
recursive MVEL 2.0 template.<br>
I am trying like below.<br>
<br>
public static String prepareRule(String RuleName){<br>
String template = "\n rule \""+RuleName+"\" "+<br>
"\n dialect \"mvel\" "+<br>
"\n salience \"10\" " +<br>
"\n when" +<br>
"\n demo : Demo( one == \"N\" , two == \"C\" , three == 1005 )" +<br>
"\n then" +<br>
"\n demo.setFirst( 4003 );" +<br>
"\n demo.setLast( 4003 );" +<br>
"\n demo.setRuleID( \"SEQ_1\" );";<br>
return template;<br>
}<br>
<br>
public static String getRuleAsString(String template){<br>
Map vars = new HashMap();<br>
return (String) TemplateRuntime.eval(template,vars);<br>
}<br>
<br>
public static void main(String[] args) {<br>
<br>
System.out.println(getRuleAsString(prepareRule("Rule 1")));<br>
}<br>
<br>
When i am printing it out, It is generating rule skeleton. I am planning to<br>
create whole rule stuff passing arguments like rule name in the example. Am<br>
i doing correct?<br>
How to do it correctly?<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/How-to-generate-rule-statements-using-MVEL-2-0-template-tp4027692.html" target="_blank">http://drools.46999.n3.nabble.com/How-to-generate-rule-statements-using-MVEL-2-0-template-tp4027692.html</a><br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<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>
</blockquote></div>