Class WorkflowTool


  • public class WorkflowTool
    extends Object
    Utility methods to handle workflows from Velocity
    Since:
    7.3
    Author:
    Marco Meschieri - LogicalDOC
    • Constructor Detail

      • WorkflowTool

        public WorkflowTool()
    • Method Detail

      • complete

        public void complete​(org.activiti.engine.task.Task task,
                             String transition)
        Completes the given task using a specific transition
        Parameters:
        task - the task to complete
        transition - name of the transition to take
      • getVariables

        public Map<String,​Object> getVariables​(String processInstanceId)
        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

        public void setVariable​(String processInstanceId,
                                String name,
                                Object value)
        Sets the value of a variable of the specified workflow instance
        Parameters:
        processInstanceId - identifier of the workflow instance
        name - name of the variable
        value - value of the variable
      • getVariable

        public Object getVariable​(String processInstanceId,
                                  String name)
        Gets the value of a variable of the specified workflow instance
        Parameters:
        processInstanceId - identifier of the workflow instance
        name - 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 task
        docId - identifier of the document to append
        username - the user in whose name the method is run (it can be null)
        Throws:
        com.logicaldoc.gui.common.client.ServerException - a generic error
        com.logicaldoc.core.PersistenceException - error in the database
      • 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 task
        docId - identifier of the document to remove
        username - the user in whose name the method is run (it can be null)
        Throws:
        com.logicaldoc.gui.common.client.ServerException - a generic error
        com.logicaldoc.core.PersistenceException - error in the database
      • getHistories

        public List<WorkflowHistory> getHistories​(String processId,
                                                  String event)
        Retrieve the list of events of the current workflow
        Parameters:
        processId - identifier of the current process
        event - optional filter on the type of event
        Returns:
        list of histories
      • getNotes

        public List<WorkflowHistory> getNotes​(String processId)
        Gets the notes of the given workflow
        Parameters:
        processId - identifier of the current process
        Returns:
        list of notes
      • getLastHistory

        public WorkflowHistory getLastHistory​(String processId,
                                              String event)
        Retrieve the last history of a given type
        Parameters:
        processId - identifier of the current process
        event - 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 task
        username - username of the claimer
        Throws:
        com.logicaldoc.core.PersistenceException - error in the database
      • claim

        public void claim​(org.activiti.engine.task.Task task,
                          com.logicaldoc.core.security.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.gui.common.client.ServerException
        Adds a new note
        Parameters:
        task - the task
        note - text of the note to add
        Returns:
        the event produced by the note
        Throws:
        com.logicaldoc.gui.common.client.ServerException - generic error
      • addNote

        public WorkflowHistory addNote​(String processId,
                                       String taskName,
                                       String note)
                                throws com.logicaldoc.gui.common.client.ServerException
        Adds a new note
        Parameters:
        processId - identifier of the current process
        taskName - name of the task
        note - text of the note to add
        Returns:
        the event generated by the note
        Throws:
        com.logicaldoc.gui.common.client.ServerException - generic error
      • 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
      • getUser

        public com.logicaldoc.core.security.User getUser​(String username)
      • deleteInstance

        public void deleteInstance​(String processInstanceId)
        Deletes a given workflow process instance
        Parameters:
        processInstanceId - identifier of the instance to delete