use of edu.harvard.iq.dataverse.workflow.WorkflowContext.TriggerType in project dataverse by IQSS.
the class WorkflowsAdmin method setDefault.
@Path("default/{triggerType}")
@PUT
public Response setDefault(@PathParam("triggerType") String triggerType, String identifier) {
try {
long idtf = Long.parseLong(identifier.trim());
TriggerType tt = TriggerType.valueOf(triggerType);
Optional<Workflow> wf = workflows.getWorkflow(idtf);
if (wf.isPresent()) {
workflows.setDefaultWorkflowId(tt, idtf);
return ok("Default workflow id for trigger " + tt.name() + " set to " + idtf);
} else {
return notFound("Can't find workflow with id " + idtf);
}
} catch (NumberFormatException nfe) {
return badRequest("workflow identifier has to be numeric.");
} catch (IllegalArgumentException iae) {
return badRequest("Unknown trigger type '" + triggerType + "'. Available triggers: " + Arrays.toString(TriggerType.values()));
}
}
Aggregations