Interface WorkflowComponent

  • All Known Subinterfaces:
    WorkflowEngine
    All Known Implementing Classes:
    ActivitiWorkflowEngine

    public interface WorkflowComponent
    SPI to be implemented by a BPM Engine that provides Workflow instance management.
    Author:
    davidc
    • Method Detail

      • deployDefinition

        WorkflowDeployment deployDefinition​(java.io.InputStream workflowDefinition,
                                            java.lang.String mimetype)
        Deploy a Workflow Definition
        Parameters:
        workflowDefinition - the content object containing the definition
        mimetype - (optional) the mime type of the workflow definition
        Returns:
        workflow deployment descriptor
      • deployDefinition

        WorkflowDeployment deployDefinition​(java.io.InputStream workflowDefinition,
                                            java.lang.String mimetype,
                                            java.lang.String name)
        Deploy a Workflow Definition
        Parameters:
        workflowDefinition - the content object containing the definition
        mimetype - (optional) the mime type of the workflow definition
        name - (optional) a name to represent the deployment
        Returns:
        workflow deployment descriptor
        Since:
        4.0
      • isDefinitionDeployed

        boolean isDefinitionDeployed​(java.io.InputStream workflowDefinition,
                                     java.lang.String mimetype)
        Is the specified Workflow Definition already deployed? Note: the notion of "already deployed" may differ between bpm engines. For example, different versions of the same process may be considered equal.
        Parameters:
        workflowDefinition - the definition to check
        mimetype - the mimetype of the definition
        Returns:
        true => already deployed
      • undeployDefinition

        void undeployDefinition​(java.lang.String workflowDefinitionId)
        Undeploy an exisiting Workflow Definition TODO: Determine behaviour when "in-flight" workflow instances exist
        Parameters:
        workflowDefinitionId - the id of the definition to undeploy
      • getDefinitions

        java.util.List<WorkflowDefinition> getDefinitions()
        Gets all deployed Workflow Definitions
        Returns:
        the deployed workflow definitions
      • getAllDefinitions

        @Auditable
        java.util.List<WorkflowDefinition> getAllDefinitions()
        Gets all deployed Workflow Definitions (with all previous versions)
        Returns:
        the deployed (and previous) workflow definitions
      • getDefinitionById

        WorkflowDefinition getDefinitionById​(java.lang.String workflowDefinitionId)
        Gets a Workflow Definition by unique Id
        Parameters:
        workflowDefinitionId - the workflow definition id
        Returns:
        the deployed workflow definition
      • getDefinitionByName

        WorkflowDefinition getDefinitionByName​(java.lang.String workflowName)
        Gets a Workflow Definition by unique name
        Parameters:
        workflowName - workflow name e.g. activiti$activitiReview
        Returns:
        the deployed workflow definition
      • getAllDefinitionsByName

        @Auditable(parameters="workflowName")
        java.util.List<WorkflowDefinition> getAllDefinitionsByName​(java.lang.String workflowName)
        Gets all (including previous) Workflow Definitions for the given unique name
        Parameters:
        workflowName - workflow name e.g. activiti$activitiReview
        Returns:
        the deployed workflow definition (or null if not found)
      • getDefinitionImage

        @Auditable(parameters="workflowDefinitionId")
        byte[] getDefinitionImage​(java.lang.String workflowDefinitionId)
        Gets a graphical view of the Workflow Definition
        Parameters:
        workflowDefinitionId - the workflow definition id
        Returns:
        graphical image of workflow definition
      • getTaskDefinitions

        @Auditable(parameters="workflowDefinitionId")
        java.util.List<WorkflowTaskDefinition> getTaskDefinitions​(java.lang.String workflowDefinitionId)
        Gets the Task Definitions for the given Workflow Definition
        Parameters:
        workflowDefinitionId - the workflow definition id
        Returns:
        the deployed task definitions (or null if not found)
      • startWorkflow

        WorkflowPath startWorkflow​(java.lang.String workflowDefinitionId,
                                   java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> parameters)
        Start a Workflow Instance
        Parameters:
        workflowDefinitionId - the workflow definition id
        parameters - the initial set of parameters used to populate the "Start Task" properties
        Returns:
        the initial workflow path
      • getActiveWorkflows

        java.util.List<WorkflowInstance> getActiveWorkflows​(java.lang.String workflowDefinitionId)
        Gets all "in-flight" active workflow instances of the specified Workflow Definition
        Parameters:
        workflowDefinitionId - the workflow definition id
        Returns:
        the list of "in-flight" workflow instances
      • getCompletedWorkflows

        java.util.List<WorkflowInstance> getCompletedWorkflows​(java.lang.String workflowDefinitionId)
        Gets all "in-flight" completed workflow instances of the specified Workflow Definition
        Parameters:
        workflowDefinitionId - the workflow definition id
        Returns:
        the list of "in-flight" workflow instances
      • getWorkflows

        java.util.List<WorkflowInstance> getWorkflows​(java.lang.String workflowDefinitionId)
        Gets all "in-flight" workflow instances (both active and completed) of the specified Workflow Definition
        Parameters:
        workflowDefinitionId - the workflow definition id
        Returns:
        the list of "in-flight" workflow instances
      • getWorkflows

        java.util.List<WorkflowInstance> getWorkflows​(WorkflowInstanceQuery workflowInstanceQuery)
        Gets all "in-flight" workflow instances according to the specified workflowInstanceQuery parameter
        Parameters:
        workflowInstanceQuery - WorkflowInstanceQuery
        Returns:
        the list of "in-flight" workflow instances
      • getWorkflows

        java.util.List<WorkflowInstance> getWorkflows​(WorkflowInstanceQuery workflowInstanceQuery,
                                                      int maxItems,
                                                      int skipCount)
        Gets maxItems "in-flight" workflow instances according to the specified workflowInstanceQuery parameter
        Parameters:
        workflowInstanceQuery - WorkflowInstanceQuery
        maxItems - int
        skipCount - int
        Returns:
        maxItems workflow instances
      • countWorkflows

        long countWorkflows​(WorkflowInstanceQuery workflowInstanceQuery)
        Get count of workflow instances
        Parameters:
        workflowInstanceQuery - WorkflowInstanceQuery
        Returns:
        count of workflow instances
      • getActiveWorkflows

        java.util.List<WorkflowInstance> getActiveWorkflows()
        Gets all "in-flight" active workflow instances.
        Returns:
        the list of "in-flight" workflow instances
        Since:
        4.0
      • getCompletedWorkflows

        java.util.List<WorkflowInstance> getCompletedWorkflows()
        Gets all completed workflow instances.
        Returns:
        the list of "in-flight" workflow instances
        Since:
        4.0
      • getWorkflows

        java.util.List<WorkflowInstance> getWorkflows()
        Gets all workflow instances (both active and completed).
        Returns:
        the list of "in-flight" workflow instances
        Since:
        4.0
      • getWorkflowById

        WorkflowInstance getWorkflowById​(java.lang.String workflowId)
        Gets a specific workflow instances
        Parameters:
        workflowId - the id of the workflow to retrieve
        Returns:
        the workflow instance
      • getWorkflowPaths

        java.util.List<WorkflowPath> getWorkflowPaths​(java.lang.String workflowId)
        Gets all Paths for the specified Workflow instance
        Parameters:
        workflowId - workflow instance id
        Returns:
        the list of workflow paths
      • getPathProperties

        java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> getPathProperties​(java.lang.String pathId)
        Gets the properties associated with the specified path (and parent paths)
        Parameters:
        pathId - workflow path id
        Returns:
        map of path properties
      • cancelWorkflow

        WorkflowInstance cancelWorkflow​(java.lang.String workflowId)
        Cancel an "in-flight" Workflow instance
        Parameters:
        workflowId - the workflow instance to cancel
        Returns:
        an updated representation of the workflow instance
      • cancelWorkflows

        java.util.List<WorkflowInstance> cancelWorkflows​(java.util.List<java.lang.String> workflowIds)
        Cancel a batch of "in-flight" Workflow instances
        Parameters:
        workflowIds - List of the workflow instances to cancel
        Returns:
        List of updated representations of the workflow instances
      • deleteWorkflow

        WorkflowInstance deleteWorkflow​(java.lang.String workflowId)
        Delete an "in-flight" Workflow instance
        Parameters:
        workflowId - the workflow instance to cancel
        Returns:
        an updated representation of the workflow instance
      • signal

        WorkflowPath signal​(java.lang.String pathId,
                            java.lang.String transitionId)
        Signal the transition from one Workflow Node to another within an "in-flight" process.
        Parameters:
        pathId - the workflow path to signal on
        transitionId - the transition id to follow (or null, for the default transition)
        Returns:
        the updated workflow path
      • fireEvent

        WorkflowPath fireEvent​(java.lang.String pathId,
                               java.lang.String event)
        Fire custom event against specified path
        Parameters:
        pathId - the workflow path to fire event on
        event - name of event
        Returns:
        workflow path (it may have been updated as a result of firing the event
      • getTasksForWorkflowPath

        java.util.List<WorkflowTask> getTasksForWorkflowPath​(java.lang.String pathId)
        Gets all Tasks associated with the specified path
        Parameters:
        pathId - the path id
        Returns:
        the list of associated tasks
      • getTimers

        java.util.List<WorkflowTimer> getTimers​(java.lang.String workflowId)
        Gets all active timers for the specified workflow
        Returns:
        the list of active timers
      • hasWorkflowImage

        boolean hasWorkflowImage​(java.lang.String workflowInstanceId)
        Determines if a graphical view of the workflow instance exists
        Parameters:
        workflowInstanceId - the workflow instance id
        Returns:
        true if there is a workflow instance diagram available
        Since:
        4.0
      • getWorkflowImage

        java.io.InputStream getWorkflowImage​(java.lang.String workflowInstanceId)
        Gets a graphical view of the workflow instance
        Parameters:
        workflowInstanceId - the workflow instance id
        Returns:
        image view of the workflow instance as an InputStream or null if a diagram is not available
        Since:
        4.0