[rules-users] Drools Guvnor: Loading enums programmatically

Nilima R nilima.r at tcs.com
Mon Apr 5 03:04:06 EDT 2010


Hi All,

Could some one reply to the below mentioned problem..

Thanks,
Nilima
____________________________________________
Experience certainty.   IT Services
                        Business Solutions
                        Outsourcing
____________________________________________



From:
Nilima R/PNE/TCS
To:
rules-users at lists.jboss.org
Date:
03/31/2010 03:37 PM
Subject:
Drools Guvnor: Loading enums programmatically


Hi All,


I'm trying to do a simple example of loading enums programmatically 
following the Drools Guvnor Docuemntation.
I'm on Drools Guvnor 5, Java 1.6 running under Jboss.

I'm trying to define this 'data enumeration/drop down list'

package opensource.test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SampleDataSource2 {
 
                  public Map<String, List<String>> loadData() {
 
                        Map<String, List<String>> data =
                  new HashMap<String,List<String>>();
 
                        List<String> d = new ArrayList<String>();
 
                    d.add("A");
                    d.add("B");
                    d.add("C");
                    d.add("D");
                    d.add("E");
                    data.put("Employee.band", d);
                    return data;
                 }
}

The jar containing the SampleDataSource2 has been defined as a model 
within Guvnor and I defined another declarative model Employee with fields 
name,band,rating.

Here's what I put in the 'Data enumeration' text window
Employee.band =(new SampleDataSource2()).loadData()

When validating the Data enumeration from Guvnor, I get the following 
error:
        Unable to load enumeration data.
                 unable to resolve class: DataEnumSource
                 Error type: org.mvel.CompileException

Any help will be highly appreciated ...

Thanks,
Nilima 

=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100405/43e168de/attachment.html 


More information about the rules-users mailing list