Okay Wolfgang ... you asked for it. Here's a version which takes it pretty much to the minimum.
The error I see is "Unable to resolve method using strict-mode: mypackage.CloneMessage.cloneMessage(mypackage.Message)"
However, the error is only seen when I use mvel dialect. The working Java dialect rule is also included below.
Note that when I re-wrote the example function to take a common type such as String as argument, then the mvel version worked. It's when the argument is a declared type that it fails.
Thanks for taking a look,
Steve
file - MessageFact.drl
package mypackage
declare Message
Text: String
end
file - CloneMessage.drl
package mypackage
function Message cloneMessage(Message originalMessage) {
Message newMessage = new Message();
newMessage.setText(originalMessage.getText());
return newMessage;
}
file - SayHelloRuleJava.drl
package mypackage
rule "Say hello"
dialect "java"
lock-on-active true
when
# Always
then
Message originalMessage = new Message();
originalMessage.setText("Hello, World!");
Message clonedMessage = cloneMessage(originalMessage);
insert(clonedMessage);
end
file - SayHelloRuleMvel.drl
package mypackage
rule "Say hello"
dialect "mvel"
lock-on-active true
when
# Always
then
Message originalMessage = new Message();
originalMessage.Text = "Hello, World!";
Message clonedMessage = cloneMessage(originalMessage);
insert(clonedMessage);
end