[rules-users] External Jar/Pojo in Drools Workbench.

Leonard93 leonardlindenau at hotmail.com
Thu Apr 10 07:58:12 EDT 2014


Hello everyone, I have a small question/problem.

I have created a class (POJO) in Eclipse and I want to be able to write
rules over this class in the Drools Workbench, thus I exported the class and
the classes it depends on (1 other class) to a Jar and imported it in the
Drools workbench.

Now what I did next is I added the jar dependency to my workbench project,
created a new datamodel and set its super class to the external class from
the jar and left the rest empty.

When I then try to use this datamodel in a guided rule or anything I can
access the variables defined in the external class fine when using the rule
editor. But when I save I get various compiler errors.

Currently I tried to make a rule template and I got these errors (I am using
the standard example project to test it out):

Unable to create Field Extractor for *'Destination'Field/method
'destination'* not found for class '*org.mortgages.Test' *

Unable to Analyse Expression *Destination ==
GenericDataObject$Country.Germany*: [Error: unable to resolve method using
strict-mode: *org.mortgages.Test.GenericDataObject$Country()]* [Near : {...*
Destination == GenericDataObject$Country.Germ ....}]* ^ [Line: 9, Column: 2]


The class from the jar looks like this:
public class GenericDataObject {

    public enum Country
    {
        Egypt,
        Germany,
        Turkey,
        France,
        Unknown
    }
    
    public GenericDataObject()
    {
    	result = new Result();
    }

    public Result result;
    public Country Destination;

    public void setDiscount(int amount)
    {
    	result.discount = amount;
    }
}

public class Result
{
    public int discount;

    public Result()
    {
        discount = 0;
    }
}



--
View this message in context: http://drools.46999.n3.nabble.com/External-Jar-Pojo-in-Drools-Workbench-tp4029190.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list