RED-8385: delete viewer doc, when rotating origin file, such that it is recreated with the rotation #348
@ -253,6 +253,8 @@ public class FileManagementController implements FileManagementResource {
|
||||
.pages(rotatePagesRequest.getPages())
|
||||
.build());
|
||||
|
||||
fileService.deleteViewerDocument(dossierId, fileId);
|
||||
|
||||
fileStatusManagementService.updateFileModificationDate(fileId);
|
||||
|
||||
FileModel fileModel = fileStatusManagementService.getFileStatus(fileId);
|
||||
|
||||
@ -113,41 +113,47 @@ public class FileService {
|
||||
|
||||
public void softDeleteFile(String dossierId, String fileId, OffsetDateTime softDeletedTime) {
|
||||
|
||||
forceRedactionPersistenceService.findForceRedactions(fileId, false).forEach(annotation -> {
|
||||
forceRedactionPersistenceService.softDelete(fileId, annotation.getId().getAnnotationId(), softDeletedTime);
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), false)
|
||||
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
||||
});
|
||||
forceRedactionPersistenceService.findForceRedactions(fileId, false)
|
||||
.forEach(annotation -> {
|
||||
forceRedactionPersistenceService.softDelete(fileId, annotation.getId().getAnnotationId(), softDeletedTime);
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), false)
|
||||
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
||||
});
|
||||
|
||||
removeRedactionPersistenceService.findRemoveRedactions(fileId, false).forEach(annotation -> {
|
||||
removeRedactionPersistenceService.softDelete(fileId, annotation.getId().getAnnotationId(), softDeletedTime);
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), false)
|
||||
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
||||
});
|
||||
removeRedactionPersistenceService.findRemoveRedactions(fileId, false)
|
||||
.forEach(annotation -> {
|
||||
removeRedactionPersistenceService.softDelete(fileId, annotation.getId().getAnnotationId(), softDeletedTime);
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), false)
|
||||
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
||||
});
|
||||
|
||||
addRedactionPersistenceService.findAddRedactions(fileId, false).forEach(annotation -> {
|
||||
addRedactionPersistenceService.softDelete(fileId, annotation.getId().getAnnotationId(), softDeletedTime);
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), false)
|
||||
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
||||
});
|
||||
addRedactionPersistenceService.findAddRedactions(fileId, false)
|
||||
.forEach(annotation -> {
|
||||
addRedactionPersistenceService.softDelete(fileId, annotation.getId().getAnnotationId(), softDeletedTime);
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), false)
|
||||
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
||||
});
|
||||
|
||||
recategorizationPersistenceService.findRecategorizations(fileId, false).forEach(recatigorization -> {
|
||||
recategorizationPersistenceService.softDelete(fileId, recatigorization.getId().getAnnotationId(), softDeletedTime);
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, recatigorization.getId().getAnnotationId(), false)
|
||||
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
||||
});
|
||||
recategorizationPersistenceService.findRecategorizations(fileId, false)
|
||||
.forEach(recatigorization -> {
|
||||
recategorizationPersistenceService.softDelete(fileId, recatigorization.getId().getAnnotationId(), softDeletedTime);
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, recatigorization.getId().getAnnotationId(), false)
|
||||
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
||||
});
|
||||
|
||||
resizeRedactionPersistenceService.findResizeRedactions(fileId, false).forEach(annotation -> {
|
||||
resizeRedactionPersistenceService.softDelete(fileId, annotation.getId().getAnnotationId(), softDeletedTime);
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), false)
|
||||
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
||||
});
|
||||
resizeRedactionPersistenceService.findResizeRedactions(fileId, false)
|
||||
.forEach(annotation -> {
|
||||
resizeRedactionPersistenceService.softDelete(fileId, annotation.getId().getAnnotationId(), softDeletedTime);
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), false)
|
||||
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
||||
});
|
||||
|
||||
legalBasisChangePersistenceService.findLegalBasisChanges(fileId, false).forEach(legalBasisChange -> {
|
||||
legalBasisChangePersistenceService.softDelete(fileId, legalBasisChange.getId().getAnnotationId(), softDeletedTime);
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, legalBasisChange.getId().getAnnotationId(), false)
|
||||
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
||||
});
|
||||
legalBasisChangePersistenceService.findLegalBasisChanges(fileId, false)
|
||||
.forEach(legalBasisChange -> {
|
||||
legalBasisChangePersistenceService.softDelete(fileId, legalBasisChange.getId().getAnnotationId(), softDeletedTime);
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, legalBasisChange.getId().getAnnotationId(), false)
|
||||
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
||||
});
|
||||
|
||||
viewedPagesPersistenceService.deleteForFile(fileId);
|
||||
indexingService.addToIndexingQueue(IndexMessageType.UPDATE, null, dossierId, fileId, 2);
|
||||
@ -170,43 +176,49 @@ public class FileService {
|
||||
|
||||
public void hardDeleteFile(String dossierId, String fileId) {
|
||||
|
||||
Arrays.stream(FileType.values()).forEach(fileType -> {
|
||||
try {
|
||||
fileManagementStorageService.deleteObject(dossierId, fileId, fileType);
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to physically delete file: {} with type {}", fileId, fileType);
|
||||
}
|
||||
});
|
||||
Arrays.stream(FileType.values())
|
||||
.forEach(fileType -> {
|
||||
try {
|
||||
fileManagementStorageService.deleteObject(dossierId, fileId, fileType);
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to physically delete file: {} with type {}", fileId, fileType);
|
||||
}
|
||||
});
|
||||
|
||||
forceRedactionPersistenceService.findForceRedactions(fileId, true).forEach(annotation -> {
|
||||
forceRedactionPersistenceService.hardDelete(fileId, annotation.getId().getAnnotationId());
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
||||
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
||||
});
|
||||
forceRedactionPersistenceService.findForceRedactions(fileId, true)
|
||||
.forEach(annotation -> {
|
||||
forceRedactionPersistenceService.hardDelete(fileId, annotation.getId().getAnnotationId());
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
||||
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
||||
});
|
||||
|
||||
removeRedactionPersistenceService.findRemoveRedactions(fileId, true).forEach(annotation -> {
|
||||
removeRedactionPersistenceService.hardDelete(fileId, annotation.getId().getAnnotationId());
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
||||
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
||||
});
|
||||
removeRedactionPersistenceService.findRemoveRedactions(fileId, true)
|
||||
.forEach(annotation -> {
|
||||
removeRedactionPersistenceService.hardDelete(fileId, annotation.getId().getAnnotationId());
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
||||
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
||||
});
|
||||
|
||||
addRedactionPersistenceService.findAddRedactions(fileId, true).forEach(annotation -> {
|
||||
addRedactionPersistenceService.hardDelete(fileId, annotation.getId().getAnnotationId());
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
||||
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
||||
});
|
||||
addRedactionPersistenceService.findAddRedactions(fileId, true)
|
||||
.forEach(annotation -> {
|
||||
addRedactionPersistenceService.hardDelete(fileId, annotation.getId().getAnnotationId());
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
||||
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
||||
});
|
||||
|
||||
recategorizationPersistenceService.findRecategorizations(fileId, true).forEach(recatigorization -> {
|
||||
recategorizationPersistenceService.hardDelete(fileId, recatigorization.getId().getAnnotationId());
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, recatigorization.getId().getAnnotationId(), true)
|
||||
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
||||
});
|
||||
recategorizationPersistenceService.findRecategorizations(fileId, true)
|
||||
.forEach(recatigorization -> {
|
||||
recategorizationPersistenceService.hardDelete(fileId, recatigorization.getId().getAnnotationId());
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, recatigorization.getId().getAnnotationId(), true)
|
||||
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
||||
});
|
||||
|
||||
resizeRedactionPersistenceService.findResizeRedactions(fileId, true).forEach(annotation -> {
|
||||
resizeRedactionPersistenceService.hardDelete(fileId, annotation.getId().getAnnotationId());
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
||||
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
||||
});
|
||||
resizeRedactionPersistenceService.findResizeRedactions(fileId, true)
|
||||
.forEach(annotation -> {
|
||||
resizeRedactionPersistenceService.hardDelete(fileId, annotation.getId().getAnnotationId());
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
||||
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
||||
});
|
||||
indexingService.addToDeleteFromIndexQueue(dossierId, fileId, 2);
|
||||
|
||||
}
|
||||
@ -232,75 +244,95 @@ public class FileService {
|
||||
|
||||
public void undeleteFile(String dossierTemplateId, String dossierId, String fileId, OffsetDateTime softDeletedTime) {
|
||||
|
||||
forceRedactionPersistenceService.findForceRedactions(fileId, true).forEach(annotation -> {
|
||||
if (annotation.getSoftDeletedTime().equals(softDeletedTime) || annotation.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||
forceRedactionPersistenceService.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());
|
||||
forceRedactionPersistenceService.findForceRedactions(fileId, true)
|
||||
.forEach(annotation -> {
|
||||
if (annotation.getSoftDeletedTime().equals(softDeletedTime) || annotation.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||
forceRedactionPersistenceService.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());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
removeRedactionPersistenceService.findRemoveRedactions(fileId, true).forEach(annotation -> {
|
||||
if (annotation.getSoftDeletedTime().equals(softDeletedTime) || annotation.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||
removeRedactionPersistenceService.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());
|
||||
removeRedactionPersistenceService.findRemoveRedactions(fileId, true)
|
||||
.forEach(annotation -> {
|
||||
if (annotation.getSoftDeletedTime().equals(softDeletedTime) || annotation.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||
removeRedactionPersistenceService.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());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
addRedactionPersistenceService.findAddRedactions(fileId, true).forEach(annotation -> {
|
||||
if (annotation != null && annotation.getSoftDeletedTime() != null && (annotation.getSoftDeletedTime().equals(softDeletedTime) || annotation.getSoftDeletedTime()
|
||||
.isAfter(softDeletedTime))) {
|
||||
addRedactionPersistenceService.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());
|
||||
addRedactionPersistenceService.findAddRedactions(fileId, true)
|
||||
.forEach(annotation -> {
|
||||
if (annotation != null && annotation.getSoftDeletedTime() != null && (annotation.getSoftDeletedTime().equals(softDeletedTime) || annotation.getSoftDeletedTime()
|
||||
.isAfter(softDeletedTime))) {
|
||||
addRedactionPersistenceService.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());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
recategorizationPersistenceService.findRecategorizations(fileId, true).forEach(recatigorization -> {
|
||||
if (recatigorization.getSoftDeletedTime().equals(softDeletedTime) || recatigorization.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||
recategorizationPersistenceService.undelete(fileId, recatigorization.getId().getAnnotationId());
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, recatigorization.getId().getAnnotationId(), true).forEach(comment -> {
|
||||
if (comment.getSoftDeletedTime().equals(softDeletedTime) || comment.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||
commentPersistenceService.undelete(comment.getId());
|
||||
recategorizationPersistenceService.findRecategorizations(fileId, true)
|
||||
.forEach(recatigorization -> {
|
||||
if (recatigorization.getSoftDeletedTime().equals(softDeletedTime) || recatigorization.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||
recategorizationPersistenceService.undelete(fileId, recatigorization.getId().getAnnotationId());
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, recatigorization.getId().getAnnotationId(), true)
|
||||
.forEach(comment -> {
|
||||
if (comment.getSoftDeletedTime().equals(softDeletedTime) || comment.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||
commentPersistenceService.undelete(comment.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
resizeRedactionPersistenceService.findResizeRedactions(fileId, true).forEach(annotation -> {
|
||||
if (annotation.getSoftDeletedTime().equals(softDeletedTime) || annotation.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||
resizeRedactionPersistenceService.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());
|
||||
resizeRedactionPersistenceService.findResizeRedactions(fileId, true)
|
||||
.forEach(annotation -> {
|
||||
if (annotation.getSoftDeletedTime().equals(softDeletedTime) || annotation.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||
resizeRedactionPersistenceService.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());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
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());
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void deleteViewerDocument(String dossierId, String fileId) {
|
||||
|
||||
if (fileManagementStorageService.objectExists(dossierId, fileId, FileType.VIEWER_DOCUMENT)) {
|
||||
fileManagementStorageService.deleteObject(dossierId, fileId, FileType.VIEWER_DOCUMENT);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user