Skip to content

Commit

Permalink
fix logic
Browse files Browse the repository at this point in the history
  • Loading branch information
qqmyers committed Feb 14, 2024
1 parent 7de7f43 commit 51fe60c
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions src/main/java/edu/harvard/iq/dataverse/api/Files.java
Original file line number Diff line number Diff line change
Expand Up @@ -655,27 +655,24 @@ public Response uningestDatafile(@Context ContainerRequestContext crc, @PathPara
}
dataFile.setIngestDone();
dataFile.setIngestReport(null);
return ok("Datafile " + dataFile.getId() + " uningested.");
} else {
return error(Response.Status.BAD_REQUEST,
BundleUtil.getStringFromBundle("file.ingest.cantUningestFileWarning"));
BundleUtil.getStringFromBundle("Cannot uningest non-tabular file."));
}
} else {
try {
DataverseRequest req = createDataverseRequest(getRequestUser(crc));
execCommand(new UningestFileCommand(req, dataFile));
Long dataFileId = dataFile.getId();
dataFile = fileService.find(dataFileId);
Dataset theDataset = dataFile.getOwner();
exportDatasetMetadata(settingsService, theDataset);
return ok("Datafile " + dataFileId + " uningested.");
} catch (WrappedResponse wr) {
return wr.getResponse();
}
}
if (!dataFile.isTabularData()) {
return error(Response.Status.BAD_REQUEST, "Cannot uningest non-tabular file.");
}

try {
DataverseRequest req = createDataverseRequest(getRequestUser(crc));
execCommand(new UningestFileCommand(req, dataFile));
Long dataFileId = dataFile.getId();
dataFile = fileService.find(dataFileId);
Dataset theDataset = dataFile.getOwner();
exportDatasetMetadata(settingsService, theDataset);
return ok("Datafile " + dataFileId + " uningested.");
} catch (WrappedResponse wr) {
return wr.getResponse();
}

}

// reingest attempts to queue an *existing* DataFile
Expand Down

0 comments on commit 51fe60c

Please sign in to comment.