Package com.logicaldoc.workflow
Class WorkflowEngine
- java.lang.Object
- 
- com.logicaldoc.workflow.WorkflowEngine
 
- 
 public class WorkflowEngine extends Object The class "WorkflowEngine" is the bridge between LogicalDOC and the Activiti Engine.- Since:
- 6.8
- Author:
- Marco Meschieri - LogicalDOC
 
- 
- 
Constructor SummaryConstructors Constructor Description WorkflowEngine()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanUserOwnTask(String username, String taskId)voidclaimTask(String taskId, String username, WorkflowHistory transaction)Assign a task to a specific user.If the task is already claimed you cannot claim again.voidcompleteTask(String taskId, String transitionName)Ends the task and takes the given transitionvoidcompleteTask(org.activiti.engine.task.Task task, String transitionName)Ends the task and takes the given transitionvoiddeleteAllActiveProcessInstances()voiddeleteProcessInstance(String processInstanceId)Stops and delete a process instance on using the corresponding processidStringdeployWorkflow(String workflowName, InputStream processDefinition)Deploying of a workflow-process definition.StringdeployWorkflow(String workflowName, String processDefinition)Deploying of a workflow-process definition.List<org.activiti.engine.history.HistoricActivityInstance>getActivityHistory(String instanceId)List<org.activiti.engine.task.Task>getAllActiveTasks()All current active Tasks will be returned.List<org.activiti.engine.task.Task>getAllActiveTasksByUser(String username)All the tasks where the given user is assignedList<org.activiti.engine.repository.ProcessDefinition>getAllProcessDefinitions(Long tenantId)Retrieves all valid deployed ProcessDefinitionsList<org.activiti.engine.runtime.ProcessInstance>getAllProcessInstances()Gets all the process instancesList<org.activiti.engine.task.Task>getAllTasks()This methods is similar to 'getAllActiveTasks()', but also the suspended task instances will be returned.List<String>getCandidateGroups(org.activiti.engine.task.Task task)List<String>getCandidateUsers(org.activiti.engine.task.Task task)List<org.activiti.engine.task.Task>getInvolvedWorkflows(String username)Retrieves all the current tasks of the workflows the given user was involved in(at any time)List<org.activiti.engine.impl.pvm.PvmTransition>getOutgoingTransitions(String executionId, String processDefinitionId, String taskDefinitionKey)List<org.activiti.engine.impl.pvm.PvmTransition>getOutgoingTransitions(org.activiti.engine.task.Task task)org.activiti.engine.repository.ProcessDefinitiongetProcessDefinition(String processDefinitionId)Gets the definition of a processorg.activiti.engine.ProcessEnginegetProcessEngine()org.activiti.engine.runtime.ProcessInstancegetProcessInstanceById(String processInstanceId)Gets a ProcessInstance by the idorg.activiti.engine.history.HistoricProcessInstancegetProcessInstanceHistory(String instanceId)List<org.activiti.engine.history.HistoricProcessInstance>getProcessInstanceHistoryByKey(String processDefinitionKey)List<String>getProcessInstanceIds(String workflowName)Retrieves the IDs of all the instances of a given workflowObjectgetProcessInstanceVariable(String processInstanceId, String name)Map<String,Object>getProcessInstanceVariables(String processInstanceId)List<org.activiti.engine.task.Task>getSupervisorWorkflowTasks(String username)Retrieves all the tasks of the workflow for which the current user (not administator) is one of the supervisorsorg.activiti.engine.task.TaskgetTaskById(String id)Retrieves a particular Task given by a valid taskid.List<org.activiti.engine.task.Task>getTaskByProcessDefinitionAndKey(String processDefinitionId, String taskDefinitionKey)Retrieves tasks given by a key in a specific process definitionorg.activiti.engine.task.TaskgetTaskByProcessInstanceAndKey(String processInstanceId, String taskDefinitionKey)Retrieves a particular Task given by a key in a specific process instanceorg.activiti.engine.history.HistoricTaskInstancegetTaskHistory(String taskId)List<org.activiti.engine.task.Task>getTasksByAssignee(String username)Retrieves user tasks that are assigned to the given userList<org.activiti.engine.task.Task>getTasksByProcessInstance(String processInstanceId)Retrieves all Tasks that has been started yet (but must not be ended).List<org.activiti.engine.task.Task>getTasksSuspendedByAssignee(String username)Retrieves user tasks that are assigned to the given user but are suspendedList<org.activiti.engine.task.Task>getTasksUserCanOwn(String username)Retrieves the tasks a user can own.ObjectgetTaskVariable(String taskId, String name)voidsetHistoryDAO(WorkflowHistoryDAO historyDAO)voidsetProcessInstanceVariable(String processInstanceId, String name, Object value)voidsetTaskVariable(String taskId, String name, Object value)voidsetTemplateDAO(WorkflowTemplateDAO templateDAO)voidsetUserDAO(com.logicaldoc.core.security.dao.UserDAO userDAO)StringstartProcessInstance(String workflowName, Map<String,Object> variables, WorkflowHistory transaction)Starts a ProcessInstance by using the deployed definition namevoidunclaimTask(String taskId)voidundeployWorkflow(String workflowName)A valid deployed Workflow-Processdefinition gets undeployed.
 
