Class WorkflowService

java.lang.Object
com.eurodyn.qlack.fuse.workflow.service.WorkflowService

@Service @Transactional public class WorkflowService extends Object
This service provides methods related to the processes and workflow of Activiti.
Author:
European Dynamics
  • Constructor Details

    • WorkflowService

      @Autowired public WorkflowService(org.activiti.engine.RuntimeService runtimeService, org.activiti.engine.HistoryService historyService, jakarta.persistence.EntityManager entityManager, ProcessInitService processInitService)
  • Method Details

    • startWorkflowInstance

      public String startWorkflowInstance(String processId, Map<String,Object> variables)
      Given the id of a process (as defined in the xml), a new workflow instance starts. If no process with the found id exists, an exception is thrown.
      Parameters:
      processId - the id of the process
      variables - the variables of the process
      Returns:
      the id of the started workflow instance
    • resumeWorkflowInstance

      public void resumeWorkflowInstance(String processInstanceId)
      Given the id of a suspended process instance, it resumes the process instance. If no instance is found or if the instance is already running, it throws an exception.
      Parameters:
      processInstanceId - the id of the suspended process instance
    • suspendWorkflowInstance

      public void suspendWorkflowInstance(String processInstanceId)
      Given the id of a started process instance, it suspends the found process instance. If no instance is found or if the instance is already suspended, it throws an exception.
      Parameters:
      processInstanceId - the id of the started process instance
    • deleteWorkflowInstance

      public void deleteWorkflowInstance(String processInstanceId, String reasonOfDeletion)
      Given the id of a started process instance, it deletes the found process instance. If no instance is found, it throws an exception.
      Parameters:
      processInstanceId - the id of the started process instance
      reasonOfDeletion - the reason for deletion
    • getProcessInstancesByProcessId

      public List<ProcessInstanceDTO> getProcessInstancesByProcessId(String processId)
      Given the id of process, it returns all the active process instances.
      Parameters:
      processId - the id of the process
      Returns:
      a list containing the active process instances
    • getProcessHistory

      public List<ProcessHistoryDTO> getProcessHistory(String processId)
      Given the id of an existing process, it returns the history of this process and its data for each version. If no process is found, it returns an empty list.
      Parameters:
      processId - the id of the process
      Returns:
      a list containing all the history versions
    • updateProcessesFromResources

      public void updateProcessesFromResources()
      This method reads the .xml files located under the resources/processes folder and reads their content. If their content has already been persisted in the Activiti tables and no changes are found, nothing happens. In any other case, a new version of the process is created.