AppUtil
Description
org.joget.apps.app.service.AppUtil
- Under
wflow-core
module - Utility methods are used by the App in runtime
Code Sample
Fields
PREFIX_WORKFLOW_VARIABLE
public static final String PREFIX_WORKFLOW_VARIABLE = "var_";
Prefix of a request parameter to indicate the parameter is to be used to set the workflow variable.
PROPERTY_WORKFLOW_VARIABLE
public static final String PROPERTY_WORKFLOW_VARIABLE = "workflowVariable";
Property key to retrieves the workflow variable name from a form field property.
Methods
containsHashVariable
public static boolean containsHashVariable(java.lang.String content)
Used to check if a content may contain Hash Variable or not.
convertVersionToLong
public static java.lang.Long convertVersionToLong(java.lang.String version)
Converts a String version to its Long equivalent.
escapeHashVariable
public static java.lang.String escapeHashVariable(java.lang.String content)
Used to escape all the Hash Variables found in the content.
getAppDateFormat
public static java.lang.String getAppDateFormat()
Read the date format from Setup.
getApplicationContext
public static org.springframework.context.ApplicationContext getApplicationContext()
Utility method to retrieve the ApplicationContext of the system.
getAppLocale
public static java.lang.String getAppLocale()
Read locale from Setup.
getCurrentAppDefinition
public static org.joget.apps.app.model.AppDefinition getCurrentAppDefinition()
Retrieve the AppDefinition for the current thread.
getDesignerWebBaseUrl
public static java.lang.String getDesignerWebBaseUrl()
Returns the URL to the workflow web designer.
getDesignerContextPath
public static java.lang.String getDesignerContextPath()
Used by the system to get designer context path.
getEmailList
public static java.util.Collection<java.lang.String> getEmailList(java.lang.String toParticipantId, java.lang.String toSpecific, org.joget.workflow.model.WorkflowAssignment wfAssignment, org.joget.apps.app.model.AppDefinition appDef)
Used to retrieve email list based on Participant ID and To email string. Username will auto convert to email address belongs to the user.
getProcessDefIdWithVersion
public static java.lang.String getProcessDefIdWithVersion(java.lang.String appId, java.lang.String version, java.lang.String processDefId)
Forms the full process definition ID which includes the package and version.
getRequestContextPath
public static java.lang.String getRequestContextPath()
Convenience method to retrieve the current request context path.
getSystemAlert
public static java.lang.String getSystemAlert()
Used by the system to retrieve the once-time HTML to append on the page load. The once-time HTML will be removed after this method call.
getSystemVersion
public static java.lang.String getSystemVersion()
Returns the current system version.
getUserviewThemeCss
public static java.lang.String getUserviewThemeCss()
Get the userview theme css depends on the userview parameter in request.
isAppDefinitionReset
public static boolean isAppDefinitionReset() throws org.springframework.beans.BeansException
Method used by system to check whether there is an AppDefinition exist in current thread.
isQuickEditEnabled
public static boolean isQuickEditEnabled()
Checks system settings whether front-end quick edit is enabled.
processHashVariable
public static java.lang.String processHashVariable(java.lang.String content, org.joget.workflow.model.WorkflowAssignment wfAssignment, java.lang.String escapeFormat, java.util.Map<java.lang.String, java.lang.String> replaceMap)
Used to parses Hash Variables found in the content and replace it to the Hash Variable value.
processHashVariable
public static java.lang.String processHashVariable(java.lang.String content, org.joget.workflow.model.WorkflowAssignment wfAssignment, java.lang.String escapeFormat, java.util.Map<java.lang.String, java.lang.String> replaceMap, org.joget.apps.app.model.AppDefinition appDef)
Used to parses Hash Variables found in the content and replace it to the Hash Variable value.
readPluginResource
public static java.lang.String readPluginResource(java.lang.String pluginName, java.lang.String resourceUrl)
Reads a resource from a plugin.
readPluginResource
public static java.lang.String readPluginResource(java.lang.String pluginName, java.lang.String resourceUrl, java.lang.Object[] arguments, boolean removeNewLines)
Reads a resource from a plugin. java.util.Formatter text patterns supported.
readPluginResource
public static java.lang.String readPluginResource(java.lang.String pluginName, java.lang.String resourceUrl, java.lang.Object[] arguments, boolean removeNewLines, java.lang.String translationFileName)
Reads a resource from a plugin. java.util.Formatter text patterns supported.
resetAppDefinition
public static void resetAppDefinition() throws org.springframework.beans.BeansException
Method used by system to clear the AppDefinition of current thread once the request is processing finish.
retrieveVariableDataFromMap
public static java.util.Map<java.lang.String, java.lang.String> retrieveVariableDataFromMap(java.util.Map parameters)
Retrieves workflow variable values from a Map and populate into another Map.
retrieveVariableDataFromRequest
public static java.util.Map<java.lang.String, java.lang.String> retrieveVariableDataFromRequest(javax.servlet.http.HttpServletRequest request)
Retrieves workflow variable values from request parameters and populate into a Map.
setCurrentAppDefinition
public static void setCurrentAppDefinition(org.joget.apps.app.model.AppDefinition appDef) throws org.springframework.beans.BeansException
Ties an AppDefinition to the current thread.
setDesignerContextPath
public static void setDesignerContextPath(java.lang.String path)
Used by the system to set designer context path.
setSystemAlert
public static void setSystemAlert(java.lang.String value)
Used to set a once-time HTML which will append to the page when the next page loads.
writeJson
public static void writeJson(java.io.Writer writer, org.json.JSONObject jsonObject, java.lang.String callback) throws java.io.IOException, org.json.JSONException
Convenient method used to write JSON Object to the response.
writeJson
public static void writeJson(java.io.Writer writer, org.json.JSONArray jsonArray, java.lang.String callback) throws java.io.IOException, org.json.JSONException
Convenient method used to write JSON Array to the response.