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