The additional .AddBookingPayment in the function name is the<br>class name the DRL compiler has to invent for the class the (static)<br>method addBookingPayment is generated into.<br><br>the trace indicates that somehow the literals 35 and 100 are taken as Integer objects,<br>
and that the signature matching has a flaw. Try <br>(a) declaring parameters days and percentage as Integer<br>(b) keep the function as is, but remove dialect "mvel" from the rule.<br><br>Please report the outcome of both experiments and the Drools version you're<br>
using; it might be that a JIRA should be made.<br><br>-W<br> <br><br><div class="gmail_quote">On Mon, Jan 4, 2010 at 7:46 AM, xalperte <span dir="ltr"><<a href="mailto:javier.alperte@rudder-tech.com">javier.alperte@rudder-tech.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
I'm having a problem a little odd trying to fire rules using the Guvnor.<br>
<br>
In Guvnor I have a package named package kobo.regularSafaris, inside this<br>
package I have defined rules (with some DSL definitions), a decision table<br>
(xls) and two functions.<br>
<br>
The problem is that when I'm trying to call the functions in the consequence<br>
of a rule I'm having the following error:<br>
<br>
org.drools.runtime.rule.ConsequenceException: [Error: unable to resolve<br>
method:<br>
kobo.regularSafaris.AddBookingPayment.addBookingPayment(kobo.regularSafaris.BookingRequest,<br>
java.lang.Integer, java.lang.Integer) [arglength=3]]<br>
[Near : {... Unknown ....}]<br>
^<br>
[Line: 1, Column: 0]<br>
at<br>
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:23)<br>
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:943)<br>
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885)<br>
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1086)<br>
at<br>
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:660)<br>
at<br>
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:632)<br>
at<br>
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:187)<br>
at<br>
com.rudder.packages.test.rules.PricesRulesTestCase.testNobelLowSeasonPrices(PricesRulesTestCase.java:108)<br>
<br>
The function definition is as follows:<br>
<br>
function void addBookingPayment(BookingRequest request, int days, int<br>
percentage) {<br>
PaymentPolicy payment = new PaymentPolicy();<br>
payment.setPercentage(percentage);<br>
<br>
if( days > 0 ) {<br>
DateMidnight dueDate = new<br>
DateMidnight(request.getDepartureDate().getTime()).minusDays(days);<br>
payment.setType("DEFERRED");<br>
payment.setDueDate(dueDate.toDate());<br>
} else {<br>
payment.setType("NOW");<br>
payment.setDueDate(null);<br>
}<br>
<br>
List payments = request.getBookingData().getPayments();<br>
if(payments == null) {<br>
payments = new ArrayList();<br>
request.getBookingData().setPayments(payments);<br>
}<br>
<br>
payments.add(payment);<br>
}<br>
<br>
And the rule that is calling the function is the following:<br>
<br>
rule "Def. Deferred Payment for Credit Operator"<br>
dialect "mvel"<br>
when<br>
$request: BookingRequest()<br>
user: User(type == "Professional") from $request.user<br>
eval($request.getBookingData().getPayments() == null) || ArrayList(size ==<br>
0) from $request.bookingData.payments<br>
eval( "true".equals($request.getUser().getTags().get("hasCredit")))<br>
eval( (new<br>
DateMidnight($request.getDepartureDate().getTime())).minusDays(35).toDate().after(new<br>
Date()))<br>
then<br>
addBookingPayment($request, 35, 100);<br>
end<br>
<br>
It seems that the system is adding an extra "AddBookingPayment" to the<br>
package name and this is causing the problem. Why is doing that? how can i<br>
solve this?<br>
<br>
Thanks in advance<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://n3.nabble.com/Error-unable-to-resolve-method-tp108194p108194.html" target="_blank">http://n3.nabble.com/Error-unable-to-resolve-method-tp108194p108194.html</a><br>
Sent from the Drools - User 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>
</font></blockquote></div><br>