<div dir="ltr">OK, I imported your JAR and created a rule as shown below.<div><br></div><div>The Guided Rule Editor had the option to select the enums for Country.</div><div><br></div><div>Theonly issue I had was with "Destination" itself - as it should be a lower case "d". Drools Compiler did report an error that is was ..."Unable to create Field Extractor for 'Destination'Field/method 'destination' not found for class 'com.sample.GenericDataObject'". I suspect if you change the field name to "destination" it would work OK.</div>
<div><br></div><div>This was with the latest code @master in github.</div><div><br></div><div><div><table style="max-width:100%;border-collapse:collapse;border-spacing:0px;color:rgb(68,68,68);font-family:tahoma,arial,helvetica,sans-serif;font-size:14px;line-height:21px">
<tbody><tr><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace;color:grey">1.</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small">
<span style="font-family:Courier,monospace;color:green">|</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace"><span style="color:red">package</span> org.anstis.p1;</span></td>
</tr><tr><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace;color:grey">2.</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small">
<span style="font-family:Courier,monospace;color:green">|</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace"></span></td>
</tr><tr><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace;color:grey">3.</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small">
<span style="font-family:Courier,monospace;color:green">|</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace"><span style="color:red">import</span> java.lang.Number;</span></td>
</tr><tr><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace;color:grey">4.</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small">
<span style="font-family:Courier,monospace;color:green">|</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace"><span style="color:red">import</span> com.sample.GenericDataObject;</span></td>
</tr><tr><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace;color:grey">5.</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small">
<span style="font-family:Courier,monospace;color:green">|</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace"><span style="color:red">import</span> com.sample.GenericDataObject.Airline;</span></td>
</tr><tr><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace;color:grey">6.</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small">
<span style="font-family:Courier,monospace;color:green">|</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace"><span style="color:red">import</span> com.sample.GenericDataObject.Country;</span></td>
</tr><tr><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace;color:grey">7.</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small">
<span style="font-family:Courier,monospace;color:green">|</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace"><span style="color:red">import</span> com.sample.Result;</span></td>
</tr><tr><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace;color:grey">8.</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small">
<span style="font-family:Courier,monospace;color:green">|</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace"></span></td>
</tr><tr><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace;color:grey">9.</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small">
<span style="font-family:Courier,monospace;color:green">|</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace"><span style="color:red">rule</span> <span style="color:green">"r1"</span></span></td>
</tr><tr><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace;color:grey">10.</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small">
<span style="font-family:Courier,monospace;color:green">|</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace"> <span style="color:red">dialect</span> <span style="color:green">"mvel"</span></span></td>
</tr><tr><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace;color:grey">11.</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small">
<span style="font-family:Courier,monospace;color:green">|</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace"> <span style="color:red">when</span></span></td>
</tr><tr><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace;color:grey">12.</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small">
<span style="font-family:Courier,monospace;color:green">|</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace"> GenericDataObject( Destination == Country.Egypt )</span></td>
</tr><tr><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace;color:grey">13.</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small">
<span style="font-family:Courier,monospace;color:green">|</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace"> <span style="color:red">then</span></span></td>
</tr><tr><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace;color:grey">14.</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small">
<span style="font-family:Courier,monospace;color:green">|</span></td><td style="padding:0px;font-family:'Arial Unicode MS',Arial,sans-serif;font-size:small"><span style="font-family:Courier,monospace"><span style="color:red">end</span></span></td>
</tr></tbody></table></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 10 April 2014 12:58, Leonard93 <span dir="ltr"><<a href="mailto:leonardlindenau@hotmail.com" target="_blank">leonardlindenau@hotmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello everyone, I have a small question/problem.<br>
<br>
I have created a class (POJO) in Eclipse and I want to be able to write<br>
rules over this class in the Drools Workbench, thus I exported the class and<br>
the classes it depends on (1 other class) to a Jar and imported it in the<br>
Drools workbench.<br>
<br>
Now what I did next is I added the jar dependency to my workbench project,<br>
created a new datamodel and set its super class to the external class from<br>
the jar and left the rest empty.<br>
<br>
When I then try to use this datamodel in a guided rule or anything I can<br>
access the variables defined in the external class fine when using the rule<br>
editor. But when I save I get various compiler errors.<br>
<br>
Currently I tried to make a rule template and I got these errors (I am using<br>
the standard example project to test it out):<br>
<br>
Unable to create Field Extractor for *'Destination'Field/method<br>
'destination'* not found for class '*org.mortgages.Test' *<br>
<br>
Unable to Analyse Expression *Destination ==<br>
GenericDataObject$Country.Germany*: [Error: unable to resolve method using<br>
strict-mode: *org.mortgages.Test.GenericDataObject$Country()]* [Near : {...*<br>
Destination == GenericDataObject$Country.Germ ....}]* ^ [Line: 9, Column: 2]<br>
<br>
<br>
The class from the jar looks like this:<br>
public class GenericDataObject {<br>
<br>
public enum Country<br>
{<br>
Egypt,<br>
Germany,<br>
Turkey,<br>
France,<br>
Unknown<br>
}<br>
<br>
public GenericDataObject()<br>
{<br>
result = new Result();<br>
}<br>
<br>
public Result result;<br>
public Country Destination;<br>
<br>
public void setDiscount(int amount)<br>
{<br>
result.discount = amount;<br>
}<br>
}<br>
<br>
public class Result<br>
{<br>
public int discount;<br>
<br>
public Result()<br>
{<br>
discount = 0;<br>
}<br>
}<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/External-Jar-Pojo-in-Drools-Workbench-tp4029190.html" target="_blank">http://drools.46999.n3.nabble.com/External-Jar-Pojo-in-Drools-Workbench-tp4029190.html</a><br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br></div>