Pull request #250: RED-3452: Fixed undelete legal basis changes

Merge in RED/persistence-service from RED-3452-1 to master

* commit '5bd2b553593aae99d763391de162ead53b06f1d1':
  RED-3452: Fixed undelete legal basis changes
This commit is contained in:
Dominique Eiflaender 2022-02-18 16:32:52 +01:00
commit ce560497e3

View File

@ -5,6 +5,7 @@ import java.time.OffsetDateTime;
import java.util.Arrays;
import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.dossier.file.FileModel;
import org.springframework.stereotype.Service;
import com.google.common.hash.HashFunction;
@ -293,6 +294,20 @@ public class FileService {
}
});
legalBasisChangePersistenceService.findLegalBasisChanges(fileId, true).forEach(annotation -> {
if (annotation.getSoftDeletedTime().equals(softDeletedTime) || annotation.getSoftDeletedTime()
.isAfter(softDeletedTime)) {
legalBasisChangePersistenceService.undelete(fileId, annotation.getId().getAnnotationId());
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
.forEach(comment -> {
if (comment.getSoftDeletedTime().equals(softDeletedTime) || comment.getSoftDeletedTime()
.isAfter(softDeletedTime)) {
commentPersistenceService.undelete(comment.getId());
}
});
}
});
indexingService.addToIndexingQueue(IndexMessageType.UPDATE, dossierTemplateId, dossierId, fileId, 2);
}