<p dir="ltr">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.</p>
<p dir="ltr">Sent on the move</p>
<div class="gmail_quote">On 7 Jan 2014 13:31, "abhinay_agarwal" <<a href="mailto:abhinay_agarwal@infosys.com">abhinay_agarwal@infosys.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The following sentences are taking directly from the user guide:<br>
<br>
/ 'Person.age' : (new com.yourco.DataHelper()).getListOfAges()<br>
<br>
This assumes you have a class called "DataHelper" which has a method<br>
"getListOfAges()" which returns a List of strings (and is on the classpath).<br>
You can of course mix these "dynamic" enumerations with fixed lists. You<br>
could for example load from a database using JDBC. The data enumerations are<br>
loaded the first time you use the guided editor in a session./<br>
<br>
Now, I would like to know how guvnor would connect to the database ?<br>
<br>
Inside the getListOfAges(), I want to hit the database and get the list of<br>
ages, put it inside a Map<String, List&lt;String>>.<br>
<br>
The example that is shown in the user guide is again hard coding the values.<br>
<br>
>From the user guide :<br>
<br>
/public class SampleDataSource2 {<br>
public Map<String>, List<String> loadData() {<br>
Map data = new HashMap();<br>
List d = new ArrayList();<br>
d.add("value1");<br>
d.add("value2");<br>
data.put("Fact.field", d);<br>
return data;<br>
}<br>
}/<br>
<br>
<br>
AFAIK, the jar of this class SampleDataSource2 will be uploaded to guvnor,<br>
so should I keep the connection details to database inside the same class ?<br>
If yes,<br>
<br>
1. How will guvnor be able to directly connect to the database ?<br>
2. Should I add the jars for database connectivity as well ?<br>
3. Is keeping the connection details inside the jar, not a security threat ?<br>
<br>
I am not sure if I understand completely how this enumeration works, please<br>
feel free to guide me, if I am wrong somewhere.<br>
<br>
Regards,<br>
Abhinay<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Using-Advanced-Enumeration-Concepts-in-guvnor-tp4027563.html" target="_blank">http://drools.46999.n3.nabble.com/Using-Advanced-Enumeration-Concepts-in-guvnor-tp4027563.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>