Search in sources :

Example 1 with PendingWorkflowInvocation

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

the class Workflows method resumeWorkflow.

@Path("{invocationId}")
@POST
public Response resumeWorkflow(@PathParam("invocationId") String invocationId, String body) {
    PendingWorkflowInvocation pending = workflows.getPendingWorkflow(invocationId);
    String remoteAddrStr = httpRequest.getRemoteAddr();
    IpAddress remoteAddr = IpAddress.valueOf((remoteAddrStr != null) ? remoteAddrStr : "0.0.0.0");
    if (!isAllowed(remoteAddr)) {
        return unauthorized("Sorry, your IP address is not authorized to send resume requests. Please contact an admin.");
    }
    Logger.getLogger(Workflows.class.getName()).log(Level.INFO, "Resume request from: {0}", httpRequest.getRemoteAddr());
    if (pending == null) {
        return notFound("Cannot find workflow invocation with id " + invocationId);
    }
    workflows.resume(pending, body);
    return Response.accepted("/api/datasets/" + pending.getDataset().getId()).build();
}
Also used : IpAddress(edu.harvard.iq.dataverse.authorization.groups.impl.ipaddress.ip.IpAddress) PendingWorkflowInvocation(edu.harvard.iq.dataverse.workflow.PendingWorkflowInvocation) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST)

Aggregations

IpAddress (edu.harvard.iq.dataverse.authorization.groups.impl.ipaddress.ip.IpAddress)1 PendingWorkflowInvocation (edu.harvard.iq.dataverse.workflow.PendingWorkflowInvocation)1 POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1