Search code examples
javadroolsdrools-guvnor

Drool Workbench : How to call User defined static Java Method from Drool Rule


Actually I know how to call static method from Drool by writing manually DRL. But Right now i am exploring Drool Workbench for increasing productivity.

I have static java method which will accepting two Parameter. I have already import that java class in rule.

I only need list of steps which help me to add Java method call in my rule from Drool Workbench.


Solution

  • There is an option "Call method on " in the Then part of the Drools workbench.

    Step 1: Add the DataObject (ex: SampleDataObject) in the When part so you will have There is a SampleDataObject

    Step 2: Now clicking on the '+' icon for the Then part, you will have an option Call method on SampleDataObject. Click on it and it will show you list of the methods in your data object. You can select that method and pass your parameters.