[rules-users] Loading enums programmatically in guvnor

drools10 tsarkar at professionalaccess.com
Fri Jan 28 01:31:14 EST 2011


Hi,
   I am a newbie to drools/guvnor. I am trying to populate a drop-down list
in guvnor rule generation with preconfigured values(which would come from
database).
I tried to populate the titles property of AgeTest class with values from
loadData() method of AgeValues class.
In the new Enumeration I gave: titles=(new
com.guvnor.AgeValues()).loadData();
My classes are as below:
public class AgeTest {
            private List<String> titles = new ArrayList<String>();
            public List<String> getTitles() {
		return titles;
	    }
            public void setTitles(List<String> titles) {
		this.titles = titles;
	    }
}

and

public class AgeValues {
   public Map<String,List<String>> loadData() {
	    Map<String,List<String>> data = new HashMap<String,List<String>>();

	    List<String> titleValues = new ArrayList<String>();
	    titleValues.add("title1");
	    titleValues.add("title2");
	    data.put("AgeTest.titles", titleValues);

	    return data;
	 }
}

I get the following error while validating the enumeration: "The expression
is not a map, it is a java.util.ArrayList".

Can anyone please guide me in this regard. I even tried to have titles field
as a map, but same issue.
I copied the 2 classes to my guvnor/web-inf folder.
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Loading-enums-programmatically-in-guvnor-tp2365812p2365812.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list