All data access has to be "black boxed" inside your helper class. The example simply sets up some static data but could equally read the data from a database. The implementation would be entirely up to your own imvention.
Sent on the move
The following sentences are taking directly from the user guide:
/ 'Person.age' : (new com.yourco.DataHelper()).getListOfAges()
This assumes you have a class called "DataHelper" which has a method
"getListOfAges()" which returns a List of strings (and is on the classpath).
You can of course mix these "dynamic" enumerations with fixed lists. You
could for example load from a database using JDBC. The data enumerations are
loaded the first time you use the guided editor in a session./
Now, I would like to know how guvnor would connect to the database ?
Inside the getListOfAges(), I want to hit the database and get the list of
ages, put it inside a Map<String, List<String>>.
The example that is shown in the user guide is again hard coding the values.
>From the user guide :
/public class SampleDataSource2 {
public Map<String>, List<String> loadData() {
Map data = new HashMap();
List d = new ArrayList();
d.add("value1");
d.add("value2");
data.put("Fact.field", d);
return data;
}
}/
AFAIK, the jar of this class SampleDataSource2 will be uploaded to guvnor,
so should I keep the connection details to database inside the same class ?
If yes,
1. How will guvnor be able to directly connect to the database ?
2. Should I add the jars for database connectivity as well ?
3. Is keeping the connection details inside the jar, not a security threat ?
I am not sure if I understand completely how this enumeration works, please
feel free to guide me, if I am wrong somewhere.
Regards,
Abhinay
--
View this message in context: http://drools.46999.n3.nabble.com/Using-Advanced-Enumeration-Concepts-in-guvnor-tp4027563.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users