use of edu.harvard.iq.dataverse.engine.command.impl.MoveDatasetCommand in project dataverse by IQSS.
the class Datasets method moveDataset.
@POST
@Path("{id}/move/{targetDataverseAlias}")
public Response moveDataset(@PathParam("id") String id, @PathParam("targetDataverseAlias") String targetDataverseAlias, @QueryParam("forceMove") Boolean force) {
try {
System.out.print("force: " + force);
User u = findUserOrDie();
Dataset ds = findDatasetOrDie(id);
Dataverse target = dataverseService.findByAlias(targetDataverseAlias);
if (target == null) {
return error(Response.Status.BAD_REQUEST, "Target Dataverse not found.");
}
// Command requires Super user - it will be tested by the command
execCommand(new MoveDatasetCommand(createDataverseRequest(u), ds, target, force));
return ok("Dataset moved successfully");
} catch (WrappedResponse ex) {
return ex.getResponse();
}
}
Aggregations