- 
- 
- 
Method Detail- 
deployWorkflowpublic String deployWorkflow(String workflowName, InputStream processDefinition) Deploying of a workflow-process definition.- Parameters:
- processDefinition- The serialized content of the processedefinition (Activiti BPMN2 standard).
- workflowName- The name of the workflow.
- Returns:
- The id of the deployment
 
 - 
deployWorkflowpublic String deployWorkflow(String workflowName, String processDefinition) throws UnsupportedEncodingException Deploying of a workflow-process definition.- Parameters:
- processDefinition- The serialized content of the process definition (Activiti BPMN2 standard).
- workflowName- The name of the workflow.
- Returns:
- The id of the deployment
- Throws:
- UnsupportedEncodingException- the process definition is not UTF-8
 
 - 
undeployWorkflowpublic void undeployWorkflow(String workflowName) A valid deployed Workflow-Processdefinition gets undeployed.- Parameters:
- workflowName- The process definition key
 
 - 
startProcessInstancepublic String startProcessInstance(String workflowName, Map<String,Object> variables, WorkflowHistory transaction) Starts a ProcessInstance by using the deployed definition name- Parameters:
- workflowName- name of the workflow to start
- transaction- informations regarding the actual session
- variables- map of variables to be included in the execution dictionary
- Returns:
- The newly started Process Instance ID(aka Workflow Instance)
 
 - 
getProcessDefinitionpublic org.activiti.engine.repository.ProcessDefinition getProcessDefinition(String processDefinitionId) Gets the definition of a process- Parameters:
- processDefinitionId- Identifier of the process definition
- Returns:
- The process definition
 
 - 
deleteProcessInstancepublic void deleteProcessInstance(String processInstanceId) Stops and delete a process instance on using the corresponding processid- Parameters:
- processInstanceId- Id of the ProcessInstance to stop
 
 - 
deleteAllActiveProcessInstancespublic void deleteAllActiveProcessInstances() 
 - 
getAllProcessInstancespublic List<org.activiti.engine.runtime.ProcessInstance> getAllProcessInstances() Gets all the process instances- Returns:
- list of process instances
 
 - 
getAllProcessDefinitionspublic List<org.activiti.engine.repository.ProcessDefinition> getAllProcessDefinitions(Long tenantId) Retrieves all valid deployed ProcessDefinitions- Parameters:
- tenantId- Optional tenant specification
- Returns:
- All process-definitions
 
 - 
getTaskByIdpublic org.activiti.engine.task.Task getTaskById(String id) Retrieves a particular Task given by a valid taskid.- Parameters:
- id- The TaskId
- Returns:
- the Task
 
 - 
getTaskByProcessInstanceAndKeypublic org.activiti.engine.task.Task getTaskByProcessInstanceAndKey(String processInstanceId, String taskDefinitionKey) Retrieves a particular Task given by a key in a specific process instance- Parameters:
- processInstanceId- ID of the Process Instance
- taskDefinitionKey- The task definition key
- Returns:
- the Task
 
 - 
getTaskByProcessDefinitionAndKeypublic List<org.activiti.engine.task.Task> getTaskByProcessDefinitionAndKey(String processDefinitionId, String taskDefinitionKey) Retrieves tasks given by a key in a specific process definition- Parameters:
- processDefinitionId- ID of the Process Definition
- taskDefinitionKey- The task definition key
- Returns:
- the tasks
 
 - 
getAllActiveTaskspublic List<org.activiti.engine.task.Task> getAllActiveTasks() All current active Tasks will be returned. The suspended task instances will be not returned.- Returns:
- All active Tasks
 
 - 
getAllActiveTasksByUserpublic List<org.activiti.engine.task.Task> getAllActiveTasksByUser(String username) All the tasks where the given user is assigned- Parameters:
- username- username of a user
- Returns:
- list of tasks
 
 - 
getAllTaskspublic List<org.activiti.engine.task.Task> getAllTasks() This methods is similar to 'getAllActiveTasks()', but also the suspended task instances will be returned.- Returns:
- All TaskInstances
 
 - 
