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​(InputStream workflowDefinition,
                                            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​(InputStream workflowDefinition,
                                            String mimetype,
                                            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​(InputStream workflowDefinition,
                                     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​(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

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

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

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

        WorkflowDefinition getDefinitionByName​(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")
        List<WorkflowDefinition> getAllDefinitionsByName​(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​(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")
        List<WorkflowTaskDefinition> getTaskDefinitions​(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​(String workflowDefinitionId,
                                   Map<QName,​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

        List<WorkflowInstance> getActiveWorkflows​(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

        List<WorkflowInstance> getCompletedWorkflows​(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

        List<WorkflowInstance> getWorkflows​(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

        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

        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

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

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

        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​(String workflowId)
        Gets a specific workflow instances
        Parameters:
        workflowId - the id of the workflow to retrieve
        Returns:
        the workflow instance
      • getWorkflowPaths

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

        Map<QName,​Serializable> getPathProperties​(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​(String workflowId)
        Cancel an "in-flight" Workflow instance
        Parameters:
        workflowId - the workflow instance to cancel
        Returns:
        an updated representation of the workflow instance
      • cancelWorkflows

        List<WorkflowInstance> cancelWorkflows​(List<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​(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​(String pathId,
                            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​(String pathId,
                               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

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

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

        boolean hasWorkflowImage​(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

        InputStream getWorkflowImage​(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