Skip to content

Commit

Permalink
Merge pull request #1937 from jcomedouteau/shanoir-issue#1922-acquisi…
Browse files Browse the repository at this point in the history
…tion-deletion

#1922-acquisition-deletion
  • Loading branch information
michaelkain authored Oct 31, 2023
2 parents 60d9be5 + 472f621 commit 9b25ad3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ public void deleteById(final Long id) throws ShanoirException, SolrServerExcepti
if (datasetDb == null) {
throw new EntityNotFoundException(Dataset.class, id);
}
repository.deleteById(id);
solrService.deleteFromIndex(id);
this.deleteDatasetFromPacs(datasetDb);
repository.deleteById(id);
shanoirEventService.publishEvent(new ShanoirEvent(ShanoirEventType.DELETE_DATASET_EVENT, id.toString(), KeycloakUtil.getTokenUserId(), "", ShanoirEvent.SUCCESS, datasetDb.getStudyId()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public void deleteDicomFilesFromPacs(String url) throws ShanoirException {
HttpPost post = new HttpPost(rejectURL);
post.setHeader(HttpHeaders.CONTENT_TYPE, CONTENT_TYPE_JSON);
try (CloseableHttpResponse response = httpClient.execute(post)) {
if (response.getCode() == HttpStatus.NO_CONTENT.value()) {
if (HttpStatus.OK.value() == response.getCode()) {
LOG.info("Rejected from PACS: " + url);
} else {
LOG.error(response.getCode() + ": Could not reject instance from PACS: " + response.getReasonPhrase()
Expand All @@ -304,8 +304,8 @@ public void deleteDicomFilesFromPacs(String url) throws ShanoirException {
+ "for rejectURL: " + rejectURL);
}
} catch (IOException e) {
LOG.error(e.getMessage(), e);
throw new ShanoirException(e.getMessage());
LOG.error("Could not reject instance from PACS: for rejectURL: " + rejectURL, e);
throw new ShanoirException("Could not reject instance from PACS: for rejectURL: " + url, e);
}
// STEP 2: Delete from the PACS
HttpDelete delete = new HttpDelete(deleteUrl);
Expand Down

0 comments on commit 9b25ad3

Please sign in to comment.