Joget DX Beta Available for Download

Check out Joget DX, the next generation successor to Joget Workflow for faster, simpler digital transformation.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

  • Java syntax supported by the version of JDK used
  • Usage of the following libraries:
    • Libraries available in JDK
    • org.joget.workflow.model.*
    • org.joget.workflow.util.*
    • JavaBeans Activation Framework 1.1
    • Commons Email 1.1
    • JavaMail 1.4
    • MySQL JDBC Driver 3.1.14
    • Oracle JDBC Driver 10.2.0.2
    • Microsoft SQL Server JDBC Driver 1.0
  • Usage of Hash Variables

    Example

Set value to a workflow variable:

...

Code Block
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.joget.apps.app.service.AppUtil;

Connection con = null;
try {
    // retrieve connection from the default datasource
    DataSource ds = (DataSource)AppUtil.getApplicationContext().getBean("setupDataSource");
    con = ds.getConnection();

    // execute SQL query
    if(!con.isClosed()) {
        PreparedStatement stmt = con.prepareStatement("UPDATE table1 SET column1='value1'");
        stmt.executeUpdate();
    }
} catch(Exception e) {
    System.err.println("Exception: " + e.getMessage());
} finally {
    try {
        if(con != null) {
            con.close();
        }
    } catch(SQLException e) {
    }
}

Participant Type Plugin

Anchor
Participant Type Plugin
Participant Type Plugin

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  :

...

Get all users from the DirectoryManager and assigning them:

??

Code Block
import java.util.Collection;
import java.util.ArrayList;
import org.joget.apps.app.service.AppUtil;
import org.joget.directory.model.service.ExtDirectoryManager;
import org.joget.directory.model.User;
import org.springframework.context.ApplicationContext;

ApplicationContext ac = AppUtil.getApplicationContext();
ExtDirectoryManager directoryManager = (ExtDirectoryManager) ac.getBean("directoryManager");

Collection results = new ArrayList();

Collection userList = directoryManager.getUserList();

for (User u : userList) {
	results.add(u.getUsername());
}
return results;

...