Package com.sas.lsaf.workflow.processflow

## Interface ProcessFlowService

-     public interface ProcessFlowService

  The service that contains methods to manage process flows.

  A process flow is a collection of tasks and elements that can be assigned or executed based on the underlying process flow definition. A process flow is identified by a name and context. It is associated with and scoped to a context in which it is defined. Examples of a process flow context are organization, project, and analysis.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ProcessFlow` | `activateProcessFlow​(java.lang.String id)` | Activates the specified process flow.
    `void` | `clearSearchResults()` | Releases any cached information about the query that is associated with the current search.
    `ProcessFlow` | `copyProcessFlow​(ProcessFlowCopyInfo copyInfo)` | Copies the process flow with the specified source process flow identifier.
    `ProcessFlow` | `createProcessFlow​(java.lang.String contextId, java.lang.String processFlowName, java.lang.String processDefinitionKey)` | Creates a process flow at the specified context using the latest deployed version of the process flow definition.
    `java.lang.String` | `createProcessFlowManifest​(java.lang.String id, FileCreateInfo manifestFileCreateInfo)` | Creates a process flow manifest file for the process flow with the identifier in the repository.
    `void` | `deleteProcessFlow​(java.lang.String id)` | Deletes the process flow with the specified identifier.
    `boolean` | `exists​(java.lang.String contextId, java.lang.String processFlowName)` | Indicates whether the process flow with the specified name exists at the context.
    `java.util.Set<ProcessFlowDescriptor>` | `getAllProcessFlowDescriptors()` | Gets all process flows that the user is authorized to view.
    `java.util.Set<ProcessFlowDescriptor>` | `getMyProcessFlowDescriptors()` | Gets all of the process flows that the user is authorized to view.
    `java.util.Set<ProcessFlowDescriptor>` | `getMyProcessFlowDescriptorsByContext​(java.lang.String contextId, boolean includeChildren)` | Gets all of the process flows that are owned by the current user at a context, and (optionally) below.
    `ProcessFlow` | `getProcessFlowById​(java.lang.String id)` | Gets the process flow with the specified identifier.
    `ProcessFlow` | `getProcessFlowByNameAndContext​(java.lang.String contextId, java.lang.String processFlowName)` | Gets the process flow with the specified name at the specified context.
    `java.util.Set<ProcessFlowDescriptor>` | `getProcessFlowDescriptorsByContext​(java.lang.String contextId, boolean includeChildren)` | Gets the process flows at the context and (optionally) below.
    `int` | `getSearchPageSizeLimit()` | Gets the maximum number of process flow results to return in a single request.
    `java.util.List<ProcessFlowSearchResultItem>` | `getSearchResults​(int fromRow, int toRow)` | Gets a range of results after calling `search(ProcessFlowQuery)`.
    `SearchResultsInfo` | `search​(ProcessFlowQuery query)` | Searches the process flows based on the specified query.
    `ProcessFlow` | `suspendProcessFlow​(java.lang.String id)` | Suspends the specified process flow.
    `ProcessFlow` | `updateProcessFlow​(ProcessFlow processFlow)` | Updates the process flow.

- - ### Method Detail

    - #### getProcessFlowDescriptorsByContext

          java.util.Set<ProcessFlowDescriptor> getProcessFlowDescriptorsByContext​(java.lang.String contextId,
                                                                                  boolean includeChildren)
                                                                           throws ProcessFlowContextNotFoundException

      Gets the process flows at the context and (optionally) below. This method requires the current user to have read access to the context. The current user must have either the Manage Process Flows privilege or the Administer Process Flows privilege to see the process flows that are owned by others. If the user does not have either of these privileges, only process flows that the user owns are returned. If the context does not exist, an empty set is returned.
      Parameters:
        `contextId` - The identifier of the context.
        `includeChildren` - Indicates whether to retrieve the process flows for the context's children.
      Returns:
        A set of process flows.
      Throws:
        `ProcessFlowNotFoundException` - Thrown when a process flow does not exist at the specified context.
        `ProcessFlowContextNotFoundException`

    - #### getAllProcessFlowDescriptors

          java.util.Set<ProcessFlowDescriptor> getAllProcessFlowDescriptors()

      Gets all process flows that the user is authorized to view.
      Returns:
        A set of process flows.

    - #### getMyProcessFlowDescriptors

          java.util.Set<ProcessFlowDescriptor> getMyProcessFlowDescriptors()

      Gets all of the process flows that the user is authorized to view.
      Returns:
        A set of process flows.

    - #### getMyProcessFlowDescriptorsByContext

          java.util.Set<ProcessFlowDescriptor> getMyProcessFlowDescriptorsByContext​(java.lang.String contextId,
                                                                                    boolean includeChildren)
                                                                             throws ProcessFlowContextNotFoundException

      Gets all of the process flows that are owned by the current user at a context, and (optionally) below. This method requires that the current user have Read access to the context. If the context does not exist, an empty set is returned.
      Parameters:
        `contextId` - The identifier of the context.
        `includeChildren` - Indicates whether the context children's process flows are retrieved.
      Returns:
        A set of ProcessFlowDescriptor objects.
      Throws:
        `ProcessFlowContextNotFoundException`

    - #### exists

          boolean exists​(java.lang.String contextId,
                         java.lang.String processFlowName)

      Indicates whether the process flow with the specified name exists at the context. Returns True, if the process flow exists and the user is authorized to view the process flow.
      Parameters:
        `contextId` - The identifier of context.
        `processFlowName` - The name of the process flow.
      Returns:
        True, if the process flow exists and the user is authorized to view the process flow, False otherwise.

    - #### getProcessFlowByNameAndContext

          ProcessFlow getProcessFlowByNameAndContext​(java.lang.String contextId,
                                                     java.lang.String processFlowName)
                                              throws ProcessFlowNotFoundException

      Gets the process flow with the specified name at the specified context.
      Parameters:
        `contextId` - The identifier of the context.
        `processFlowName` - The name of the process flow.
      Returns:
        The process flow.
      Throws:
        `ProcessFlowNotFoundException` - Thrown when a process flow with the specified name does not exist at the specified context.

    - #### getProcessFlowById

          ProcessFlow getProcessFlowById​(java.lang.String id)
                                  throws ProcessFlowNotFoundException,
                                         ProcessFlowException

      Gets the process flow with the specified identifier.
      Parameters:
        `id` - The identifier of the process flow.
      Returns:
        The process flow.
      Throws:
        `ProcessFlowNotFoundException` - Thrown when a process flow with the identifier does not exist.
        `ProcessFlowException` - Thrown when there is an issue when getting the process flow.

    - #### createProcessFlow

          ProcessFlow createProcessFlow​(java.lang.String contextId,
                                        java.lang.String processFlowName,
                                        java.lang.String processDefinitionKey)
                                 throws ProcessFlowExistsException,
                                        ProcessDefinitionNotFoundException,
                                        ProcessFlowContextNotFoundException

      Creates a process flow at the specified context using the latest deployed version of the process flow definition.
      Parameters:
        `contextId` - The identifier of the context in which to create the process flow.
        `processFlowName` - The name of the process flow.
        `processDefinitionKey` - The key of the process flow definition. This is the id value in the process flow definition file.
      Returns:
        The created process flow.
      Throws:
        `ProcessFlowExistsException` - Thrown when a process flow with the name exists in the context.
        `ProcessDefinitionNotFoundException` - Thrown when a deployed process flow definition does not exist with the identifier in the context.
        `ProcessFlowContextNotFoundException` - Thrown when the process flow context does not exist.

    - #### updateProcessFlow

          ProcessFlow updateProcessFlow​(ProcessFlow processFlow)
                                 throws ProcessFlowNotFoundException,
                                        InvalidProcessFlowStateException,
                                        ProcessFlowException,
                                        ProcessFlowExistsException

      Updates the process flow.
      Parameters:
        `processFlow` - The process flow.
      Returns:
        The updated process flow.
      Throws:
        `ProcessFlowNotFoundException` - Thrown when a process flow with the identifier does not exist.
        `InvalidProcessFlowStateException` - Thrown when the process flow is in an invalid state to update the process flow.
        `ProcessFlowException` - Thrown when there is an issue when updating the process flow.
        `ProcessFlowExistsException` - Thrown when a process flow with the name exists at the context.

    - #### deleteProcessFlow

          void deleteProcessFlow​(java.lang.String id)
                          throws ProcessFlowNotFoundException,
                                 ProcessFlowException

      Deletes the process flow with the specified identifier.
      Parameters:
        `id` - The identifier of the process flow.
      Throws:
        `ProcessFlowNotFoundException` - Thrown when a process flow with the identifier does not exist at the context.
        `ProcessFlowException` - Thrown when there is an issue when deleting the process flow.

    - #### createProcessFlowManifest

          java.lang.String createProcessFlowManifest​(java.lang.String id,
                                                     FileCreateInfo manifestFileCreateInfo)
                                              throws ProcessFlowNotFoundException,
                                                     ProcessFlowManifestCreateException,
                                                     ProcessFlowException

      Creates a process flow manifest file for the process flow with the identifier in the repository.
      Parameters:
        `id` - The identifier of the process flow.
        `manifestFileCreateInfo` - The method to add the new process flow manifest file (such as major version or minor version). Specifying null defaults to a major version.
      Returns:
        The path to the process flow manifest file.
      Throws:
        `ProcessFlowNotFoundException` - Thrown when a process flow with the identifier does not exist at the context.
        `ProcessFlowManifestCreateException` - Thrown when there is an issue when creating a process flow manifest file.
        `ProcessFlowException` - Thrown when there is an issue when creating the process flow manifest file.

    - #### activateProcessFlow

          ProcessFlow activateProcessFlow​(java.lang.String id)
                                   throws ProcessFlowNotFoundException,
                                          ProcessFlowException

      Activates the specified process flow.
      Parameters:
        `id` - The identifier of the process flow.
      Returns:
        The activated process flow.
      Throws:
        `ProcessFlowNotFoundException` - Thrown when a process flow with the identifier does not exist.
        `ProcessFlowException` - Thrown when there is an issue when activating the process flow.

    - #### suspendProcessFlow

          ProcessFlow suspendProcessFlow​(java.lang.String id)
                                  throws ProcessFlowNotFoundException,
                                         ProcessFlowException

      Suspends the specified process flow. If any job tasks are running at the time of the suspension, they are cancelled.
      Parameters:
        `id` - The identifier of the process flow.
      Returns:
        The suspended process flow.
      Throws:
        `ProcessFlowNotFoundException` - Thrown when a process flow with the identifier does not exist.
        `ProcessFlowException` - Thrown when there is an issue when suspending the process flow.

    - #### copyProcessFlow

          ProcessFlow copyProcessFlow​(ProcessFlowCopyInfo copyInfo)
                               throws ProcessFlowNotFoundException,
                                      ProcessFlowExistsException,
                                      ProcessFlowCopyException

      Copies the process flow with the specified source process flow identifier. A new name must be specified. Other copy options include whether to activate the process flow when copied and whether to include the source process flow's process data and attachments.
      Parameters:
        `copyInfo` - The options and details needed to copy a process flow.
      Returns:
        The copied process flow.
      Throws:
        `ProcessFlowNotFoundException` - Thrown when a process flow with the identifier does not exist.
        `ProcessFlowExistsException` - Thrown when a process flow with the name exists in the context.
        `ProcessFlowCopyException` - Thrown when there is an issue when copying the process flow.

    - #### search

          SearchResultsInfo search​(ProcessFlowQuery query)
                            throws ProcessFlowSearchException

      Searches the process flows based on the specified query. The returned results information contains the row count in which to request pageable lists of process flows by calling `getSearchResults(int, int)`. When the results are no longer required, call `clearSearchResults()` to release any server-side resources related with the query.

      Note: Only one query can be active at a time for each client. The results that are generated for the query can be used to iterate through the results by calling `getSearchResults(int, int)`. But if the same client calls this method again, a new set of results is generated and the previous results are no longer valid.

      Parameters:
        `query` - The criteria to query process flows.
      Returns:
        The results of a process flow search.
      Throws:
        `ProcessFlowSearchException` - Thrown when there is an issue when searching process flows.

    - #### getSearchResults

          java.util.List<ProcessFlowSearchResultItem> getSearchResults​(int fromRow,
                                                                       int toRow)
                                                                throws ProcessFlowSearchException

      Gets a range of results after calling `search(ProcessFlowQuery)`. The `from row` and `to row` values must be between 1 and the total rows that are retrieved by the query. This is considered a `page` of results, and therefore, a `pageable` results model.

      Note: The maximum number of records that can be returned for a single page is available by calling `getSearchPageSizeLimit()`. The default maximum is 5000.

      Parameters:
        `fromRow` - The starting row number to include in the results. The value must be greater than 0.
        `toRow` - The ending row number to include in the results. The value must be less than or equal to the total row count. The total number that is retrieved must be less than or equal to the page size limit.
      Returns:
        The list of process flow items that satisfy the query and the rows that are specified.
      Throws:
        `ProcessFlowSearchException` - Thrown when there is an issue when searching process flows.

    - #### clearSearchResults

          void clearSearchResults()

      Releases any cached information about the query that is associated with the current search. This must be called once in a `finally` block for each call to `search(ProcessFlowQuery)`. If the results no longer exist when this method is called, then this method returns without further action.

    - #### getSearchPageSizeLimit

          int getSearchPageSizeLimit()

      Gets the maximum number of process flow results to return in a single request. The default is 5000.
      Returns:
        The page size limit.