Class ActivitiWorkflowEngine

java.lang.Object
org.alfresco.repo.workflow.BPMEngine
org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine
All Implemented Interfaces:
TaskComponent, WorkflowComponent, WorkflowEngine, org.springframework.beans.factory.InitializingBean

public class ActivitiWorkflowEngine extends BPMEngine implements WorkflowEngine
Since:
3.4.e
Author:
Nick Smith, Frederik Heremans
  • Field Details

    • ERR_FIRE_EVENT_NOT_SUPPORTED

      protected static final String ERR_FIRE_EVENT_NOT_SUPPORTED
      See Also:
    • ERR_FIND_COMPLETED_TASK_INSTS

      protected static final String ERR_FIND_COMPLETED_TASK_INSTS
      See Also:
    • QNAME_INITIATOR

      public static final QName QNAME_INITIATOR
    • activitiUtil

      protected ActivitiUtil activitiUtil
  • Constructor Details

    • ActivitiWorkflowEngine

      public ActivitiWorkflowEngine()
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Overrides:
      afterPropertiesSet in class BPMEngine
      Throws:
      Exception
    • cancelWorkflows

      public List<WorkflowInstance> cancelWorkflows(List<String> workflowIds)
      Description copied from interface: WorkflowComponent
      Cancel a batch of "in-flight" Workflow instances
      Specified by:
      cancelWorkflows in interface WorkflowComponent
      Parameters:
      workflowIds - List of the workflow instances to cancel
      Returns:
      List of updated representations of the workflow instances
    • cancelWorkflow

      public WorkflowInstance cancelWorkflow(String workflowId)
      Cancel an "in-flight" Workflow instance
      Specified by:
      cancelWorkflow in interface WorkflowComponent
      Parameters:
      workflowId - the workflow instance to cancel
      Returns:
      an updated representation of the workflow instance
    • deleteWorkflow

      public WorkflowInstance deleteWorkflow(String workflowId)
      Delete an "in-flight" Workflow instance
      Specified by:
      deleteWorkflow in interface WorkflowComponent
      Parameters:
      workflowId - the workflow instance to cancel
      Returns:
      an updated representation of the workflow instance
    • deployDefinition

      public WorkflowDeployment deployDefinition(InputStream workflowDefinition, String mimetype)
      Deploy a Workflow Definition
      Specified by:
      deployDefinition in interface WorkflowComponent
      Parameters:
      workflowDefinition - the content object containing the definition
      mimetype - (optional) the mime type of the workflow definition
      Returns:
      workflow deployment descriptor
    • deployDefinition

      public WorkflowDeployment deployDefinition(InputStream workflowDefinition, String mimetype, String name)
      Deploy a Workflow Definition
      Specified by:
      deployDefinition in interface WorkflowComponent
      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
    • deployDefinition

      public WorkflowDeployment deployDefinition(InputStream workflowDefinition, String mimetype, String name, boolean fullAccess)
      Deploy a Workflow Definition
      Specified by:
      deployDefinition in interface WorkflowComponent
      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
      fullAccess - true if category should be defined in order to consider the deployment secure
      Returns:
      workflow deployment descriptor
    • fireEvent

      public WorkflowPath fireEvent(String pathId, String event)
      Fire custom event against specified path
      Specified by:
      fireEvent in interface WorkflowComponent
      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
    • getActiveWorkflows

      public List<WorkflowInstance> getActiveWorkflows()
      Gets all "in-flight" active workflow instances.
      Specified by:
      getActiveWorkflows in interface WorkflowComponent
      Returns:
      the list of "in-flight" workflow instances
    • getCompletedWorkflows

      public List<WorkflowInstance> getCompletedWorkflows()
      Gets all completed workflow instances.
      Specified by:
      getCompletedWorkflows in interface WorkflowComponent
      Returns:
      the list of "in-flight" workflow instances
    • getWorkflows

      public List<WorkflowInstance> getWorkflows()
      Gets all workflow instances (both active and completed).
      Specified by:
      getWorkflows in interface WorkflowComponent
      Returns:
      the list of "in-flight" workflow instances
    • getActiveWorkflows

      public List<WorkflowInstance> getActiveWorkflows(String workflowDefinitionId)
      Gets all "in-flight" active workflow instances of the specified Workflow Definition
      Specified by:
      getActiveWorkflows in interface WorkflowComponent
      Parameters:
      workflowDefinitionId - the workflow definition id
      Returns:
      the list of "in-flight" workflow instances
    • getAllDefinitions

      public List<WorkflowDefinition> getAllDefinitions()
      Gets all deployed Workflow Definitions (with all previous versions)
      Specified by:
      getAllDefinitions in interface WorkflowComponent
      Returns:
      the deployed (and previous) workflow definitions
    • getAllDefinitionsByName

      public List<WorkflowDefinition> getAllDefinitionsByName(String workflowName)
      Gets all (including previous) Workflow Definitions for the given unique name
      Specified by:
      getAllDefinitionsByName in interface WorkflowComponent
      Parameters:
      workflowName - workflow name e.g. activiti$activitiReview
      Returns:
      the deployed workflow definition (or null if not found)
    • getCompletedWorkflows

      public List<WorkflowInstance> getCompletedWorkflows(String workflowDefinitionId)
      Gets all "in-flight" completed workflow instances of the specified Workflow Definition
      Specified by:
      getCompletedWorkflows in interface WorkflowComponent
      Parameters:
      workflowDefinitionId - the workflow definition id
      Returns:
      the list of "in-flight" workflow instances
    • getDefinitionById

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

      public WorkflowDefinition getDefinitionByName(String workflowName)
      Gets a Workflow Definition by unique name
      Specified by:
      getDefinitionByName in interface WorkflowComponent
      Parameters:
      workflowName - workflow name e.g. activiti$activitiReview
      Returns:
      the deployed workflow definition
    • getDefinitionImage

      public byte[] getDefinitionImage(String workflowDefinitionId)
      Gets a graphical view of the Workflow Definition
      Specified by:
      getDefinitionImage in interface WorkflowComponent
      Parameters:
      workflowDefinitionId - the workflow definition id
      Returns:
      graphical image of workflow definition
    • getDefinitions

      public List<WorkflowDefinition> getDefinitions()
      Gets all deployed Workflow Definitions
      Specified by:
      getDefinitions in interface WorkflowComponent
      Returns:
      the deployed workflow definitions
    • getPathProperties

      public Map<QName,Serializable> getPathProperties(String pathId)
      Gets the properties associated with the specified path (and parent paths)
      Specified by:
      getPathProperties in interface WorkflowComponent
      Parameters:
      pathId - workflow path id
      Returns:
      map of path properties
    • getTaskDefinitions

      public List<WorkflowTaskDefinition> getTaskDefinitions(String workflowDefinitionId)
      Gets the Task Definitions for the given Workflow Definition
      Specified by:
      getTaskDefinitions in interface WorkflowComponent
      Parameters:
      workflowDefinitionId - the workflow definition id
      Returns:
      the deployed task definitions (or null if not found)
    • getTasksForWorkflowPath

      public List<WorkflowTask> getTasksForWorkflowPath(String pathId)
      Gets all Tasks associated with the specified path
      Specified by:
      getTasksForWorkflowPath in interface WorkflowComponent
      Parameters:
      pathId - the path id
      Returns:
      the list of associated tasks
    • getTimers

      public List<WorkflowTimer> getTimers(String workflowId)
      Gets all active timers for the specified workflow
      Specified by:
      getTimers in interface WorkflowComponent
      Returns:
      the list of active timers
    • getWorkflowById

      public WorkflowInstance getWorkflowById(String workflowId)
      Gets a specific workflow instances
      Specified by:
      getWorkflowById in interface WorkflowComponent
      Parameters:
      workflowId - the id of the workflow to retrieve
      Returns:
      the workflow instance
    • getWorkflowPaths

      public List<WorkflowPath> getWorkflowPaths(String workflowId)
      Gets all Paths for the specified Workflow instance
      Specified by:
      getWorkflowPaths in interface WorkflowComponent
      Parameters:
      workflowId - workflow instance id
      Returns:
      the list of workflow paths
    • getWorkflows

      public List<WorkflowInstance> getWorkflows(String workflowDefinitionId)
      Gets all "in-flight" workflow instances (both active and completed) of the specified Workflow Definition
      Specified by:
      getWorkflows in interface WorkflowComponent
      Parameters:
      workflowDefinitionId - the workflow definition id
      Returns:
      the list of "in-flight" workflow instances
    • isDefinitionDeployed

      public 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.
      Specified by:
      isDefinitionDeployed in interface WorkflowComponent
      Parameters:
      workflowDefinition - the definition to check
      mimetype - the mimetype of the definition
      Returns:
      true => already deployed
    • checkDeploymentCategory

      public void checkDeploymentCategory(InputStream workflowDefinition)
      Sets the deployment category if applicable to allow the workflow to have full access
      Specified by:
      checkDeploymentCategory in interface WorkflowComponent
      Parameters:
      workflowDefinition - the definition to check
    • signal

      public WorkflowPath signal(String pathId, String transitionId)
      Signal the transition from one Workflow Node to another within an "in-flight" process.
      Specified by:
      signal in interface WorkflowComponent
      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
    • startWorkflow

      public WorkflowPath startWorkflow(String workflowDefinitionId, Map<QName,Serializable> parameters)
      Start a Workflow Instance
      Specified by:
      startWorkflow in interface WorkflowComponent
      Parameters:
      workflowDefinitionId - the workflow definition id
      parameters - the initial set of parameters used to populate the "Start Task" properties
      Returns:
      the initial workflow path
    • undeployDefinition

      public void undeployDefinition(String workflowDefinitionId)
      Undeploy an exisiting Workflow Definition TODO: Determine behaviour when "in-flight" workflow instances exist
      Specified by:
      undeployDefinition in interface WorkflowComponent
      Parameters:
      workflowDefinitionId - the id of the definition to undeploy
    • hasWorkflowImage

      public boolean hasWorkflowImage(String workflowInstanceId)
      Determines if a graphical view of the workflow instance exists
      Specified by:
      hasWorkflowImage in interface WorkflowComponent
      Parameters:
      workflowInstanceId - the workflow instance id
      Returns:
      true if there is a workflow instance diagram available
    • getWorkflowImage

      public InputStream getWorkflowImage(String workflowInstanceId)
      Gets a graphical view of the workflow instance
      Specified by:
      getWorkflowImage in interface WorkflowComponent
      Parameters:
      workflowInstanceId - the workflow instance id
      Returns:
      image view of the workflow instance as an InputStream or null if a diagram is not available
    • setPropertyConverter

      public void setPropertyConverter(ActivitiPropertyConverter propertyConverter)
      Parameters:
      propertyConverter - the propertyConverter to set
    • setDictionaryService

      public void setDictionaryService(DictionaryService dictionaryService)
      Sets the Dictionary Service
      Parameters:
      dictionaryService - DictionaryService
    • setNodeService

      public void setNodeService(NodeService nodeService)
      Sets the Node Service
      Parameters:
      nodeService - NodeService
    • setRepositoryHelper

      public void setRepositoryHelper(Repository repositoryHelper)
      Parameters:
      repositoryHelper - the repositoryHelper to set
    • setPersonService

      public void setPersonService(PersonService personService)
      Sets the Person Service
      Parameters:
      personService - PersonService
    • setAuthorityManager

      public void setAuthorityManager(WorkflowAuthorityManager authorityManager)
      Sets the Authority DAO /**
      Parameters:
      authorityManager - the authorityManager to set
    • endTask

      public WorkflowTask endTask(String taskId, String transition)
      End the Task (i.e. complete the task)
      Specified by:
      endTask in interface TaskComponent
      Parameters:
      taskId - the task id to end
      transition - the task transition id to take on completion (or null, for the default transition)
      Returns:
      the updated task
    • getAssignedTasks

      public List<WorkflowTask> getAssignedTasks(String authority, WorkflowTaskState state, boolean lazyInitialization)
      Gets all tasks assigned to the specified authority
      Specified by:
      getAssignedTasks in interface TaskComponent
      Parameters:
      authority - the authority
      state - filter by specified workflow task state
      lazyInitialization - hint in order to return partially-initialized entities
      Returns:
      the list of assigned tasks
    • getPooledTasks

      public List<WorkflowTask> getPooledTasks(List<String> authorities, boolean lazyInitialization)
      Gets the pooled tasks available to the specified authority
      Specified by:
      getPooledTasks in interface TaskComponent
      Parameters:
      authorities - the list of authorities
      lazyInitialization - hint in order to return partially-initialized entities
      Returns:
      the list of pooled tasks
    • getTaskById

      public WorkflowTask getTaskById(String taskId)
      Gets a Task by unique Id
      Specified by:
      getTaskById in interface TaskComponent
      Parameters:
      taskId - the task id
      Returns:
      the task
    • queryTasks

      public List<WorkflowTask> queryTasks(WorkflowTaskQuery query, boolean sameSession)
      Description copied from interface: TaskComponent
      Query for tasks Hint: use WorkflowTaskQuery setLimit() method to limit the number of processed items if you don't really need to go through all of them
      Specified by:
      queryTasks in interface TaskComponent
      Parameters:
      query - the filter by which tasks are queried
      sameSession - indicates that the returned WorkflowTask elements will be used in the same session. If true, the returned List will be a lazy loaded list providing greater performance.
      Returns:
      the list of tasks matching the specified query
    • countTasks

      public long countTasks(WorkflowTaskQuery query)
      Description copied from interface: TaskComponent
      Count the number of active tasks that match the given query.
      Specified by:
      countTasks in interface TaskComponent
      Parameters:
      query - the filter by which tasks are queried
      Returns:
      number of matching tasks.
    • queryTasks

      public List<WorkflowTask> queryTasks(WorkflowTaskQuery query)
      Specified by:
      queryTasks in interface TaskComponent
    • getStartTasks

      public List<WorkflowTask> getStartTasks(List<String> workflowInstanceIds, boolean sameSession)
      Description copied from interface: TaskComponent
      Gets all start tasks for the specified workflow
      Specified by:
      getStartTasks in interface TaskComponent
      Returns:
      the list of start tasks
    • getStartTask

      public WorkflowTask getStartTask(String workflowInstanceId)
      Gets all active timers for the specified workflow
      Specified by:
      getStartTask in interface TaskComponent
      Returns:
      the list of active timers
    • startTask

      public WorkflowTask startTask(String taskId)
      Start the specified Task Note: this is an optional task operation. It may be used to track when work started on a task as well as resume a suspended task.
      Specified by:
      startTask in interface TaskComponent
      Parameters:
      taskId - the task to start
      Returns:
      the updated task
    • suspendTask

      public WorkflowTask suspendTask(String taskId)
      Suspend the specified Task
      Specified by:
      suspendTask in interface TaskComponent
      Parameters:
      taskId - String
      Returns:
      the update task
    • updateTask

      public WorkflowTask updateTask(String taskId, Map<QName,Serializable> properties, Map<QName,List<NodeRef>> add, Map<QName,List<NodeRef>> remove)
      Update the Properties and Associations of a Task
      Specified by:
      updateTask in interface TaskComponent
      Parameters:
      taskId - the task id to update
      properties - the map of properties to set on the task (or null, if none to set)
      add - the map of items to associate with the task (or null, if none to add)
      remove - the map of items to dis-associate with the task (or null, if none to remove)
      Returns:
      the update task
    • getWorkflows

      public List<WorkflowInstance> getWorkflows(WorkflowInstanceQuery workflowInstanceQuery)
      Description copied from interface: WorkflowComponent
      Gets all "in-flight" workflow instances according to the specified workflowInstanceQuery parameter
      Specified by:
      getWorkflows in interface WorkflowComponent
      Parameters:
      workflowInstanceQuery - WorkflowInstanceQuery
      Returns:
      the list of "in-flight" workflow instances
    • getWorkflows

      public List<WorkflowInstance> getWorkflows(WorkflowInstanceQuery workflowInstanceQuery, int maxItems, int skipCount)
      Description copied from interface: WorkflowComponent
      Gets maxItems "in-flight" workflow instances according to the specified workflowInstanceQuery parameter
      Specified by:
      getWorkflows in interface WorkflowComponent
      Parameters:
      workflowInstanceQuery - WorkflowInstanceQuery
      maxItems - int
      skipCount - int
      Returns:
      maxItems workflow instances
    • countWorkflows

      public long countWorkflows(WorkflowInstanceQuery workflowInstanceQuery)
      Description copied from interface: WorkflowComponent
      Get count of workflow instances
      Specified by:
      countWorkflows in interface WorkflowComponent
      Parameters:
      workflowInstanceQuery - WorkflowInstanceQuery
      Returns:
      count of workflow instances
    • dispatchPackageUpdatedEvent

      public void dispatchPackageUpdatedEvent(Object variableValue, String taskId, String executionId, String processInstanceId, String processDefinitionId)
    • setNodeConverter

      public void setNodeConverter(WorkflowNodeConverter nodeConverter)
      Parameters:
      nodeConverter - the nodeConverter to set
    • setFactory

      public void setFactory(WorkflowObjectFactory factory)
      Parameters:
      factory - the factory to set
    • setMessageService

      public void setMessageService(MessageService messageService)
      Parameters:
      messageService - the messageService to set
    • setTenantService

      public void setTenantService(TenantService tenantService)
      Parameters:
      tenantService - the tenantService to set
    • setTypeConverter

      public void setTypeConverter(ActivitiTypeConverter typeConverter)
      Parameters:
      typeConverter - the typeConverter to set
    • setActivitiUtil

      public void setActivitiUtil(ActivitiUtil activitiUtil)
      Parameters:
      activitiUtil - the activitiUtil to set
    • setNamespaceService

      public void setNamespaceService(NamespaceService namespaceService)
      Parameters:
      namespaceService - the namespaceService to set