getTasksByAssigneepublic List<org.activiti.engine.task.Task> getTasksByAssignee(String username) Retrieves user tasks that are assigned to the given user- Parameters:
- username- The Username
- Returns:
- List of tasks owned by the user
 
 - 
getTasksSuspendedByAssigneepublic List<org.activiti.engine.task.Task> getTasksSuspendedByAssignee(String username) Retrieves user tasks that are assigned to the given user but are suspended- Parameters:
- username- The Username
- Returns:
- List of tasks owned by the user
 
 - 
getTasksUserCanOwnpublic List<org.activiti.engine.task.Task> getTasksUserCanOwn(String username) Retrieves the tasks a user can own.- Parameters:
- username- The Username
- Returns:
- List of tasks owned by the user
 
 - 
getSupervisorWorkflowTaskspublic List<org.activiti.engine.task.Task> getSupervisorWorkflowTasks(String username) Retrieves all the tasks of the workflow for which the current user (not administator) is one of the supervisors- Parameters:
- username- username of a supervisor
- Returns:
- list of tasks
 
 - 
getInvolvedWorkflowspublic List<org.activiti.engine.task.Task> getInvolvedWorkflows(String username) Retrieves all the current tasks of the workflows the given user was involved in(at any time)- Parameters:
- username- username of a workflow
- Returns:
- list of tasks
 
 - 
getTasksByProcessInstancepublic List<org.activiti.engine.task.Task> getTasksByProcessInstance(String processInstanceId) Retrieves all Tasks that has been started yet (but must not be ended).- Parameters:
- processInstanceId- identifier of the process instance
- Returns:
- List of TaskInstances
 
 - 
claimTaskpublic void claimTask(String taskId, String username, WorkflowHistory transaction) Assign a task to a specific user.If the task is already claimed you cannot claim again.- Parameters:
- taskId- the task identifier
- username- the user that must be assigned
- transaction- informations regarding the actual session
 
 - 
unclaimTaskpublic void unclaimTask(String taskId) 
 - 
completeTaskpublic void completeTask(org.activiti.engine.task.Task task, String transitionName)Ends the task and takes the given transition- Parameters:
- task- the task to complete
- transitionName- ID of the transition to take
 
 - 
completeTaskpublic void completeTask(String taskId, String transitionName) Ends the task and takes the given transition- Parameters:
- taskId- ID of the task to complete
- transitionName- ID of the transition to take
 
 - 
getOutgoingTransitionspublic List<org.activiti.engine.impl.pvm.PvmTransition> getOutgoingTransitions(org.activiti.engine.task.Task task) 
 - 
getOutgoingTransitionspublic List<org.activiti.engine.impl.pvm.PvmTransition> getOutgoingTransitions(String executionId, String processDefinitionId, String taskDefinitionKey) 
 - 
getProcessInstanceByIdpublic org.activiti.engine.runtime.ProcessInstance getProcessInstanceById(String processInstanceId) Gets a ProcessInstance by the id- Parameters:
- processInstanceId- the Process Instance ID
- Returns:
- object representing the instance
 
 - 
getProcessInstanceVariablespublic Map<String,Object> getProcessInstanceVariables(String processInstanceId) 
 - 
getProcessInstanceVariablepublic Object getProcessInstanceVariable(String processInstanceId, String name) 
 - 
setProcessInstanceVariablepublic void setProcessInstanceVariable(String processInstanceId, String name, Object value) 
 - 
getActivityHistorypublic List<org.activiti.engine.history.HistoricActivityInstance> getActivityHistory(String instanceId) 
 - 
getProcessInstanceHistorypublic org.activiti.engine.history.HistoricProcessInstance getProcessInstanceHistory(String instanceId) 
 - 
getProcessInstanceHistoryByKeypublic List<org.activiti.engine.history.HistoricProcessInstance> getProcessInstanceHistoryByKey(String processDefinitionKey) 
 - 
getTaskHistorypublic org.activiti.engine.history.HistoricTaskInstance getTaskHistory(String taskId) 
 - 
getProcessInstanceIdspublic List<String> getProcessInstanceIds(String workflowName) Retrieves the IDs of all the instances of a given workflow- Parameters:
- workflowName- The process definition key
- Returns:
- The list of process instance IDs
 
 - 
getProcessEnginepublic org.activiti.engine.ProcessEngine getProcessEngine() 
 - 
setUserDAOpublic void setUserDAO(com.logicaldoc.core.security.dao.UserDAO userDAO) 
 - 
setHistoryDAOpublic void setHistoryDAO(WorkflowHistoryDAO historyDAO) 
 - 
setTemplateDAOpublic void setTemplateDAO(WorkflowTemplateDAO templateDAO) 
 
- 
 
-