Search in sources :

Example 6 with WorkflowStepData

use of edu.harvard.iq.dataverse.workflow.step.WorkflowStepData in project dataverse by IQSS.

the class WorkflowServiceBean method doResume.

private void doResume(PendingWorkflowInvocation pending, String body) {
    Workflow wf = pending.getWorkflow();
    List<WorkflowStepData> stepsLeft = wf.getSteps().subList(pending.getPendingStepIdx(), wf.getSteps().size());
    WorkflowStep pendingStep = createStep(stepsLeft.get(0));
    final WorkflowContext ctxt = pending.reCreateContext(roleAssignees);
    WorkflowStepResult res = pendingStep.resume(ctxt, pending.getLocalData(), body);
    if (res instanceof Failure) {
        rollback(wf, ctxt, (Failure) res, pending.getPendingStepIdx() - 1);
    } else if (res instanceof Pending) {
        pauseAndAwait(wf, ctxt, (Pending) res, pending.getPendingStepIdx());
    } else {
        executeSteps(wf, ctxt, pending.getPendingStepIdx() + 1);
    }
}
Also used : WorkflowStepData(edu.harvard.iq.dataverse.workflow.step.WorkflowStepData) WorkflowStep(edu.harvard.iq.dataverse.workflow.step.WorkflowStep) WorkflowStepResult(edu.harvard.iq.dataverse.workflow.step.WorkflowStepResult) Failure(edu.harvard.iq.dataverse.workflow.step.Failure) Pending(edu.harvard.iq.dataverse.workflow.step.Pending)

Aggregations

WorkflowStepData (edu.harvard.iq.dataverse.workflow.step.WorkflowStepData)6 WorkflowStep (edu.harvard.iq.dataverse.workflow.step.WorkflowStep)3 CommandException (edu.harvard.iq.dataverse.engine.command.exception.CommandException)2 Failure (edu.harvard.iq.dataverse.workflow.step.Failure)2 Pending (edu.harvard.iq.dataverse.workflow.step.Pending)2 WorkflowStepResult (edu.harvard.iq.dataverse.workflow.step.WorkflowStepResult)2 JsonObject (javax.json.JsonObject)2 RemoveLockCommand (edu.harvard.iq.dataverse.engine.command.impl.RemoveLockCommand)1 Workflow (edu.harvard.iq.dataverse.workflow.Workflow)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Asynchronous (javax.ejb.Asynchronous)1 JsonArray (javax.json.JsonArray)1 JsonArrayBuilder (javax.json.JsonArrayBuilder)1 JsonObjectBuilder (javax.json.JsonObjectBuilder)1 JsonString (javax.json.JsonString)1 JsonValue (javax.json.JsonValue)1 Query (javax.persistence.Query)1