Java OpenRules ambigous class issue

27 views
Skip to first unread message

Andrew Shapton

unread,
May 19, 2015, 11:06:28 AM5/19/15
to open...@googlegroups.com

I have two rules (being called from Java, under a dropwizard framework exposing rest services).... A and B

they work individually, but I'd like to call B from A.

Now - when I include the call of rule B from A, i get a java error at runtime "class <some class used by B> not found ..... ok  - so i include in my main java program the imports for ALL classes used by A and B.

Same issue.

I then included both sets of classes used for A and B IN A.xls's environment tab and B.xls's environment tab, and now I have the "class XXX is ambiguous" message.

So it seems that I have no way out - I cant specify the classes in the main java program - they have to be specified in the environment tabs, but when I do that, I get an ambigous class errror.

Any help would be appreciated !

Andrew

OpenRules Support

unread,
May 19, 2015, 11:09:59 AM5/19/15
to open...@googlegroups.com, alsh...@gmail.com
Andrew,

It should be quite simple to do but it's not clear what you call a "rule". Please send us your xls- and java-files and we will help to address your issue.

Andrew Shapton

unread,
May 20, 2015, 8:52:30 AM5/20/15
to open...@googlegroups.com, alsh...@gmail.com
OK - I have progressed a little - now I need to understand the notation that I need to use to access the result of a decision in the next decision - any help would be appreciated...

Cheers

Andrew

OpenRules Support

unread,
May 20, 2015, 2:25:25 PM5/20/15
to open...@googlegroups.com, alsh...@gmail.com
Each decision deals with decision variables, some of which may be shared between decisions. You may have two sub-decisions that share the same variables: one as an output and another - as an input. If you use Java objects as placeholders for such decision variables it is only natural when the first decision specifies some variables as its output and the second decision uses them as its input. You also may explicitly call decision.setOutput(object) to define the output and then use decision.getOutput() to get it for another decision - see MainJava in the standard sample project DecisionHelloJava.

Support

Andrew Shapton

unread,
May 20, 2015, 3:08:42 PM5/20/15
to open...@googlegroups.com, alsh...@gmail.com
Thanks for the prompt response, but I meant that the output of one rule should be used as the input to the next- NOT using the Java program to pass data between decisions.

the scenario is this :

i)     if decision variable (X) has no value, then call another decision(2) with some other data to derive X
ii)    use X in this decision

Note that it seems that I cant have two glossaries, so i have to have one glossary shared between the decisions, which means that I cant have two decision variables (albeit in different business concepts) called the same thing.

Note also, that in the scenario above, decision 2 needs to exist and be called in other places, on its own.

OpenRules Support

unread,
May 20, 2015, 3:48:57 PM5/20/15
to open...@googlegroups.com, alsh...@gmail.com
It should be very simple to invoke another sub-decision or a decision table under a certain condition - look for example at the attached Decision.xls from the Decision1040EZ project. You also may call them from an action's cell using :=myDecision(decision). If you tried and have problems send us your xls-file and we will help.
Support
Decision.xls
Reply all
Reply to author
Forward
0 new messages