Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
...
...
...
BeanShell is a small, embeddable Java source interpreter with object scripting language features, written in Java. BeanShell dynamically executes standard Java syntax. So, using BeanShell Plugin, you can type in valid Java codes in plugin configuration, and the statements will be executed when the plugin is triggered. No compilation cycle is needed.
The script can be composed of:
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Set value to a workflow variable
Code Block |
---|
Variables|KB:v3 Hash Variables] ---- h3. Example *Set value to a workflow variable{*}import org.joget.workflow.model.service.*; WorkflowManager wm = (WorkflowManager) pluginManager.getBean("workflowManager"); wm.activityVariable(workflowAssignment.getActivityId(), "variableId", "variableValue"); * |
Execute
...
SQL
...
statement
...
through JDBC
Code Block |
---|
JDBC{*}import java.sql.*; Connection con = null; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection("jdbc:mysql://localhost/wflowdb?useUnicode=true&characterEncoding=UTF-8", "root", "root"); if(\!con.isClosed()) { System.out.println("Successfully connected to MySQL server using TCP/IP..."); PreparedStatement stmt = con.createStatement(); stmt.executeUpdate("UPDATE formdata_simpleflow set c_status='#assignment.activityId#' WHERE processId='#assignment.processId#'"); } } catch(Exception e) { System.err.println("Exception: " + e.getMessage()); } } finally { try { if(con != null) con.close(); } } catch(SQLException e) {} } h2. |
...
...
...
A
...
participant
...
type
...
plugin
...
should
...
return
...
a
...
collection
...
of
...
usernames.
...
In
...
the
...
participant
...
plugin
...
there
...
are
...
two
...
context
...
variables
...
available
...
for
...
the
...
script to use :
A Beanshell Participant Type Plugin returning one Participant
Code Block |
---|
to use : * pluginManager * workflowActivity *A Beanshell Participant Type Plugin returning one Participant{*}import java.util.ArrayList; a = new ArrayList(); a.add("jack"); // one username return a; |
Activity tool type plugin is a plugin that will be executed when workflow reached a System Tool activity. System Tool activities must be placed in the workflow diagram, and then the Beanshell plugin configured in the Process's Activity Mapping for this to work. In this plugin there are two context variables available for the script to use :
Code Block |
---|
import\\ h2. Activity Tool Type Plugin Activity tool type plugin is a plugin that will be executed when workflow reached a System Tool activity. System Tool activities must be placed in the workflow diagram, and then the Beanshell plugin configured in the Process's Activity Mapping for this to work. In this plugin there are two context variables available for the script to use : * pluginManager * workflowAssignment h4. A Beanshell Activity Tool type plugin that sets a form dataimport java.util.ArrayList; import java.util.logging.Logger; import org.joget.plugin.base.PluginManager; import java.util.logging.FileHandler; import org.joget.workflow.model.service.WorkflowManager; import org.joget.form.model.service.FormManager; import org.joget.form.model.Form; FormManager formManager = (FormManager) pluginManager.getBean("formManager"); processId = workflowAssignment.getProcessId(); Form form = formManager.loadDynamicFormByProcessId("T01", processId); // in this example, form's table is T01 formData = form.getCustomProperties(); formData.put("c_columnname","new value"); // the form data field to be set is columnname form.setCustomProperties(formData); formManager.saveForm(form); \\ |