Skip to content

Commit

Permalink
Correct stale Storage IDs of Studies on deletion fix #1722
Browse files Browse the repository at this point in the history
  • Loading branch information
gunterze committed Dec 5, 2018
1 parent 447161d commit 570a0ea
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ public boolean deleteObjectsOfStudy(Long studyPk, StorageDescriptor desc) {
.getResultList();
if (locations.isEmpty()) {
LOG.warn("{} does not contain objects at Storage{}", study, storageIDs);
updateStorageIDs(study, storageIDs);
return false;
}
LOG.debug("Start marking {} objects of {} for deletion at Storage{}", locations.size(), study, storageIDs);
Expand All @@ -273,12 +274,16 @@ public boolean deleteObjectsOfStudy(Long studyPk, StorageDescriptor desc) {
&& series.getMetadata() != null)
scheduleMetadataUpdate(series.getPk());
}
updateStorageIDs(study, storageIDs);
return true;
}

private void updateStorageIDs(Study study, List<String> storageIDs) {
String studyEncodedStorageIDs = study.getEncodedStorageIDs();
for (String storageID : storageIDs) {
study.removeStorageID(storageID);
}
LOG.info("Update Storage IDs of {} from {} to {}", study, studyEncodedStorageIDs, study.getEncodedStorageIDs());
return true;
}

public int deleteRejectedInstancesOrRejectionNotesBefore(
Expand Down

0 comments on commit 570a0ea

Please sign in to comment.