Class WorkflowUtils
- Author:
- APGAR Consulting
-
Method Summary
Modifier and TypeMethodDescriptionstatic SessioncreateTechSessionForUser(Repository repository, UserReference user) Creates a technical session for the specified user.static StringdisplayUserUpdateAlreadyOngoingErrorMessage(List<ProcessInstanceKey> processInstanceKeyList, Locale locale, Repository repository, Session session) Displays a page indicating that there is an ongoing process associated with the record, along with a list of users currently holding processes.static List<ProcessInstanceKey>getActiveProcessList(PublishedProcessKey publishedProcessKey, String dataContextKey, String variableValue, Repository repository, Session session) Retrieves active processes that have the value of the dataContextKey variable equals tovariableValue.static AdaptationgetCurrentDataset(AdaptationHome dataSpaceHome, DataContextReadOnly context) Returns the current dataset, as an adaptation, from the specified workflow data context.static AdaptationHomegetCurrentDataspace(Repository repository, DataContextReadOnly context) Returns the dataspace defined in thedataSpacedata context variable as anAdaptationHomeutilizing the given data context.static AdaptationHomegetCurrentDataspace(ScriptTaskContext context) Returns the dataspace defined in thedataSpacedata context variable as anAdaptationHomein the context of a script task.static AdaptationHomeReturns the dataspace defined in theworkSpacedata context variable as anAdaptationHomebefore user task work item completion.static AdaptationHomeReturns the dataspace defined in thedataSpacedata context variable as anAdaptationHomein the context of user task creation.static AdaptationgetCurrentRecord(Repository repository, DataContextReadOnly context) Retrieves the record as anAdaptationfrom the workflow context (i.e, the child dataspace created for the workflow instance) using its XPath.static AdaptationgetCurrentRecord(ProcessInstance processInstance) Returns the current workflow record created/modified using the workflow data context variables of the specifiedprocessInstance.static AdaptationgetCurrentRecord(ScriptTaskContext context) Returns the current workflow record created/modified using the workflow data context variables for the specified script task.static AdaptationReturns the current workflow record created/modified using the workflow data context variables before work item completion.static AdaptationgetCurrentRecord(UserTaskCreationContext context) Returns the current workflow record created/modified using the workflow data context variables when handling work item creation.static AdaptationReturns the current workflow record created/modified using the workflow data context variables when handling work item completion.static AdaptationHomegetCurrentWorkspace(Repository repository, DataContextReadOnly context) Returns the current workflow working workspace utilizing the given data context.static AdaptationHomegetCurrentWorkspace(ScriptTaskContext context) Returns the current workflow working workspace in the context of a script task.static UserReferencegetLastUser(ScriptTaskContext context) Returns the user ID (i.e.,UserReferenceof thelastUserdata context variable in the context of a script task.static StringgetParentRecordPkFromTrackingInfo(Session session) Parses the tracking information of the session in a workflow context to get the primary key of the created/modified record.static PublishedProcessKeygetPublishProcessKey(DataContext dataContext) Returns thePublishedProcessKeyfrom the specifieddata context.static AdaptationgetRecord(Repository repository, DataContextReadOnly context, String recordVariableName) Retrieves the record as anAdaptationfrom the specified workflow data context using the XPath defined in therecordVariableNamedata context variable.static AdaptationgetRecord(UserTaskCreationContext context, String recordXPath) Retrieves the record as anAdaptationfrom the dataspace specified in thedataSpacedata context variable using the givenrecordXPath.static StringgetUserWithSalutation(Repository repository, UserReference userReference, Locale locale) Returns the user's label with their salutation.static StringgetWorkDataspaceLabel(Session session, PublishedProcessKey publishedProcessKey, AdaptationTable table) Creates the label of the workflow working dataspace (i.e., the created child dataspace).static StringgetWorkDataspaceLabelWithCreatorName(Repository repository, Session session, PublishedProcessKey publishedProcessKey, AdaptationTable table) Creates the label of the workflow working dataspace (i.e., the created child dataspace).static booleanisInWorkflowContext(InteractionHelper.ParametersMap inputParms, PublishedProcessKey publishedProcessKey) Determines whether the specified interaction is in the context of the workflow with the givenpublishedProcessKey, usinginputParams.static booleanisInWorkflowContext(Session session) Determines whether the givensessionis within a workflow context.static booleanisInWorkflowContext(Session session, PublishedProcessKey publishedProcessKey) Determines whether the session is in the context of the workflow with the specifiedpublishedProcessKey.static booleanisInWorkflowContext(Session session, String workflowName) Determines whether the session is in the context of the specified workflow.static booleanisNewOccurence(Adaptation record) Determines whether the specifiedrecordwas created during the workflow instance in the child dataspace.static voidsetTrackingInfo(UIHttpManagerComponent httpComp, PublishedProcessKey publishedProcessKey, Adaptation parentRecord) Formats the tracking information of theUIHttpManagerComponentused to access the record update/creation form before a workflow launch.
-
Method Details
-
isInWorkflowContext
Determines whether the givensessionis within a workflow context.- Parameters:
session- the authenticated user session- Returns:
trueif the session is passed in a workflow context;falseotherwise
-
isInWorkflowContext
public static boolean isInWorkflowContext(InteractionHelper.ParametersMap inputParms, PublishedProcessKey publishedProcessKey) Determines whether the specified interaction is in the context of the workflow with the givenpublishedProcessKey, usinginputParams.- Parameters:
inputParms- input parameters of a given interactionpublishedProcessKey- a specific publication ID of a process definition- Returns:
trueif the interaction is in the context of the workflow with the specifiedpublishedProcessKey;falseotherwise
-
isInWorkflowContext
Determines whether the session is in the context of the workflow with the specifiedpublishedProcessKey.- Parameters:
session- the authenticated user sessionpublishedProcessKey- a specific publication ID of a process definition- Returns:
trueif the session is passed in the workflow belonging to the specifiedpublishedProcessKey;falseotherwise
-
isInWorkflowContext
Determines whether the session is in the context of the specified workflow.- Parameters:
session- the authenticated user sessionworkflowName- the name of the workflow- Returns:
trueif the session is in the context of the workflow withworkflowNamename;falseotherwise
-
isNewOccurence
Determines whether the specifiedrecordwas created during the workflow instance in the child dataspace.- Parameters:
record- the record to evaluate- Returns:
trueif the record was created during the workflow instance (i.e., not in the main dataspace);falseotherwise
-
getPublishProcessKey
Returns thePublishedProcessKeyfrom the specifieddata context.- Parameters:
dataContext- the data context used to extract the publication name- Returns:
- the publish process key of the extracted publication name.
-
getCurrentRecord
Retrieves the record as anAdaptationfrom the workflow context (i.e, the child dataspace created for the workflow instance) using its XPath.This method requires three data context variables to be defined in the workflow to look up the record using its XPath.
workSpacedataSetrecord
- Parameters:
repository- the repository in which to search for the recordcontext- a read-only version of the given data context- Returns:
- the record as an
Adaptation
-
getRecord
Retrieves the record as anAdaptationfrom the dataspace specified in thedataSpacedata context variable using the givenrecordXPath.This method is used in the context of work items creation (e.g.,
handleCreatemethod ofUserTaskabstract class.This method requires two data context variables to be defined in the workflow to look up the record using its XPath.
dataSpacedataSet
- Parameters:
context- the user task creation contextrecordXPath- the XPath of the record to look up- Returns:
- the record as an
Adaptation
-
getRecord
public static Adaptation getRecord(Repository repository, DataContextReadOnly context, String recordVariableName) Retrieves the record as anAdaptationfrom the specified workflow data context using the XPath defined in therecordVariableNamedata context variable.This method requires three data context variables to be defined in the workflow to look up the record using its XPath.
workSpacedataSet- specified
recordVariableName
- Parameters:
repository- the repository in which to search for the recordcontext- a read-only version of the given data contextrecordVariableName- the variable name of the data context containing the record XPath- Returns:
- the record as an
Adaptation
-
getCurrentRecord
Returns the current workflow record created/modified using the workflow data context variables when handling work item completion.This method is used in the context of work item completion (e.g.,
handleWorkItemCompletionmethod ofUserTaskabstract class.This method requires three data context variables to be defined in the workflow to look up the record using its XPath.
workSpacedataSetrecord
- Parameters:
context- the context of work item completion- Returns:
- the record as an
Adaptation - See Also:
-
getCurrentRecord
Returns the current workflow record created/modified using the workflow data context variables when handling work item creation.This method is used in the context of work item creation (e.g.,
handleCreatemethod ofUserTaskabstract class.This method requires three data context variables to be defined in the workflow to look up the record using its XPath.
workSpacedataSetrecord
- Parameters:
context- the context of user task creation- Returns:
- the record as an
Adaptation - See Also:
-
getCurrentRecord
Returns the current workflow record created/modified using the workflow data context variables before work item completion.This method is used to perform a check on the returned record before completing the associated work item (i.e., in the
checkBeforeWorkItemCompletionmethod ofUserTaskabstract class.This method requires three data context variables to be defined in the workflow to look up the record using its XPath.
workSpacedataSetrecord
- Parameters:
context- the context of work item when the user clicks the 'accept' or the 'reject' button- Returns:
- the record as an
Adaptation - See Also:
-
getCurrentRecord
Returns the current workflow record created/modified using the workflow data context variables for the specified script task.This method requires three data context variables to be defined in the workflow to look up the record using its XPath.
workSpacedataSetrecord
- Parameters:
context- the context of the associated script task- Returns:
- the record as an
Adaptation - See Also:
-
getCurrentRecord
Returns the current workflow record created/modified using the workflow data context variables of the specifiedprocessInstance.This method requires three data context variables to be defined in the workflow to look up the record using its XPath.
workSpacedataSetrecord
- Parameters:
processInstance- a workflow instance- Returns:
- the record as an
Adaptation - See Also:
-
getCurrentDataspace
Returns the dataspace defined in thedataSpacedata context variable as anAdaptationHomein the context of a script task.This method requires the
dataSpacedata context variable to be defined in the workflow.- Parameters:
context- the context of the associated script task- Returns:
- the dataspace as an
AdaptationHome
-
getCurrentWorkspace
Returns the current workflow working workspace in the context of a script task.This method requires the
workSpacedata context variable to be defined in the workflow.- Parameters:
context- the context of the associated script task- Returns:
- the dataspace as an
AdaptationHome
-
getCurrentWorkspace
public static AdaptationHome getCurrentWorkspace(Repository repository, DataContextReadOnly context) Returns the current workflow working workspace utilizing the given data context.This method requires the
workSpacedata context variable to be defined in the workflow.- Parameters:
repository- the repository in which to search for the dataspacecontext- a read-only version of the given data context- Returns:
- the dataspace as an
AdaptationHome
-
getCurrentDataspace
public static AdaptationHome getCurrentDataspace(Repository repository, DataContextReadOnly context) Returns the dataspace defined in thedataSpacedata context variable as anAdaptationHomeutilizing the given data context.This method requires the
dataSpacedata context variable to be defined in the workflow.- Parameters:
repository- the repository in which to search for the dataspacecontext- a read-only version of the given data context- Returns:
- the dataspace as an
AdaptationHome
-
getCurrentDataspace
Returns the dataspace defined in thedataSpacedata context variable as anAdaptationHomein the context of user task creation.This method is used in the context of work items creation (e.g.,
handleCreatemethod ofUserTaskabstract class. It also requires thedataSpacedata context variable to be defined in the workflow.- Parameters:
context- the context of user task creation- Returns:
- the dataspace as an
AdaptationHome
-
getCurrentDataspace
Returns the dataspace defined in theworkSpacedata context variable as anAdaptationHomebefore user task work item completion.This method is used to get the workflow working dataspace before completing the associated work item (i.e., in the
checkBeforeWorkItemCompletionmethod ofUserTaskabstract class. It also requires thedataSpacedata context variable to be defined in the workflow.- Parameters:
context- the context of work item when the user clicks the 'accept' or the 'reject' button- Returns:
- the dataspace as an
AdaptationHome
-
setTrackingInfo
public static void setTrackingInfo(UIHttpManagerComponent httpComp, PublishedProcessKey publishedProcessKey, Adaptation parentRecord) Formats the tracking information of theUIHttpManagerComponentused to access the record update/creation form before a workflow launch.- Parameters:
httpComp- the user interface component to redirect to the work itempublishedProcessKey- the specific publication ID of a process definitionparentRecord- the created/modifed record
-
getParentRecordPkFromTrackingInfo
Parses the tracking information of the session in a workflow context to get the primary key of the created/modified record.- Parameters:
session- the authenticated user session- Returns:
- primary key of the created/modified record as a
String; null otherwise
-
createTechSessionForUser
Creates a technical session for the specified user. The EBX default directory must be overridden to implement authenticateUserFromArray method.- Parameters:
repository- data repository in EBX®user- ID of a specific user- Returns:
- a session with the user corresponding to
useror null if no user can be authenticated
-
getLastUser
Returns the user ID (i.e.,UserReferenceof thelastUserdata context variable in the context of a script task.This method requires the
lastUserdata context variable to be defined in the workflow.- Parameters:
context- script task context- Returns:
- the
UserReferenceof thelastUserdata context variable or null if it's empty
-
getCurrentDataset
public static Adaptation getCurrentDataset(AdaptationHome dataSpaceHome, DataContextReadOnly context) Returns the current dataset, as an adaptation, from the specified workflow data context.This method requires the
dataSetdata context variable to be defined in the workflow.- Parameters:
dataSpaceHome- the dataspace used to find the datasetcontext- a read-only version of the given data context- Returns:
- the dataset as an
Adaptationif it exists; null otherwise
-
getWorkDataspaceLabel
public static String getWorkDataspaceLabel(Session session, PublishedProcessKey publishedProcessKey, AdaptationTable table) Creates the label of the workflow working dataspace (i.e., the created child dataspace). The label has the following format: tableLabel-workflowPublicationName-currentDateTime- Parameters:
session- the authenticated user sessionpublishedProcessKey- the publication ID of the workflowtable- theAdaptationTablewhose label is included in the child dataspace label- Returns:
- the label of the workflow working dataspace (i.e., the created child dataspace)
-
getWorkDataspaceLabelWithCreatorName
public static String getWorkDataspaceLabelWithCreatorName(Repository repository, Session session, PublishedProcessKey publishedProcessKey, AdaptationTable table) Creates the label of the workflow working dataspace (i.e., the created child dataspace). The label has the following format: tableLabel-workflowPublicationName-userWithSalutation(UserId)-currentDateTime- Parameters:
repository- the data repositorysession- the authenticated user sessionpublishedProcessKey- the publication ID of the workflowtable- theAdaptationTablewhose label is included in the child dataspace label- Returns:
- the label of the workflow working dataspace (i.e., the created child dataspace)
-
getUserWithSalutation
public static String getUserWithSalutation(Repository repository, UserReference userReference, Locale locale) Returns the user's label with their salutation.- Parameters:
repository- the data repositoryuserReference- theUserReferenceused for the labellocale- the current locale used for localization- Returns:
- the user ID (usually the login) with salutation if it exists
-
getActiveProcessList
public static List<ProcessInstanceKey> getActiveProcessList(PublishedProcessKey publishedProcessKey, String dataContextKey, String variableValue, Repository repository, Session session) Retrieves active processes that have the value of the dataContextKey variable equals tovariableValue.- Parameters:
publishedProcessKey- the publication ID of the workflowdataContextKey- the data context variable namevariableValue- the data context variable value to check forrepository- the data repositorysession- the authenticated user session- Returns:
- a list of process instance keys for active processes where the value of
datacontextKeyvariable is equal tovariableValue; returns an empty list if none are found.
-
displayUserUpdateAlreadyOngoingErrorMessage
public static String displayUserUpdateAlreadyOngoingErrorMessage(List<ProcessInstanceKey> processInstanceKeyList, Locale locale, Repository repository, Session session) Displays a page indicating that there is an ongoing process associated with the record, along with a list of users currently holding processes.- Parameters:
processInstanceKeyList- the list of process instance keys to checklocale- the current locale used for localizationrepository- the data repositorysession- the authenticated user session- Returns:
- a message indicating the ongoing process related to the record, including the list of users holding processes; returns null if no ongoing processes are found.
-