use of edu.harvard.iq.dataverse.engine.command.impl.DeleteMapLayerMetadataCommand in project dataverse by IQSS.
the class Files method getMapLayerMetadatas.
// end: replaceFileInDataset
@DELETE
@Path("{id}/map")
public Response getMapLayerMetadatas(@PathParam("id") Long idSupplied) {
DataverseRequest dataverseRequest = null;
try {
dataverseRequest = createDataverseRequest(findUserOrDie());
} catch (WrappedResponse wr) {
return error(BAD_REQUEST, "Couldn't find user to execute command: " + wr.getLocalizedMessage());
}
DataFile dataFile = fileService.find(idSupplied);
try {
boolean deleted = engineSvc.submit(new DeleteMapLayerMetadataCommand(dataverseRequest, dataFile));
if (deleted) {
return ok("Map deleted from file id " + dataFile.getId());
} else {
return error(BAD_REQUEST, "Could not delete map from file id " + dataFile.getId());
}
} catch (CommandException ex) {
return error(BAD_REQUEST, "Problem trying to delete map from file id " + dataFile.getId() + ": " + ex.getLocalizedMessage());
}
}
Aggregations