-
Notifications
You must be signed in to change notification settings - Fork 4
Story/CITE-173 : Reprocessing Documents #248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Can one of the admins verify this patch? |
pr description needs to be filled out |
@Override | ||
public ResponseEntity<String> reprocessDocument(IUser user, String documentId) { | ||
ResponseEntity<String> response = sendRequest(user, reprocessingEndpoint.replace("{0}", documentId), String.class, HttpMethod.POST); | ||
return response; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge with line 75
throws GroupDoesNotExistException, CannotFindCitationException, ZoteroHttpStatusException, | ||
ZoteroConnectionException, CitationIsOutdatedException, ZoteroItemCreationFailedException { | ||
ICitation citation = getCitation(user, zoteroGroupId, itemId); | ||
for (Iterator<IGilesUpload> gilesUpload = citation.getGilesUploads().iterator(); gilesUpload.hasNext();) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be a while loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should actually be a stream that filters for the upload with the document id
checkedUploads.add(reprocessedUpload); | ||
updateCitationWithUpdatedGilesUpload(checkedUploads, user, citation, documentId); | ||
gilesUploadChecker.add(citation); | ||
} catch (IOException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move catch block up to where it is thrown.
try { | ||
jsonNode = objectMapper.readTree(responseBody); | ||
String checkUrl = jsonNode.get("checkUrl").asText(); | ||
String[] urlSegments = checkUrl.split("/"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be taken directly from id property of response
} | ||
} | ||
|
||
private void updateCitationWithUpdatedGilesUpload(Set<IGilesUpload> checkedUploads, IUser user, ICitation citation, String documentId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shorten method name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- there is a code factor issue
|
||
private void initiateReprocessing(IUser user, String documentId, ICitation citation) { | ||
ResponseEntity<String> reprocessingResponse = gilesConnector.reprocessDocument(user, documentId); | ||
if (reprocessingResponse.getStatusCode().equals(HttpStatus.OK)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's not ok, the user needs to know this.
JsonNode jsonNode = objectMapper.readTree(responseBody); | ||
progressId = jsonNode.get("id").asText(); | ||
} catch (IOException e) { | ||
logger.error("Could not deserialize response.", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should probably not simply be ignored but the user needs to know. the rest doesn't really make sense if this fails, does it?
logger.error("Could not get citation.", e); | ||
} catch (ZoteroHttpStatusException e) { | ||
logger.error("Could not get citation.", e); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, it seems like a bad idea to just ignore this
throws GroupDoesNotExistException, CannotFindCitationException, ZoteroHttpStatusException, | ||
ZoteroConnectionException, CitationIsOutdatedException, ZoteroItemCreationFailedException { | ||
citationManager.reprocessFile((IUser) authentication.getPrincipal(), zoteroGroupId, itemId, documentId); | ||
return new ResponseEntity<>(HttpStatus.OK); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the reprocessing throws an error, the return should not be ok.
Guidelines for Pull Requests
If you haven't yet read our code review guidelines, please do so, You can find them here.
Please confirm the following by adding an x for each item (turn
[ ]
into[x]
).Please provide a brief description of your ticket
https://diging.atlassian.net/browse/CITE-173
Added the reprocessing button for reprocessing the files
Are there any other pull requests that this one depends on?
Anything else the reviewer needs to know?
... describe here ...