[rules-users] How to call a method from a cell in Drools 5 decision table?

jos at circuitdb.com jos at circuitdb.com
Tue Jan 19 02:57:22 EST 2010


I'm migrating an application from drools 4 to drools 5. I encountered some
problems where our decision table uses calls to methods with String
parameters in actions cells.

I've reproduces the issue in the example decision table project generated
by the eclipse plugin. After generating a new Drools project with decision
table example I added the following to the Message class:

public String getMessage(String dummy) {
 return this.message;
}

In the decision table I change cell E9 from
'm.setMessage("$param");update(m);' to 'm.setMessage($param);update(m);'
and cell E11 from 'Goodbye cruel world' to 'm.getMessage("msg")'.

When I use this java and xls file with Drools 4 I get the folloowing at
line 11 of the drl:
m.setMessage(m.getMessage("msg"));update(m);

But when I use Drools 5 I get escaped double-quotes which causes an error
in com.sample.DecisionTableTest.readKnowledgeBase:
m.setMessage(m.getMessage(\"msg\"));update(m);

I have attached the java code, xls sheet and both generated drl files.

Thanks in advance.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drools4.drl
Type: application/octet-stream
Size: 478 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20100119/9748a472/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drools5.drl
Type: application/octet-stream
Size: 480 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20100119/9748a472/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DecisionTableTest.java
Type: application/octet-stream
Size: 2943 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20100119/9748a472/attachment-0002.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Sample.xls
Type: application/vnd.ms-excel
Size: 33792 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20100119/9748a472/attachment.xls 


More information about the rules-users mailing list