You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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
FormData completeAssignmentForm(String appId, String version, String activityId, FormData formData, Map<String, String> workflowVariableMap)

Process a submitted form to complete an assignment

completeAssignmentForm
FormData completeAssignmentForm(Form form, WorkflowAssignment assignment, FormData formData, Map<String, String> workflowVariableMap)

Process a submitted form to complete an assignment

countProcessFormData
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.

createAppDefinition
Collection<String> createAppDefinition(AppDefinition appDefinition)

Create a new app definition

Return A Collection of errors (if any).

createAppDefinition
Collection<String> createAppDefinition(AppDefinition appDefinition, AppDefinition copyAppDefinition)

Create a new app definition and duplicate the other app

Return A Collection of errors (if any).

createFormDefinition
Collection<String> createFormDefinition(AppDefinition appDefinition, FormDefinition formDefinition)

Create a new form definition

Return A Collection of errors (if any).

createNewAppDefinitionVersion
AppDefinition createNewAppDefinitionVersion(String appId)

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

deleteAllAppDefinitionVersions
void deleteAllAppDefinitionVersions(String appId)

Delete all versions of an app

deleteAppDefinitionVersion
void deleteAppDefinitionVersion(String appId, Long version)

Delete a specific app version

deployWorkflowPackage
PackageDefinition deployWorkflowPackage(String appId, String version, byte[] packageXpdl, boolean createNewApp) throws Exception

Deploy an XPDL package for an app.

exportApp
public OutputStream exportApp(String appId, String version, OutputStream output) throws IOException

Export an app version in ZIP format into an OutputStream

getAppDataXmlFromZip
byte[] getAppDataXmlFromZip(byte[] zip) throws Exception

Reads app XML from zip content.

getAppDefinition
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.

getAppDefinitionForWorkflowActivity
AppDefinition getAppDefinitionForWorkflowActivity(String activityId)

Retrieves the app definition for a specific workflow activity assignment.

getAppDefinitionForWorkflowProcess
AppDefinition getAppDefinitionForWorkflowProcess(String processId)

Retrieves the app definition for a specific workflow process.

getWorkflowProcessForApp
WorkflowProcess getWorkflowProcessForApp(String appId, String version, String processDefId)

Retrieves the workflow process definition for a specific app version.

getAppDefinitionWithProcessDefId
AppDefinition getAppDefinitionWithProcessDefId(String processDefId)

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

getAppDefinitionXml
byte[] getAppDefinitionXml(String appId, Long version)

Get App definition XML

getFormTableName
public String getFormTableName(AppDefinition appDef, String formDefID)

Get table name of a form

getFormTableName
public String getFormTableName(String appId, String appVersion, String formDefID)

Get table name of a form

getOriginProcessId
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.

getPrimaryKeyWithForeignKey
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

getPublishedApps
public Collection<AppDefinition> getPublishedApps(String appId)

Retrieve list of published apps available to the current user

getPublishedApps
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.

getPublishedProcesses
public Map<AppDefinition, Collection<WorkflowProcess>> getPublishedProcesses(String appId)

Retrieve list of published processes available to the current user

getPublishedVersion
public Long getPublishedVersion(String appId)

Get version of published app

getUnprotectedAppList
public Collection<AppDefinition> getUnprotectedAppList()

Retrieve all apps without check for permission

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

Reads XPDL from zip content.

importApp
AppDefinition importApp(byte[] zip) throws ImportAppException

Import app from zip file

importAppDefinition
AppDefinition importAppDefinition(AppDefinition appDef, Long appVersion, byte[] xpdl) throws ImportAppException

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

importPlugins
void importPlugins(byte[] zip) throws Exception

Import plugins (JAR) from within a zip content.

isActivityAutoContinue
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.

loadAppDefinition
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.

listProcessFormData
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.

loadFormData
FormRowSet loadFormData(String appId, String version, String formDefId, String primaryKeyValue)

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

loadFormData
FormRowSet loadFormData(Form form, String primaryKeyValue)

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

loadFormDataWithoutTransaction
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.

loadFormDataWithoutTransaction
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.

retrieveMappedForm
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

storeFormData
FormRowSet storeFormData(Form form, FormRowSet rows, String primaryKeyValue)

Store specific data row (record) for a form. 

storeFormData
FormRowSet storeFormData(String formDefId, String tableName, FormRowSet rows, String primaryKeyValue)

Store specific data row (record) for a form. 

storeFormData
FormRowSet storeFormData(String appId, String version, String formDefId, FormRowSet rows, String primaryKeyValue)

Store specific data row (record)

submitForm
FormData submitForm(Form form, FormData formData, boolean ignoreValidation)

Use case for form submission by Form object

submitForm
FormData submitForm(String appId, String version, String formDefId, FormData formData, boolean ignoreValidation)

Use case for form submission by ID

submitFormToStartProcess
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

viewAssignmentForm
PackageActivityForm viewAssignmentForm(AppDefinition appDef, WorkflowAssignment assignment, FormData formData, String formUrl)

Retrieve a form for a specific activity instance

viewAssignmentForm
PackageActivityForm viewAssignmentForm(AppDefinition appDef, WorkflowAssignment assignment, FormData formData, String formUrl, String cancelUrl)

Retrieve a form for a specific activity instance

viewAssignmentForm
PackageActivityForm viewAssignmentForm(String appId, String version, String activityId, FormData formData, String formUrl)

Retrieve a form for a specific activity instance

viewAssignmentForm
PackageActivityForm viewAssignmentForm(String appId, String version, String activityId, FormData formData, String formUrl, String cancelUrl)

Retrieve a form for a specific activity instance

viewDataForm
Form viewDataForm(String appId, String version, String formDefId, String saveButtonLabel, String submitButtonLabel, String cancelButtonLabel, FormData formData, String formUrl, String cancelUrl)

Retrieve a data form

viewDataForm

 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

viewStartProcessForm
PackageActivityForm viewStartProcessForm(String appId, String version, String processDefId, FormData formData, String formUrl)

Retrieve form mapped to start a process

 

 

 

  • No labels