I would avoid drools-templates, stick directly with MVEL templates.
Mark
On 15 Jan 2014, at 09:24, Michael Anstis <michael.anstis(a)gmail.com> wrote:
You could take a look at drools-templates, and relevant sections in
the user guide, as a starter.
If that does not cover your requirements take a look at drools-templates source code on
github.
Alternatively have a look for MVEL templates on Google (other search engines are
available).
With kind regards,
Mike
Sent on the move
On 15 Jan 2014 09:20, "neal" <swapnilaute(a)gmail.com> wrote:
I came to know through drool user forum that a drl file can be created using
recursive MVEL 2.0 template.
I am trying like below.
public static String prepareRule(String RuleName){
String template = "\n rule \""+RuleName+"\"
"+
"\n dialect \"mvel\" "+
"\n salience \"10\" " +
"\n when" +
"\n demo : Demo( one == \"N\" , two ==
\"C\" , three == 1005 )" +
"\n then" +
"\n demo.setFirst( 4003 );" +
"\n demo.setLast( 4003 );" +
"\n demo.setRuleID( \"SEQ_1\" );";
return template;
}
public static String getRuleAsString(String template){
Map vars = new HashMap();
return (String) TemplateRuntime.eval(template,vars);
}
public static void main(String[] args) {
System.out.println(getRuleAsString(prepareRule("Rule 1")));
}
When i am printing it out, It is generating rule skeleton. I am planning to
create whole rule stuff passing arguments like rule name in the example. Am
i doing correct?
How to do it correctly?
--
View this message in context:
http://drools.46999.n3.nabble.com/How-to-generate-rule-statements-using-M...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users