[rules-users] Import static or function in rules-flow constraint?

capn_ed cncosper at capn-ed.net
Thu Nov 10 13:30:09 EST 2011


I am building a version 5.1 (.bpmn file extension) rules-flow diagram using
the Eclipse plugin.

I am writing rules based constraints (as opposed to code constraints), and I
would like to call a static Java method from some of my constraints.

If I was working in a .drl file, and I wanted to call a static method in my
LHS, I could use one of the following, in the import section of the file:
import static my.package.MyClass.SomeStaticFunction

or

import function my.package.MyClass.SomeStaticFunction

If I open a constraint, and open the "Imports editor", I can add imports for
classes. If I add the first import above to this dialog, and save the .bpmn
file, when I open the Imports editor again, I have the following:

import static

and no reference to the function. If I add the second import above in the
same place, when I save and reopen the dialog, the import function line is
completely gone. I can't see any reference to the function in the .bpmn file
opened in a text editor, either.

Is this the expected behavior?
If so, how can I call a static Java method from my constraint? Do I have to
reference the full package path of the method? Can I only do this from a
Java code constraint? The documentation is silent on the topic of importing
a function for rules constraint, although it says the format is the same as
the LHS of a rule in a .drl file.

I'm using Drools version 5.3.0.Final.

--
View this message in context: http://drools.46999.n3.nabble.com/Import-static-or-function-in-rules-flow-constraint-tp3497558p3497558.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list