Class WorkflowUtils

java.lang.Object
com.apgar.common.lib.utils.WorkflowUtils

public class WorkflowUtils extends Object
Workflow Utility class
Author:
APGAR Consulting
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.orchestranetworks.service.Session
    createTechSessionForUser(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.service.UserReference user)
    Creates a technical session for the specified user.
    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.
    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 to variableValue.
    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.
    static com.onwbp.adaptation.AdaptationHome
    getCurrentDataspace(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.workflow.DataContextReadOnly context)
    Returns the dataspace defined in the dataSpace data context variable as an AdaptationHome utilizing the given data context.
    static com.onwbp.adaptation.AdaptationHome
    getCurrentDataspace(com.orchestranetworks.workflow.ScriptTaskContext context)
    Returns the dataspace defined in the dataSpace data context variable as an AdaptationHome in the context of a script task.
    static com.onwbp.adaptation.AdaptationHome
    getCurrentDataspace(com.orchestranetworks.workflow.UserTaskBeforeWorkItemCompletionContext context)
    Returns the dataspace defined in the workSpace data context variable as an AdaptationHome before user task work item completion.
    static com.onwbp.adaptation.AdaptationHome
    getCurrentDataspace(com.orchestranetworks.workflow.UserTaskCreationContext context)
    Returns the dataspace defined in the dataSpace data context variable as an AdaptationHome in the context of user task creation.
    static com.onwbp.adaptation.Adaptation
    getCurrentRecord(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.workflow.DataContextReadOnly context)
    Retrieves the record as an Adaptation from the workflow context (i.e, the child dataspace created for the workflow instance) using its XPath.
    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 specified processInstance.
    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.
    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.
    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.
    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.
    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.
    static com.onwbp.adaptation.AdaptationHome
    getCurrentWorkspace(com.orchestranetworks.workflow.ScriptTaskContext context)
    Returns the current workflow working workspace in the context of a script task.
    static com.orchestranetworks.service.UserReference
    getLastUser(com.orchestranetworks.workflow.ScriptTaskContext context)
    Returns the user ID (i.e., UserReference of the lastUser data context variable in the context of a script task.
    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.
    static com.orchestranetworks.workflow.PublishedProcessKey
    getPublishProcessKey(com.orchestranetworks.workflow.DataContext dataContext)
    Returns the PublishedProcessKey from the specified data context.
    static com.onwbp.adaptation.Adaptation
    getRecord(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.workflow.DataContextReadOnly context, String recordVariableName)
    Retrieves the record as an Adaptation from the specified workflow data context using the XPath defined in the recordVariableName data context variable.
    static com.onwbp.adaptation.Adaptation
    getRecord(com.orchestranetworks.workflow.UserTaskCreationContext context, String recordXPath)
    Retrieves the record as an Adaptation from the dataspace specified in the dataSpace data context variable using the given recordXPath.
    static String
    getUserWithSalutation(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.service.UserReference userReference, Locale locale)
    Returns the user's label with their salutation.
    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).
    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).
    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 given publishedProcessKey, using inputParams.
    static boolean
    isInWorkflowContext(com.orchestranetworks.service.Session session)
    Determines whether the given session is within a workflow context.
    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 specified publishedProcessKey.
    static boolean
    isInWorkflowContext(com.orchestranetworks.service.Session session, String workflowName)
    Determines whether the session is in the context of the specified workflow.
    static boolean
    isNewOccurence(com.onwbp.adaptation.Adaptation record)
    Determines whether the specified record was created during the workflow instance in the child dataspace.
    static void
    setTrackingInfo(com.orchestranetworks.ui.UIHttpManagerComponent httpComp, com.orchestranetworks.workflow.PublishedProcessKey publishedProcessKey, com.onwbp.adaptation.Adaptation parentRecord)
    Formats the tracking information of the UIHttpManagerComponent used to access the record update/creation form before a workflow launch.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isInWorkflowContext

      public static boolean isInWorkflowContext(com.orchestranetworks.service.Session session)
      Determines whether the given session is within a workflow context.
      Parameters:
      session - the authenticated user session
      Returns:
      true if the session is passed in a workflow context; false otherwise
    • 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 given publishedProcessKey, using inputParams.
      Parameters:
      inputParms - input parameters of a given interaction
      publishedProcessKey - a specific publication ID of a process definition
      Returns:
      true if the interaction is in the context of the workflow with the specified publishedProcessKey; false otherwise
    • 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 specified publishedProcessKey.
      Parameters:
      session - the authenticated user session
      publishedProcessKey - a specific publication ID of a process definition
      Returns:
      true if the session is passed in the workflow belonging to the specified publishedProcessKey; false otherwise
    • 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 session
      workflowName - the name of the workflow
      Returns:
      true if the session is in the context of the workflow with workflowName name; false otherwise
    • isNewOccurence

      public static boolean isNewOccurence(com.onwbp.adaptation.Adaptation record)
      Determines whether the specified record was created during the workflow instance in the child dataspace.
      Parameters:
      record - the record to evaluate
      Returns:
      true if the record was created during the workflow instance (i.e., not in the main dataspace); false otherwise
    • getPublishProcessKey

      public static com.orchestranetworks.workflow.PublishedProcessKey getPublishProcessKey(com.orchestranetworks.workflow.DataContext dataContext)
      Returns the PublishedProcessKey from the specified data 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 an Adaptation from 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.

      • workSpace
      • dataSet
      • record
      Parameters:
      repository - the repository in which to search for the record
      context - 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 an Adaptation from the dataspace specified in the dataSpace data context variable using the given recordXPath.

      This method is used in the context of work items creation (e.g., handleCreate method of UserTask abstract class.

      This method requires two data context variables to be defined in the workflow to look up the record using its XPath.

      • dataSpace
      • dataSet
      Parameters:
      context - the user task creation context
      recordXPath - 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 an Adaptation from the specified workflow data context using the XPath defined in the recordVariableName data context variable.

      This method requires three data context variables to be defined in the workflow to look up the record using its XPath.

      • workSpace
      • dataSet
      • specified recordVariableName
      Parameters:
      repository - the repository in which to search for the record
      context - a read-only version of the given data context
      recordVariableName - 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., handleWorkItemCompletion method of UserTask abstract class.

      This method requires three data context variables to be defined in the workflow to look up the record using its XPath.

      • workSpace
      • dataSet
      • record
      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., handleCreate method of UserTask abstract class.

      This method requires three data context variables to be defined in the workflow to look up the record using its XPath.

      • workSpace
      • dataSet
      • record
      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 checkBeforeWorkItemCompletion method of UserTask abstract class.

      This method requires three data context variables to be defined in the workflow to look up the record using its XPath.

      • workSpace
      • dataSet
      • record
      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.

      • workSpace
      • dataSet
      • record
      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 specified processInstance.

      This method requires three data context variables to be defined in the workflow to look up the record using its XPath.

      • workSpace
      • dataSet
      • record
      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 the dataSpace data context variable as an AdaptationHome in the context of a script task.

      This method requires the dataSpace data 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 workSpace data 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 workSpace data context variable to be defined in the workflow.

      Parameters:
      repository - the repository in which to search for the dataspace
      context - 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 the dataSpace data context variable as an AdaptationHome utilizing the given data context.

      This method requires the dataSpace data context variable to be defined in the workflow.

      Parameters:
      repository - the repository in which to search for the dataspace
      context - 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 the dataSpace data context variable as an AdaptationHome in the context of user task creation.

      This method is used in the context of work items creation (e.g., handleCreate method of UserTask abstract class. It also requires the dataSpace data 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 the workSpace data context variable as an AdaptationHome before 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 checkBeforeWorkItemCompletion method of UserTask abstract class. It also requires the dataSpace data 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 the UIHttpManagerComponent used to access the record update/creation form before a workflow launch.
      Parameters:
      httpComp - the user interface component to redirect to the work item
      publishedProcessKey - the specific publication ID of a process definition
      parentRecord - 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 user or 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., UserReference of the lastUser data context variable in the context of a script task.

      This method requires the lastUser data context variable to be defined in the workflow.

      Parameters:
      context - script task context
      Returns:
      the UserReference of the lastUser data 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 dataSet data context variable to be defined in the workflow.

      Parameters:
      dataSpaceHome - the dataspace used to find the dataset
      context - a read-only version of the given data context
      Returns:
      the dataset as an Adaptation if 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 session
      publishedProcessKey - the publication ID of the workflow
      table - the AdaptationTable whose 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 repository
      session - the authenticated user session
      publishedProcessKey - the publication ID of the workflow
      table - the AdaptationTable whose 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 repository
      userReference - the UserReference used for the label
      locale - 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 to variableValue.
      Parameters:
      publishedProcessKey - the publication ID of the workflow
      dataContextKey - the data context variable name
      variableValue - the data context variable value to check for
      repository - the data repository
      session - the authenticated user session
      Returns:
      a list of process instance keys for active processes where the value of datacontextKey variable is equal to variableValue; 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 check
      locale - the current locale used for localization
      repository - the data repository
      session - 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.