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; |
| 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.
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.
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.
should be taken directly from id property of response
| } | ||
| } | ||
|
|
||
| private void updateCitationWithUpdatedGilesUpload(Set<IGilesUpload> checkedUploads, IUser user, ICitation citation, String documentId) { |
jdamerow
left a comment
There was a problem hiding this comment.
- 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.
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.
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.
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.
if the reprocessing throws an error, the return should not be ok.
|
Resolve conflicts please |
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 ...