| Table of Contents |
|---|
In this tutorial, we will be following the guideline for developing a plugin to develop our JDBC Options Binder plugin. Please also refer to the very first tutorial How to develop a Bean Shell Hash Variable for more details steps.
| Thai |
|---|
1. What is the problem?
| Thai |
|---|
Sometime, we may need to write some custom query to populate the options for our multi options field.
| Thai |
|---|
2. How to solve the problem?
| Thai |
|---|
Joget Workflow has provided a plugin type called Form Options Binder Plugin. We will develop one to support JDBC connection and custom query.
| Thai |
|---|
3. What is the input needed for your plugin?
| Thai |
|---|
To develop a JDBC Options binder, we will need the JDBC connection setting and also the custom query to populate the options.
| Thai |
|---|
Datasource: Using custom datasource or Joget default datasource
Thai Custom JDBC Driver: The JDBC driver for custom datasource
Thai Custom JDBC URL: The JDBC connection URL for custom datasource
Thai Custom JDBC Username: The username for custom datasource
Thai Custom JDBC Password: The password for custom datasource
Thai SQL Query: The query to populate options.
Thai Use Ajax: A checkbox to decide whether or not it is using AJAX to load options. (For AJAX Cascading Drop-Down List)
Thai
The query should also support a syntax to inject dependency values when using AJAX.
| Thai |
|---|
Example:
| Thai |
|---|
SELECT id, name from app_fd_sample where group = ?
Thai SELECT id, name from app_fd_sample where group in (?)
Thai
4. What is the output and expected outcome of your plugin?
| Thai |
|---|
The first column of returned JDBC result will be the value of the option and second column is the label of the option. There will be another optional third column for grouping when not using AJAX for cascading drop-down list.
| Thai |
|---|
5. Are there any resources/API that can be reused?
| Thai |
|---|
We can refer to the implementation of other available Form Options Binder plugins. Joget default datasource can be retrieve with AppUtil.getApplicationContext().getBean("setupDataSource").
| Thai |
|---|
6. Prepare your development environment
| Thai |
|---|
We need to always have our Joget Workflow Source Code ready and built by following this guideline.
...
Let's say our folder directory is as follows.
| Thai |
|---|
| Code Block |
|---|
- Home
- joget
- plugins
- jw-community
-5.0.0 |
...
To download the ready-to-use plugin jar, please find it in http://marketplace.joget.org/.