Data enumerations (drop down list configurations) Kie Workbench

840 views Asked by At

I am using drools kie workbench 6.4.0 war deployed on wildfly server 8.1.0. I am using guided decision table editor (**GDT editor) to generate compiled .gdst file from the workbench.

To prevent manual typing and potential wrong values being typed, i am using enum classes within the project. Besides i have a mysql database setup on my local system.

Now for example if i have a enum class say City as below in my Kie workbench project

public enum City {

LONDAN("londan"),
PARIS("paris");

private String city;

City(String city) {
    this.city = city;
}

public String getCityValue() {
    return this.city;
}

}

Corresponding to this enum class is a City table in DB with following structure and data

enter image description here

enter image description here

If I create a rule using GDT editor which uses the City enum class as column in WHEN clause which will look like

enter image description here

and the source generated would be like

rule "Row 1 Sample" dialect "mvel" when tp : TransactionProcess( city == City.LONDAN or City.PARIS (based on what i choose as an input either london or paris) ) then end

Now the dropdown for city column shows 2 values as it picks it up from the enum class City. My question is how can i make use of City table defined in mysql database to fetch the distinct list of values in city column defined in City table in DB and populate the dropdown for city column in my Sample.gdst file instead of reading the values from an enum class to populate the dropdown.

To summarize i would like to know:

  1. How can i enable kie workbench to connect to a datasource.

  2. How can i use the datasource to query the database from the workbench and execute a SELECT on a table in DB and use the table column values to populate the dropdown to so that i can choose a value for a column in the WHEN clause of my rule when using GDT editor.

Thanks,

Ashish Sood.

0

There are 0 answers