public List<Workflow> getWorkflowInstances(String workflowName, String correlationId, boolean includeClosed, boolean includeTasks) { List<Workflow> workflows = executionDAOFacade.getWorkflowsByCorrelationId(correlationId, includeTasks); List<Workflow> result = new LinkedList<>(); for (Workflow wf : workflows) { if (wf.getWorkflowName().equals(workflowName) && (includeClosed || wf.getStatus().equals(Workflow.WorkflowStatus.RUNNING))) { result.add(wf); } } return result; }
if (workflow.getStatus().equals(WorkflowStatus.PAUSED)) { LOGGER.debug("Workflow " + workflow.getWorkflowId() + " is paused"); return outcome;
if (!wf.getStatus().equals(WorkflowStatus.RUNNING)) { String errorMsg = String.format("The workflow %s is not running so the task referenced by %s cannot be skipped", workflowId, taskReferenceName); throw new IllegalStateException(errorMsg);
if (workflow.getStatus().equals(WorkflowStatus.PAUSED)) { LOGGER.debug("Workflow " + workflow.getWorkflowId() + " is paused"); return outcome;
if (!workflowDef.isRestartable() && workflow.getStatus().equals(WorkflowStatus.COMPLETED)) { // Can only restart non-completed workflows when the configuration is set to false throw new ApplicationException(CONFLICT, String.format("WorkflowId: %s is an instance of WorkflowDef: %s and version: %d and is non restartable", workflowId, workflowDef.getName(), workflowDef.getVersion()));
if (!wf.getStatus().equals(WorkflowStatus.RUNNING)) { String errorMsg = String.format("The workflow %s is not running so the task referenced by %s cannot be skipped", workflowId, taskReferenceName); throw new IllegalStateException(errorMsg);
Workflow workflow = executionDAOFacade.getWorkflowById(wf.getWorkflowId(), false); if (workflow.getStatus().equals(WorkflowStatus.COMPLETED)) {
/** * @throws ApplicationException */ public void pauseWorkflow(String workflowId) { WorkflowStatus status = WorkflowStatus.PAUSED; Workflow workflow = executionDAOFacade.getWorkflowById(workflowId, false); if (workflow.getStatus().isTerminal()) { throw new ApplicationException(CONFLICT, "Workflow id " + workflowId + " has ended, status cannot be updated."); } if (workflow.getStatus().equals(status)) { return; //Already paused! } workflow.setStatus(status); executionDAOFacade.updateWorkflow(workflow); }
/** * @param workflowId * @throws IllegalStateException */ public void resumeWorkflow(String workflowId) { Workflow workflow = executionDAOFacade.getWorkflowById(workflowId, false); if (!workflow.getStatus().equals(WorkflowStatus.PAUSED)) { throw new IllegalStateException("The workflow " + workflowId + " is not PAUSED so cannot resume. " + "Current status is " + workflow.getStatus().name()); } workflow.setStatus(WorkflowStatus.RUNNING); executionDAOFacade.updateWorkflow(workflow); decide(workflowId); }
public List<Workflow> getWorkflowInstances(String workflowName, String correlationId, boolean includeClosed, boolean includeTasks) { List<Workflow> workflows = executionDAOFacade.getWorkflowsByCorrelationId(correlationId, includeTasks); List<Workflow> result = new LinkedList<>(); for (Workflow wf : workflows) { if (wf.getWorkflowName().equals(workflowName) && (includeClosed || wf.getStatus().equals(Workflow.WorkflowStatus.RUNNING))) { result.add(wf); } } return result; }
Workflow workflow = executionDAOFacade.getWorkflowById(wf.getWorkflowId(), false); if (workflow.getStatus().equals(WorkflowStatus.COMPLETED)) {
if (!workflowDef.isRestartable() && workflow.getStatus().equals(WorkflowStatus.COMPLETED)) { // Can only restart non-completed workflows when the configuration is set to false throw new ApplicationException(CONFLICT, String.format("WorkflowId: %s is an instance of WorkflowDef: %s and version: %d and is non restartable", workflowId, workflowDef.getName(), workflowDef.getVersion()));
/** * @throws ApplicationException */ public void pauseWorkflow(String workflowId) { WorkflowStatus status = WorkflowStatus.PAUSED; Workflow workflow = executionDAOFacade.getWorkflowById(workflowId, false); if (workflow.getStatus().isTerminal()) { throw new ApplicationException(CONFLICT, "Workflow id " + workflowId + " has ended, status cannot be updated."); } if (workflow.getStatus().equals(status)) { return; //Already paused! } workflow.setStatus(status); executionDAOFacade.updateWorkflow(workflow); }
/** * @param workflowId * @throws IllegalStateException */ public void resumeWorkflow(String workflowId) { Workflow workflow = executionDAOFacade.getWorkflowById(workflowId, false); if (!workflow.getStatus().equals(WorkflowStatus.PAUSED)) { throw new IllegalStateException("The workflow " + workflowId + " is not PAUSED so cannot resume. " + "Current status is " + workflow.getStatus().name()); } workflow.setStatus(WorkflowStatus.RUNNING); executionDAOFacade.updateWorkflow(workflow); decide(workflowId); }