Hi all,
I am writing rules using Drools Templates and I
noticed strange problems (ocurring when I
slightly modify a DRT that works well):
- the template instanciation depends on the
declarations order of the parameters in the
template header
- if the rule template does not contain a
package declaration (default package) the
instanciation of the template fails
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.
Do you think it is worth posting a JIRA?
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.
Best regards,
Bruno.
PS:
DRT that works well:
template header
name
message
package templates;
import org.drools.bug.Entity;
template "TestTemplate"
rule "Test1 @{row.rowNumber}"
dialect "mvel"
when
Entity( $name : name == "@{name}" )
then
System.out.println("@{message}" +
$name);
insert($name);
end
end template
DRT that does not work (first case):
template header
message
name
package templates;
import org.drools.bug.Entity;
template "TestTemplate"
rule "Test1 @{row.rowNumber}"
dialect "mvel"
when
Entity( $name : name == "@{name}" )
then
System.out.println("@{message}" +
$name);
insert($name);
end
end template
DRT that does not work (second case):
template header
name
message
import org.drools.bug.Entity;
template "TestTemplate"
rule "Test1 @{row.rowNumber}"
dialect "mvel"
when
Entity( $name : name == "@{name}" )
then
System.out.println("@{message}" +
$name);
insert($name);
end
end template