RED-3452: Fixed undelete legal basis changes

This commit is contained in:
deiflaender 2022-02-18 16:17:17 +01:00
parent 400c602868
commit 5bd2b55359

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);
}