<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, &quot;neal&quot; &lt;<a href="mailto:swapnilaute@gmail.com">swapnilaute@gmail.com</a>&gt; 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 = &quot;\n rule \&quot;&quot;+RuleName+&quot;\&quot; &quot;+<br>
                                  &quot;\n dialect \&quot;mvel\&quot; &quot;+<br>
                                  &quot;\n salience \&quot;10\&quot; &quot; +<br>
                                  &quot;\n when&quot; +<br>
                                  &quot;\n demo : Demo( one == \&quot;N\&quot; , two == \&quot;C\&quot; , three == 1005 )&quot; +<br>
                                  &quot;\n then&quot; +<br>
                                  &quot;\n demo.setFirst( 4003 );&quot; +<br>
                                  &quot;\n demo.setLast( 4003 );&quot; +<br>
                                  &quot;\n demo.setRuleID( \&quot;SEQ_1\&quot; );&quot;;<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(&quot;Rule 1&quot;)));<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>