Class WorkflowTool
java.lang.Object
com.logicaldoc.workflow.automation.WorkflowTool
Utility methods to handle workflows from Velocity
- Since:
- 7.3
- Author:
- Marco Meschieri - LogicalDOC
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds a new noteAdds a new notevoid
appendDocument
(org.activiti.engine.task.Task task, long docId, String username) Appends a document to the given workflowvoid
claim
(org.activiti.engine.task.Task task, com.logicaldoc.core.security.user.User user) void
Claims the given task for a defined userclaimUrl
(org.activiti.engine.task.Task task, com.logicaldoc.core.security.user.User assignee) void
Completes the given task using a specific transitionvoid
Completes the given task using a specific transitioncompleteUrl
(org.activiti.engine.task.Task task, String transition, com.logicaldoc.core.security.user.User assignee) completeUrl
(org.activiti.engine.task.Task task, String transition, String username) void
deleteInstance
(String processInstanceId) Deletes a given workflow process instancegetHistories
(String processId, String event) Retrieve the list of events of the current workflowgetLastHistory
(String processId, String event) Retrieve the last history of a given typeGets the notes of the given workfloworg.activiti.engine.task.Task
List<org.activiti.engine.task.Task>
getTasksByName
(String processInstanceId, String taskName) Retrieves the tasks in a given instance that match the name expressioncom.logicaldoc.core.security.user.User
getVariable
(String processInstanceId, String name) Gets the value of a variable of the specified workflow instancegetVariables
(String processInstanceId) Gets the variables of the specified workflow instancevoid
removeDocument
(org.activiti.engine.task.Task task, long docId, String username) Removes a document to the given workflowvoid
setVariable
(String processInstanceId, String name, Object value) Sets the value of a variable of the specified workflow instancestartWorkflow
(String workflowName, long docId, String username) startWorkflow
(String workflowName, String tag, long docId, String username) startWorkflow
(String workflowName, String tag, String color, Collection<Long> docIds, String username) startWorkflow
(String workflowName, String tag, Collection<Long> docIds, String username) void
stopInstance
(String processInstanceId) Stops a given workflow process instance
-
Constructor Details
-
WorkflowTool
public WorkflowTool()
-
-
Method Details
-
complete
Completes the given task using a specific transition- Parameters:
task
- the task to completetransition
- name of the transition to take
-
complete
Completes the given task using a specific transition- Parameters:
task
- the task to completetransition
- name of the transition to takeusername
- user under which name the action is taken
-
getVariables
Gets the variables of the specified workflow instance- Parameters:
processInstanceId
- identifier of the current workflow instance- Returns:
- the map(name/value) of the variables
-
setVariable
Sets the value of a variable of the specified workflow instance- Parameters:
processInstanceId
- identifier of the workflow instancename
- name of the variablevalue
- value of the variable
-
getVariable
Gets the value of a variable of the specified workflow instance- Parameters:
processInstanceId
- identifier of the workflow instancename
- name of the variable- Returns:
- value value of the variable
-
appendDocument
public void appendDocument(org.activiti.engine.task.Task task, long docId, String username) throws com.logicaldoc.gui.common.client.ServerException, com.logicaldoc.core.PersistenceException Appends a document to the given workflow- Parameters:
task
- the taskdocId
- identifier of the document to appendusername
- the user in whose name the method is run (it can be null)- Throws:
com.logicaldoc.gui.common.client.ServerException
- a generic errorcom.logicaldoc.core.PersistenceException
- error at data layer
-
removeDocument
public void removeDocument(org.activiti.engine.task.Task task, long docId, String username) throws com.logicaldoc.gui.common.client.ServerException, com.logicaldoc.core.PersistenceException Removes a document to the given workflow- Parameters:
task
- the taskdocId
- identifier of the document to removeusername
- the user in whose name the method is run (it can be null)- Throws:
com.logicaldoc.gui.common.client.ServerException
- a generic errorcom.logicaldoc.core.PersistenceException
- error at data layer
-
getHistories
Retrieve the list of events of the current workflow- Parameters:
processId
- identifier of the current processevent
- optional filter on the type of event- Returns:
- list of histories
-
getNotes
Gets the notes of the given workflow- Parameters:
processId
- identifier of the current process- Returns:
- list of notes
-
getLastHistory
Retrieve the last history of a given type- Parameters:
processId
- identifier of the current processevent
- optional name of the event- Returns:
- the found event
-
claim
public void claim(org.activiti.engine.task.Task task, String username) throws com.logicaldoc.core.PersistenceException Claims the given task for a defined user- Parameters:
task
- the taskusername
- username of the claimer- Throws:
com.logicaldoc.core.PersistenceException
- error at data layer
-
claim
public void claim(org.activiti.engine.task.Task task, com.logicaldoc.core.security.user.User user) throws com.logicaldoc.core.PersistenceException - Throws:
com.logicaldoc.core.PersistenceException
-
addNote
public WorkflowHistory addNote(org.activiti.engine.task.Task task, String note) throws com.logicaldoc.core.PersistenceException Adds a new note- Parameters:
task
- the tasknote
- text of the note to add- Returns:
- the event produced by the note
- Throws:
com.logicaldoc.core.PersistenceException
- Error in the data layer
-
addNote
public WorkflowHistory addNote(String processId, String taskName, String note) throws com.logicaldoc.core.PersistenceException Adds a new note- Parameters:
processId
- identifier of the current processtaskName
- name of the tasknote
- text of the note to add- Returns:
- the event generated by the note
- Throws:
com.logicaldoc.core.PersistenceException
- Error in the data layer
-
completeUrl
public String completeUrl(org.activiti.engine.task.Task task, String transition, com.logicaldoc.core.security.user.User assignee) throws UnsupportedEncodingException - Throws:
UnsupportedEncodingException
-
completeUrl
public String completeUrl(org.activiti.engine.task.Task task, String transition, String username) throws UnsupportedEncodingException - Throws:
UnsupportedEncodingException
-
claimUrl
public String claimUrl(org.activiti.engine.task.Task task, com.logicaldoc.core.security.user.User assignee) throws UnsupportedEncodingException - Throws:
UnsupportedEncodingException
-
claimUrl
public String claimUrl(org.activiti.engine.task.Task task, String assignee) throws UnsupportedEncodingException - Throws:
UnsupportedEncodingException
-
startWorkflow
public String startWorkflow(String workflowName, long docId, String username) throws com.logicaldoc.core.PersistenceException - Throws:
com.logicaldoc.core.PersistenceException
-
startWorkflow
public String startWorkflow(String workflowName, String tag, long docId, String username) throws com.logicaldoc.core.PersistenceException - Throws:
com.logicaldoc.core.PersistenceException
-
startWorkflow
public String startWorkflow(String workflowName, String tag, Collection<Long> docIds, String username) throws com.logicaldoc.core.PersistenceException - Throws:
com.logicaldoc.core.PersistenceException
-
startWorkflow
public String startWorkflow(String workflowName, String tag, String color, Collection<Long> docIds, String username) throws com.logicaldoc.core.PersistenceException - Throws:
com.logicaldoc.core.PersistenceException
-
getUser
-
deleteInstance
Deletes a given workflow process instance- Parameters:
processInstanceId
- identifier of the instance to delete
-
stopInstance
Stops a given workflow process instance- Parameters:
processInstanceId
- identifier of the instance to stop
-
getTask
-
getTasksByName
public List<org.activiti.engine.task.Task> getTasksByName(String processInstanceId, String taskName) Retrieves the tasks in a given instance that match the name expression- Parameters:
processInstanceId
- ID of the Process InstancetaskName
- The task name, it may be a like expression- Returns:
- the Tasks that match the name criteria
-