<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#ffffff">
Hi all,<br>
<br>
I am writing rules using Drools Templates and I noticed strange
problems (ocurring when I slightly modify a DRT that works well): <br>
<ol>
<li>the template instanciation depends on the declarations order
of the parameters in the template header</li>
<li>if the rule template does not contain a package declaration
(default package) the instanciation of the template fails</li>
</ol>
I am working with Drools 5.1.1 but those problems occur in
5.2.0.Final and in 5.3.0.Final as well.<br>
Do you think it is worth posting a JIRA?<br>
<br>
Anyway let me tell you that Drools Templates are great! Our users
like that feature a lot! They start writing a rule in DRL format
and, once it works, they transform it into a DRT and put data into a
tsv file. It is quite a natural way of working. The general
perception here is that it is easier to "templatize" an existing DRL
than to write a decision table from scratch.<br>
<br>
Best regards,<br>
<br>
Bruno.<br>
<br>
PS:<br>
<br>
<u>DRT that works well</u>:<br>
<br>
<tt>template header<br>
<b>name<br>
message<br>
<br>
package templates;<br>
</b><br>
import org.drools.bug.Entity;<br>
<br>
template "TestTemplate"<br>
rule "Test1 @{row.rowNumber}"<br>
dialect "mvel"<br>
when<br>
Entity( $name : name == "@{name}" )<br>
then<br>
System.out.println("@{message}" + $name);<br>
insert($name);<br>
end<br>
end template<br>
</tt><br>
<u>DRT that does not work</u> (first case):<br>
<br>
<tt>template header<br>
<b>message<br>
name<br>
<br>
package templates;<br>
</b><br>
import org.drools.bug.Entity;<br>
<br>
template "TestTemplate"<br>
rule "Test1 @{row.rowNumber}"<br>
dialect "mvel"<br>
when<br>
Entity( $name : name == "@{name}" )<br>
then<br>
System.out.println("@{message}" + $name);<br>
insert($name);<br>
end<br>
end template</tt><br>
<br>
<br>
<u>DRT that does not work</u> (second case):<br>
<br>
<tt>template header<br>
<b>name<br>
message<br>
</b><br>
import org.drools.bug.Entity;<br>
<br>
template "TestTemplate"<br>
rule "Test1 @{row.rowNumber}"<br>
dialect "mvel"<br>
when<br>
Entity( $name : name == "@{name}" )<br>
then<br>
System.out.println("@{message}" + $name);<br>
insert($name);<br>
end<br>
end template</tt><br>
<br>
<br>
</body>
</html>