RED-8385: delete viewer doc, when rotating origin file, such that it is recreated with the rotation
This commit is contained in:
parent
59b29ccd38
commit
768384a84c
@ -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,37 +113,43 @@ public class FileService {
|
||||
|
||||
public void softDeleteFile(String dossierId, String fileId, OffsetDateTime softDeletedTime) {
|
||||
|
||||
forceRedactionPersistenceService.findForceRedactions(fileId, false).forEach(annotation -> {
|
||||
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.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.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.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.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.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));
|
||||
@ -170,7 +176,8 @@ public class FileService {
|
||||
|
||||
public void hardDeleteFile(String dossierId, String fileId) {
|
||||
|
||||
Arrays.stream(FileType.values()).forEach(fileType -> {
|
||||
Arrays.stream(FileType.values())
|
||||
.forEach(fileType -> {
|
||||
try {
|
||||
fileManagementStorageService.deleteObject(dossierId, fileId, fileType);
|
||||
} catch (Exception e) {
|
||||
@ -178,31 +185,36 @@ public class FileService {
|
||||
}
|
||||
});
|
||||
|
||||
forceRedactionPersistenceService.findForceRedactions(fileId, true).forEach(annotation -> {
|
||||
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.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.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.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.findResizeRedactions(fileId, true)
|
||||
.forEach(annotation -> {
|
||||
resizeRedactionPersistenceService.hardDelete(fileId, annotation.getId().getAnnotationId());
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
||||
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
||||
@ -232,10 +244,12 @@ public class FileService {
|
||||
|
||||
public void undeleteFile(String dossierTemplateId, String dossierId, String fileId, OffsetDateTime softDeletedTime) {
|
||||
|
||||
forceRedactionPersistenceService.findForceRedactions(fileId, true).forEach(annotation -> {
|
||||
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 -> {
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
||||
.forEach(comment -> {
|
||||
if (comment.getSoftDeletedTime().equals(softDeletedTime) || comment.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||
commentPersistenceService.undelete(comment.getId());
|
||||
}
|
||||
@ -243,10 +257,12 @@ public class FileService {
|
||||
}
|
||||
});
|
||||
|
||||
removeRedactionPersistenceService.findRemoveRedactions(fileId, true).forEach(annotation -> {
|
||||
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 -> {
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
||||
.forEach(comment -> {
|
||||
if (comment.getSoftDeletedTime().equals(softDeletedTime) || comment.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||
commentPersistenceService.undelete(comment.getId());
|
||||
}
|
||||
@ -254,11 +270,13 @@ public class FileService {
|
||||
}
|
||||
});
|
||||
|
||||
addRedactionPersistenceService.findAddRedactions(fileId, true).forEach(annotation -> {
|
||||
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 -> {
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
||||
.forEach(comment -> {
|
||||
if (comment.getSoftDeletedTime().equals(softDeletedTime) || comment.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||
commentPersistenceService.undelete(comment.getId());
|
||||
}
|
||||
@ -266,10 +284,12 @@ public class FileService {
|
||||
}
|
||||
});
|
||||
|
||||
recategorizationPersistenceService.findRecategorizations(fileId, true).forEach(recatigorization -> {
|
||||
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 -> {
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, recatigorization.getId().getAnnotationId(), true)
|
||||
.forEach(comment -> {
|
||||
if (comment.getSoftDeletedTime().equals(softDeletedTime) || comment.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||
commentPersistenceService.undelete(comment.getId());
|
||||
}
|
||||
@ -277,10 +297,12 @@ public class FileService {
|
||||
}
|
||||
});
|
||||
|
||||
resizeRedactionPersistenceService.findResizeRedactions(fileId, true).forEach(annotation -> {
|
||||
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 -> {
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
||||
.forEach(comment -> {
|
||||
if (comment.getSoftDeletedTime().equals(softDeletedTime) || comment.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||
commentPersistenceService.undelete(comment.getId());
|
||||
}
|
||||
@ -288,10 +310,12 @@ public class FileService {
|
||||
}
|
||||
});
|
||||
|
||||
legalBasisChangePersistenceService.findLegalBasisChanges(fileId, true).forEach(annotation -> {
|
||||
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 -> {
|
||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
||||
.forEach(comment -> {
|
||||
if (comment.getSoftDeletedTime().equals(softDeletedTime) || comment.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||
commentPersistenceService.undelete(comment.getId());
|
||||
}
|
||||
@ -303,4 +327,12 @@ public class FileService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
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