Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
Table of Contents |
---|
The following example assume that you are using BeanShell Plugin in a Process Tool. Please refer to Bean Shell Programming Guide for more information.
Code Block | ||
---|---|---|
| ||
import org.joget.apps.app.service.AppService;
import org.joget.apps.app.service.AppUtil;
import org.joget.apps.form.model.FormRowSet;
//Get App Service
AppService appService = (AppService) AppUtil.getApplicationContext().getBean("appService");
String processId = workflowAssignment.getProcessId(); //Please note that workflowAssignment is auto injected in BeanShell Plugin when mapped to Process Tool
//Get the record id
String primaryKey = appService.getOriginProcessId(processId);
//Load form data
FormRowSet rowSet = appService.loadFormData(appDef.getAppId(), appDef.getVersion().toString(), "sampleFormDefId", primaryKey); //Please note that appDef is auto injected in BeanShell Plugin when mapped to Process Tool |
FormData completeAssignmentForm(String appId, String version, String activityId, FormData formData, Map<String, String> workflowVariableMap)
Process a submitted form to complete an assignment
FormData completeAssignmentForm(Form form, WorkflowAssignment assignment, FormData formData, Map<String, String> workflowVariableMap)
Process a submitted form to complete an assignment
int countProcessFormData(String formDefId, String query)
Returns the total number of form data rows for a process based on criteria
Deprecated API used in v2. Not implemented since v3.
Collection<String> createAppDefinition(AppDefinition appDefinition)
Create a new app definition
Return A Collection of errors (if any).
Collection<String> createAppDefinition(AppDefinition appDefinition, AppDefinition copyAppDefinition)
Create a new app definition and duplicate the other app
Return A Collection of errors (if any).
Collection<String> createFormDefinition(AppDefinition appDefinition, FormDefinition formDefinition)
Create a new form definition
Return A Collection of errors (if any).
AppDefinition createNewAppDefinitionVersion(String appId)
Create a new version of an app from an existing latest version
void deleteAllAppDefinitionVersions(String appId)
Delete all versions of an app
void deleteAppDefinitionVersion(String appId, Long version)
Delete a specific app version
PackageDefinition deployWorkflowPackage(String appId, String version, byte[] packageXpdl, boolean createNewApp) throws Exception
Deploy an XPDL package for an app.
public OutputStream exportApp(String appId, String version, OutputStream output) throws IOException
Export an app version in ZIP format into an OutputStream
byte[] getAppDataXmlFromZip(byte[] zip) throws Exception
Reads app XML from zip content.
AppDefinition getAppDefinition(String appId, String version)
Finds the app definition based on the appId and version, cached where possible.
If version is null, empty or equals to AppDefinition.VERSION_LATEST, the latest version is returned.
AppDefinition getAppDefinitionForWorkflowActivity(String activityId)
Retrieves the app definition for a specific workflow activity assignment.
AppDefinition getAppDefinitionForWorkflowProcess(String processId)
Retrieves the app definition for a specific workflow process.
WorkflowProcess getWorkflowProcessForApp(String appId, String version, String processDefId)
Retrieves the workflow process definition for a specific app version.
AppDefinition getAppDefinitionWithProcessDefId(String processDefId)
Retrieves the app definition for a specific workflow process definition id.
byte[] getAppDefinitionXml(String appId, Long version)
Get App definition XML
public String getFormTableName(AppDefinition appDef, String formDefID)
Get table name of a form
public String getFormTableName(String appId, String appVersion, String formDefID)
Get table name of a form
String getOriginProcessId(String processId)
Returns the origin process ID or recordId for a process instance.
The return value can be the process ID of the top-most process which is started that possibly triggers other sub-processes, or it is a record id used to start the top-most process.
public String getPrimaryKeyWithForeignKey(String appId, String appVersion, String formId, String foreignKeyName, String foreignKeyValue)
Find a form data record id based a field name and value
public Collection<AppDefinition> getPublishedApps(String appId)
Retrieve list of published apps available to the current user
public Collection<AppDefinition> getPublishedApps(String appId, boolean mobileView, boolean mobileCache)
Retrieve list of published apps available to the current user.
Overloaded to additionally filter by mobile view support.
public Map<AppDefinition, Collection<WorkflowProcess>> getPublishedProcesses(String appId)
Retrieve list of published processes available to the current user
public Long getPublishedVersion(String appId)
Get version of published app
public Collection<AppDefinition> getUnprotectedAppList()
Retrieve all apps without check for permission
byte[] getXpdlFromZip(byte[] zip) throws Exception
Reads XPDL from zip content.
AppDefinition importApp(byte[] zip) throws ImportAppException
Import app from zip file
AppDefinition importAppDefinition(AppDefinition appDef, Long appVersion, byte[] xpdl) throws ImportAppException
Import an app definition object and XPDL content into the system.
void importPlugins(byte[] zip) throws Exception
Import plugins (JAR) from within a zip content.
boolean isActivityAutoContinue(String packageId, String version, String processDefId, String activityDefId)
Check to see whether an activity is configured to automatically continue on to the next activity.
AppDefinition loadAppDefinition(String appId, String version)
Loads the app definition based on the appId and version.
If version is null, empty or equals to AppDefinition.VERSION_LATEST, the latest version is returned.
Collection<Form> listProcessFormData(String formDefId, String processId, String query, String sort, Boolean desc, int start, int rows)
Returns a Collection of form data for a process based on criteria
Deprecated API used in v2. Not implemented since v3.
FormRowSet loadFormData(String appId, String version, String formDefId, String primaryKeyValue)
Load specific data row (record) by primary key value for a specific form
FormRowSet loadFormData(Form form, String primaryKeyValue)
Load specific data row (record) by primary key value for a specific form
FormRowSet loadFormDataWithoutTransaction(String formDefid, String tableName, String primaryKeyValue)
Method to load specific data row (record) by primary key value for a specific form.
This method is transactional (since v5), but retains the method name for backward compatibility reasons.
FormRowSet loadFormDataWithoutTransaction(Form form, String primaryKeyValue)
Method to load specific data row (record) by primary key value for a specific form.
This method is transactional (since v5), but retains the method name for backward compatibility reasons.
PackageActivityForm retrieveMappedForm(String appId, String version, String processDefId, String activityDefId)
Returns the form definition ID for the form mapped to the specified activity definition ID
FormRowSet storeFormData(Form form, FormRowSet rows, String primaryKeyValue)
Store specific data row (record) for a form.
FormRowSet storeFormData(String formDefId, String tableName, FormRowSet rows, String primaryKeyValue)
Store specific data row (record) for a form.
FormRowSet storeFormData(String appId, String version, String formDefId, FormRowSet rows, String primaryKeyValue)
Store specific data row (record)
FormData submitForm(Form form, FormData formData, boolean ignoreValidation)
Use case for form submission by Form object
FormData submitForm(String appId, String version, String formDefId, FormData formData, boolean ignoreValidation)
Use case for form submission by ID
WorkflowProcessResult submitFormToStartProcess(String appId, String version, String processDefId, FormData formData, Map<String, String> workflowVariableMap, String originProcessId, String formUrl)
Start a process through a form submission
PackageActivityForm viewAssignmentForm(AppDefinition appDef, WorkflowAssignment assignment, FormData formData, String formUrl)
Retrieve a form for a specific activity instance
PackageActivityForm viewAssignmentForm(AppDefinition appDef, WorkflowAssignment assignment, FormData formData, String formUrl, String cancelUrl)
Retrieve a form for a specific activity instance
PackageActivityForm viewAssignmentForm(String appId, String version, String activityId, FormData formData, String formUrl)
Retrieve a form for a specific activity instance
PackageActivityForm viewAssignmentForm(String appId, String version, String activityId, FormData formData, String formUrl, String cancelUrl)
Retrieve a form for a specific activity instance
Form viewDataForm(String appId, String version, String formDefId, String saveButtonLabel, String submitButtonLabel, String cancelButtonLabel, FormData formData, String formUrl, String cancelUrl)
Retrieve a data form
Form viewDataForm(String appId, String version, String formDefId, String saveButtonLabel, String submitButtonLabel, String cancelButtonLabel, String cancelButtonTarget, FormData formData, String formUrl, String cancelUrl)
Retrieve a data form
PackageActivityForm viewStartProcessForm(String appId, String version, String processDefId, FormData formData, String formUrl)
Retrieve form mapped to start a process