Description

  • org.joget.apps.app.service.AppService
  • Under wflow-core module
  • Service method to manage and interact with app

Code Sample

The following example assume that you are using BeanShell Plugin in a Process Tool. Please refer to Bean Shell Programming Guide for more information.

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

Methods

completeAssignmentForm
public org.joget.apps.form.model.FormData completeAssignmentForm(java.lang.String appId, java.lang.String version, java.lang.String activityId, org.joget.apps.form.model.FormData formData, java.util.Map<java.lang.String, java.lang.String> workflowVariableMap)

Process a submitted form to complete an assignment

completeAssignmentForm
public org.joget.apps.form.model.FormData completeAssignmentForm(org.joget.apps.form.model.Form form, org.joget.workflow.model.WorkflowAssignment assignment, org.joget.apps.form.model.FormData formData, java.util.Map<java.lang.String, java.lang.String> workflowVariableMap)

Process a submitted form to complete an assignment

countProcessFormData
public int countProcessFormData(java.lang.String formDefId, java.lang.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.

createAppDefinition
public java.util.Collection<java.lang.String> createAppDefinition(org.joget.apps.app.model.AppDefinition appDefinition)

Create a new app definition

Return A Collection of errors (if any).

createAppDefinition
public java.util.Collection<java.lang.String> createAppDefinition(org.joget.apps.app.model.AppDefinition appDefinition, org.joget.apps.app.model.AppDefinition copyAppDefinition)

Create a new app definition and duplicate the other app

Return A Collection of errors (if any).

createFormDefinition
public java.util.Collection<java.lang.String> createFormDefinition(org.joget.apps.app.model.AppDefinition appDefinition, org.joget.apps.app.model.FormDefinition formDefinition)

Create a new form definition

Return A Collection of errors (if any).

createNewAppDefinitionVersion
public org.joget.apps.app.model.AppDefinition createNewAppDefinitionVersion(java.lang.String appId)

Create a new version of an app from an existing latest version

deleteAllAppDefinitionVersions
public void deleteAllAppDefinitionVersions(java.lang.String appId)

Delete all versions of an app

deleteAppDefinitionVersion
public void deleteAppDefinitionVersion(java.lang.String appId, java.lang.Long version)

Delete a specific app version

deployWorkflowPackage
public org.joget.apps.app.model.PackageDefinition deployWorkflowPackage(java.lang.String appId, java.lang.String version, byte[] packageXpdl, boolean createNewApp) throws java.io.Exception

Deploy an XPDL package for an app.

exportApp
public java.io.OutputStream exportApp(java.lang.String appId, java.lang.String version, java.io.OutputStream output) throws java.io.IOException

Export an app version in ZIP format into an OutputStream

getAppDataXmlFromZip
public byte[] getAppDataXmlFromZip(byte[] zip) throws java.io.Exception

Reads app XML from zip content.

getAppDefinition
public org.joget.apps.app.model.AppDefinition getAppDefinition(java.lang.String appId, java.lang.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.

getAppDefinitionForWorkflowActivity
public org.joget.apps.app.model.AppDefinition getAppDefinitionForWorkflowActivity(java.lang.String activityId)

Retrieves the app definition for a specific workflow activity assignment.

getAppDefinitionForWorkflowProcess
public org.joget.apps.app.model.AppDefinition getAppDefinitionForWorkflowProcess(java.lang.String processId)

Retrieves the app definition for a specific workflow process.

getWorkflowProcessForApp
public org.joget.workflow.model.WorkflowProcess getWorkflowProcessForApp(java.lang.String appId, java.lang.String version, java.lang.String processDefId)

Retrieves the workflow process definition for a specific app version.

getAppDefinitionWithProcessDefId
public org.joget.apps.app.model.AppDefinition getAppDefinitionWithProcessDefId(java.lang.String processDefId)

Retrieves the app definition for a specific workflow process definition id.

getAppDefinitionXml
public byte[] getAppDefinitionXml(java.lang.String appId, java.lang.Long version)

Get App definition XML

getFormTableName
public java.lang.String getFormTableName(org.joget.apps.app.model.AppDefinition appDef, java.lang.String formDefID)

Get table name of a form

getFormTableName
public java.lang.String getFormTableName(java.lang.String appId, java.lang.String appVersion, java.lang.String formDefID)

Get table name of a form

getOriginProcessId
public java.lang.String getOriginProcessId(java.lang.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.

getPrimaryKeyWithForeignKey
public java.lang.String getPrimaryKeyWithForeignKey(java.lang.String appId, java.lang.String appVersion, java.lang.String formId, java.lang.String foreignKeyName, java.lang.String foreignKeyValue)

Find a form data record id based a field name and value

getPublishedApps
public java.util.Collection<org.joget.apps.app.model.AppDefinition> getPublishedApps(java.lang.String appId)

Retrieve list of published apps available to the current user

getPublishedApps
public java.util.Collection<org.joget.apps.app.model.AppDefinition> getPublishedApps(java.lang.String appId, boolean mobileView, boolean mobileCache)

Retrieve list of published apps available to the current user.

Overloaded to additionally filter by mobile view support.

getPublishedProcesses
public java.util.Map<org.joget.apps.app.model.AppDefinition, java.util.Collection<org.joget.workflow.model.WorkflowProcess>> getPublishedProcesses(java.lang.String appId)

Retrieve list of published processes available to the current user

getPublishedVersion
public java.lang.Long getPublishedVersion(java.lang.String appId)

Get version of published app

getUnprotectedAppList
public java.util.Collection<org.joget.apps.app.model.AppDefinition> getUnprotectedAppList()

Retrieve all apps without check for permission

getXpdlFromZip
public byte[] getXpdlFromZip(byte[] zip) throws Exception

Reads XPDL from zip content.

importApp
public org.joget.apps.app.model.AppDefinition importApp(byte[] zip) throws org.joget.apps.app.model.ImportAppException

Import app from zip file

importAppDefinition
public org.joget.apps.app.model.AppDefinition importAppDefinition(org.joget.apps.app.model.AppDefinition appDef, java.lang.Long appVersion, byte[] xpdl) throws org.joget.apps.app.model.ImportAppException

Import an app definition object and XPDL content into the system.

importPlugins
public void importPlugins(byte[] zip) throws java.io.Exception

Import plugins (JAR) from within a zip content.

isActivityAutoContinue
public boolean isActivityAutoContinue(java.lang.String packageId, java.lang.String version, java.lang.String processDefId, java.lang.String activityDefId)

Check to see whether an activity is configured to automatically continue on to the next activity.

loadAppDefinition
public org.joget.apps.app.model.AppDefinition loadAppDefinition(java.lang.String appId, java.lang.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.

listProcessFormData
public java.util.Collection<org.joget.apps.form.model.Form> listProcessFormData(java.lang.String formDefId, java.lang.String processId, java.lang.String query, java.lang.String sort, java.lang.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.

loadFormData
public org.joget.apps.form.model.FormRowSet loadFormData(java.lang.String appId, java.lang.String version, java.lang.String formDefId, java.lang.String primaryKeyValue)

Load specific data row (record) by primary key value for a specific form

loadFormData
public org.joget.apps.form.model.FormRowSet loadFormData(org.joget.apps.form.model.Form form, java.lang.String primaryKeyValue)

Load specific data row (record) by primary key value for a specific form

loadFormDataWithoutTransaction
public org.joget.apps.form.model.FormRowSet loadFormDataWithoutTransaction(java.lang.String formDefid, java.lang.String tableName, java.lang.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.

loadFormDataWithoutTransaction
public org.joget.apps.form.model.FormRowSet loadFormDataWithoutTransaction(org.joget.apps.form.model.Form form, java.lang.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.

retrieveMappedForm
public org.joget.apps.app.model.PackageActivityForm retrieveMappedForm(java.lang.String appId, java.lang.String version, java.lang.String processDefId, java.lang.String activityDefId)

Returns the form definition ID for the form mapped to the specified activity definition ID

storeFormData
public org.joget.apps.form.model.FormRowSet storeFormData(org.joget.apps.form.model.Form form, org.joget.apps.form.model.FormRowSet rows, java.lang.String primaryKeyValue)

Store specific data row (record) for a form. 

storeFormData
public org.joget.apps.form.model.FormRowSet storeFormData(java.lang.String formDefId, java.lang.String tableName, org.joget.apps.form.model.FormRowSet rows, java.lang.String primaryKeyValue)

Store specific data row (record) for a form. 

storeFormData
public org.joget.apps.form.model.FormRowSet storeFormData(java.lang.String appId, java.lang.String version, java.lang.String formDefId, org.joget.apps.form.model.FormRowSet rows, java.lang.String primaryKeyValue)

Store specific data row (record)

submitForm
public org.joget.apps.form.model.FormData submitForm(org.joget.apps.form.model.Form form, org.joget.apps.form.model.FormData formData, boolean ignoreValidation)

Use case for form submission by Form object

submitForm
public org.joget.apps.form.model.FormData submitForm(java.lang.String appId, java.lang.String version, java.lang.String formDefId, org.joget.apps.form.model.FormData formData, boolean ignoreValidation)

Use case for form submission by ID

submitFormToStartProcess
public org.joget.workflow.model.WorkflowProcessResult submitFormToStartProcess(java.lang.String appId, java.lang.String version, java.lang.String processDefId, org.joget.apps.form.model.FormData formData, java.util.Map<java.lang.String, java.lang.String> workflowVariableMap, java.lang.String originProcessId, java.lang.String formUrl)

Start a process through a form submission

viewAssignmentForm
public org.joget.apps.app.model.PackageActivityForm viewAssignmentForm(org.joget.apps.app.model.AppDefinition appDef, org.joget.workflow.model.WorkflowAssignment assignment, org.joget.apps.form.model.FormData formData, java.lang.String formUrl)

Retrieve a form for a specific activity instance

viewAssignmentForm
public org.joget.apps.app.model.PackageActivityForm viewAssignmentForm(org.joget.apps.app.model.AppDefinition appDef, org.joget.workflow.model.WorkflowAssignment assignment, org.joget.apps.form.model.FormData formData, java.lang.String formUrl, java.lang.String cancelUrl)

Retrieve a form for a specific activity instance

viewAssignmentForm
public org.joget.apps.app.model.PackageActivityForm viewAssignmentForm(java.lang.String appId, java.lang.String version, java.lang.String activityId, org.joget.apps.form.model.FormData formData, java.lang.String formUrl)

Retrieve a form for a specific activity instance

viewAssignmentForm
public org.joget.apps.app.model.PackageActivityForm viewAssignmentForm(java.lang.String appId, java.lang.String version, java.lang.String activityId, org.joget.apps.form.model.FormData formData, java.lang.String formUrl, java.lang.String cancelUrl)

Retrieve a form for a specific activity instance

viewDataForm
public org.joget.apps.form.model.Form viewDataForm(java.lang.String appId, java.lang.String version, java.lang.String formDefId, java.lang.String saveButtonLabel, java.lang.String submitButtonLabel, java.lang.String cancelButtonLabel, org.joget.apps.form.model.FormData formData, java.lang.String formUrl, java.lang.String cancelUrl)

Retrieve a data form

viewDataForm
public org.joget.apps.form.model.Form viewDataForm(java.lang.String appId, java.lang.String version, java.lang.String formDefId, java.lang.String saveButtonLabel, java.lang.String submitButtonLabel, java.lang.String cancelButtonLabel, java.lang.String cancelButtonTarget, org.joget.apps.form.model.FormData formData, java.lang.String formUrl, java.lang.String cancelUrl)

Retrieve a data form

viewStartProcessForm
public org.joget.apps.app.model.PackageActivityForm viewStartProcessForm(java.lang.String appId, java.lang.String version, java.lang.String processDefId, org.joget.apps.form.model.FormData formData, java.lang.String formUrl)

Retrieve form mapped to start a process

 

 

 

  • No labels