Class WorkflowUtils
- Author:
- APGAR Consulting
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.orchestranetworks.service.SessioncreateTechSessionForUser(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.service.UserReference user) Creates a technical session for the specified user.static StringdisplayUserUpdateAlreadyOngoingErrorMessage(List<com.orchestranetworks.workflow.ProcessInstanceKey> processInstanceKeyList, Locale locale, com.orchestranetworks.instance.Repository repository, com.orchestranetworks.service.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<com.orchestranetworks.workflow.ProcessInstanceKey>getActiveProcessList(com.orchestranetworks.workflow.PublishedProcessKey publishedProcessKey, String dataContextKey, String variableValue, com.orchestranetworks.instance.Repository repository, com.orchestranetworks.service.Session session) Retrieves active processes that have the value of the dataContextKey variable equals tovariableValue.static com.onwbp.adaptation.AdaptationgetCurrentDataset(com.onwbp.adaptation.AdaptationHome dataSpaceHome, com.orchestranetworks.workflow.DataContextReadOnly context) Returns the current dataset, as an adaptation, from the specified workflow data context.static com.onwbp.adaptation.AdaptationHomegetCurrentDataspace(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.workflow.DataContextReadOnly context) Returns the dataspace defined in thedataSpacedata context variable as anAdaptationHomeutilizing the given data context.static com.onwbp.adaptation.AdaptationHomegetCurrentDataspace(com.orchestranetworks.workflow.ScriptTaskContext context) Returns the dataspace defined in thedataSpacedata context variable as anAdaptationHomein the context of a script task.static com.onwbp.adaptation.AdaptationHomegetCurrentDataspace(com.orchestranetworks.workflow.UserTaskBeforeWorkItemCompletionContext context) Returns the dataspace defined in theworkSpacedata context variable as anAdaptationHomebefore user task work item completion.static com.onwbp.adaptation.AdaptationHomegetCurrentDataspace(com.orchestranetworks.workflow.UserTaskCreationContext context) Returns the dataspace defined in thedataSpacedata context variable as anAdaptationHomein the context of user task creation.static com.onwbp.adaptation.AdaptationgetCurrentRecord(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.workflow.DataContextReadOnly context) Retrieves the record as anAdaptationfrom the workflow context (i.e, the child dataspace created for the workflow instance) using its XPath.static com.onwbp.adaptation.AdaptationgetCurrentRecord(com.orchestranetworks.workflow.ProcessInstance processInstance) Returns the current workflow record created/modified using the workflow data context variables of the specifiedprocessInstance.static com.onwbp.adaptation.AdaptationgetCurrentRecord(com.orchestranetworks.workflow.ScriptTaskContext context) Returns the current workflow record created/modified using the workflow data context variables for the specified script task.static com.onwbp.adaptation.AdaptationgetCurrentRecord(com.orchestranetworks.workflow.UserTaskBeforeWorkItemCompletionContext context) Returns the current workflow record created/modified using the workflow data context variables before work item completion.static com.onwbp.adaptation.AdaptationgetCurrentRecord(com.orchestranetworks.workflow.UserTaskCreationContext context) Returns the current workflow record created/modified using the workflow data context variables when handling work item creation.static com.onwbp.adaptation.AdaptationgetCurrentRecord(com.orchestranetworks.workflow.UserTaskWorkItemCompletionContext context) Returns the current workflow record created/modified using the workflow data context variables when handling work item completion.static com.onwbp.adaptation.AdaptationHomegetCurrentWorkspace(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.workflow.DataContextReadOnly context) Returns the current workflow working workspace utilizing the given data context.static com.onwbp.adaptation.AdaptationHomegetCurrentWorkspace(com.orchestranetworks.workflow.ScriptTaskContext context) Returns the current workflow working workspace in the context of a script task.static com.orchestranetworks.service.UserReferencegetLastUser(com.orchestranetworks.workflow.ScriptTaskContext context) Returns the user ID (i.e.,UserReferenceof thelastUserdata context variable in the context of a script task.static StringgetParentRecordPkFromTrackingInfo(com.orchestranetworks.service.Session session) Parses the tracking information of the session in a workflow context to get the primary key of the created/modified record.static com.orchestranetworks.workflow.PublishedProcessKeygetPublishProcessKey(com.orchestranetworks.workflow.DataContext dataContext) Returns thePublishedProcessKeyfrom the specifieddata context.static com.onwbp.adaptation.AdaptationgetRecord(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.workflow.DataContextReadOnly context, String recordVariableName) Retrieves the record as anAdaptationfrom the specified workflow data context using the XPath defined in therecordVariableNamedata context variable.static com.onwbp.adaptation.AdaptationRetrieves the record as anAdaptationfrom the dataspace specified in thedataSpacedata context variable using the givenrecordXPath.static StringgetUserWithSalutation(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.service.UserReference userReference, Locale locale) Returns the user's label with their salutation.static StringgetWorkDataspaceLabel(com.orchestranetworks.service.Session session, com.orchestranetworks.workflow.PublishedProcessKey publishedProcessKey, com.onwbp.adaptation.AdaptationTable table) Creates the label of the workflow working dataspace (i.e., the created child dataspace).static StringgetWorkDataspaceLabelWithCreatorName(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.service.Session session, com.orchestranetworks.workflow.PublishedProcessKey publishedProcessKey, com.onwbp.adaptation.AdaptationTable table) Creates the label of the workflow working dataspace (i.e., the created child dataspace).static booleanisInWorkflowContext(com.orchestranetworks.interactions.InteractionHelper.ParametersMap inputParms, com.orchestranetworks.workflow.PublishedProcessKey publishedProcessKey) Determines whether the specified interaction is in the context of the workflow with the givenpublishedProcessKey, usinginputParams.static booleanisInWorkflowContext(com.orchestranetworks.service.Session session) Determines whether the givensessionis within a workflow context.static booleanisInWorkflowContext(com.orchestranetworks.service.Session session, com.orchestranetworks.workflow.PublishedProcessKey publishedProcessKey) Determines whether the session is in the context of the workflow with the specifiedpublishedProcessKey.static booleanisInWorkflowContext(com.orchestranetworks.service.Session session, String workflowName) Determines whether the session is in the context of the specified workflow.static booleanisNewOccurence(com.onwbp.adaptation.Adaptation record) Determines whether the specifiedrecordwas created during the workflow instance in the child dataspace.static voidsetTrackingInfo(com.orchestranetworks.ui.UIHttpManagerComponent httpComp, com.orchestranetworks.workflow.PublishedProcessKey publishedProcessKey, com.onwbp.adaptation.Adaptation parentRecord) Formats the tracking information of theUIHttpManagerComponentused to access the record update/creation form before a workflow launch.
-
Method Details
-
isInWorkflowContext
public static boolean isInWorkflowContext(com.orchestranetworks.service.Session session) 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(com.orchestranetworks.interactions.InteractionHelper.ParametersMap inputParms, com.orchestranetworks.workflow.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
public static boolean isInWorkflowContext(com.orchestranetworks.service.Session session, com.orchestranetworks.workflow.PublishedProcessKey publishedProcessKey) 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
public static boolean isInWorkflowContext(com.orchestranetworks.service.Session session, String workflowName) 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
public static boolean isNewOccurence(com.onwbp.adaptation.Adaptation record) 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
public static com.orchestranetworks.workflow.PublishedProcessKey getPublishProcessKey(com.orchestranetworks.workflow.DataContext dataContext) 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
public static com.onwbp.adaptation.Adaptation getCurrentRecord(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.workflow.DataContextReadOnly context) 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
public static com.onwbp.adaptation.Adaptation getRecord(com.orchestranetworks.workflow.UserTaskCreationContext context, String recordXPath) 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 com.onwbp.adaptation.Adaptation getRecord(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.workflow.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
public static com.onwbp.adaptation.Adaptation getCurrentRecord(com.orchestranetworks.workflow.UserTaskWorkItemCompletionContext context) 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
public static com.onwbp.adaptation.Adaptation getCurrentRecord(com.orchestranetworks.workflow.UserTaskCreationContext context) 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
public static com.onwbp.adaptation.Adaptation getCurrentRecord(com.orchestranetworks.workflow.UserTaskBeforeWorkItemCompletionContext context) 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
public static com.onwbp.adaptation.Adaptation getCurrentRecord(com.orchestranetworks.workflow.ScriptTaskContext context) 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
public static com.onwbp.adaptation.Adaptation getCurrentRecord(com.orchestranetworks.workflow.ProcessInstance processInstance) 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
public static com.onwbp.adaptation.AdaptationHome getCurrentDataspace(com.orchestranetworks.workflow.ScriptTaskContext context) 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
public static com.onwbp.adaptation.AdaptationHome getCurrentWorkspace(com.orchestranetworks.workflow.ScriptTaskContext context) 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 com.onwbp.adaptation.AdaptationHome getCurrentWorkspace(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.workflow.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 com.onwbp.adaptation.AdaptationHome getCurrentDataspace(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.workflow.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
public static com.onwbp.adaptation.AdaptationHome getCurrentDataspace(com.orchestranetworks.workflow.UserTaskCreationContext context) 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
public static com.onwbp.adaptation.AdaptationHome getCurrentDataspace(com.orchestranetworks.workflow.UserTaskBeforeWorkItemCompletionContext context) 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(com.orchestranetworks.ui.UIHttpManagerComponent httpComp, com.orchestranetworks.workflow.PublishedProcessKey publishedProcessKey, com.onwbp.adaptation.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
public static String getParentRecordPkFromTrackingInfo(com.orchestranetworks.service.Session session) 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
public static com.orchestranetworks.service.Session createTechSessionForUser(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.service.UserReference user) 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
public static com.orchestranetworks.service.UserReference getLastUser(com.orchestranetworks.workflow.ScriptTaskContext context) 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 com.onwbp.adaptation.Adaptation getCurrentDataset(com.onwbp.adaptation.AdaptationHome dataSpaceHome, com.orchestranetworks.workflow.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(com.orchestranetworks.service.Session session, com.orchestranetworks.workflow.PublishedProcessKey publishedProcessKey, com.onwbp.adaptation.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(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.service.Session session, com.orchestranetworks.workflow.PublishedProcessKey publishedProcessKey, com.onwbp.adaptation.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(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.service.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<com.orchestranetworks.workflow.ProcessInstanceKey> getActiveProcessList(com.orchestranetworks.workflow.PublishedProcessKey publishedProcessKey, String dataContextKey, String variableValue, com.orchestranetworks.instance.Repository repository, com.orchestranetworks.service.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<com.orchestranetworks.workflow.ProcessInstanceKey> processInstanceKeyList, Locale locale, com.orchestranetworks.instance.Repository repository, com.orchestranetworks.service.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.
-