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())
|
.pages(rotatePagesRequest.getPages())
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
fileService.deleteViewerDocument(dossierId, fileId);
|
||||||
|
|
||||||
fileStatusManagementService.updateFileModificationDate(fileId);
|
fileStatusManagementService.updateFileModificationDate(fileId);
|
||||||
|
|
||||||
FileModel fileModel = fileStatusManagementService.getFileStatus(fileId);
|
FileModel fileModel = fileStatusManagementService.getFileStatus(fileId);
|
||||||
|
|||||||
@ -113,37 +113,43 @@ public class FileService {
|
|||||||
|
|
||||||
public void softDeleteFile(String dossierId, String fileId, OffsetDateTime softDeletedTime) {
|
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);
|
forceRedactionPersistenceService.softDelete(fileId, annotation.getId().getAnnotationId(), softDeletedTime);
|
||||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), false)
|
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), false)
|
||||||
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
.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);
|
removeRedactionPersistenceService.softDelete(fileId, annotation.getId().getAnnotationId(), softDeletedTime);
|
||||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), false)
|
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), false)
|
||||||
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
.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);
|
addRedactionPersistenceService.softDelete(fileId, annotation.getId().getAnnotationId(), softDeletedTime);
|
||||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), false)
|
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), false)
|
||||||
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
.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);
|
recategorizationPersistenceService.softDelete(fileId, recatigorization.getId().getAnnotationId(), softDeletedTime);
|
||||||
commentPersistenceService.findCommentsByAnnotationId(fileId, recatigorization.getId().getAnnotationId(), false)
|
commentPersistenceService.findCommentsByAnnotationId(fileId, recatigorization.getId().getAnnotationId(), false)
|
||||||
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
.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);
|
resizeRedactionPersistenceService.softDelete(fileId, annotation.getId().getAnnotationId(), softDeletedTime);
|
||||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), false)
|
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), false)
|
||||||
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
.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);
|
legalBasisChangePersistenceService.softDelete(fileId, legalBasisChange.getId().getAnnotationId(), softDeletedTime);
|
||||||
commentPersistenceService.findCommentsByAnnotationId(fileId, legalBasisChange.getId().getAnnotationId(), false)
|
commentPersistenceService.findCommentsByAnnotationId(fileId, legalBasisChange.getId().getAnnotationId(), false)
|
||||||
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
.forEach(comment -> commentPersistenceService.softDelete(comment.getId(), softDeletedTime));
|
||||||
@ -170,7 +176,8 @@ public class FileService {
|
|||||||
|
|
||||||
public void hardDeleteFile(String dossierId, String fileId) {
|
public void hardDeleteFile(String dossierId, String fileId) {
|
||||||
|
|
||||||
Arrays.stream(FileType.values()).forEach(fileType -> {
|
Arrays.stream(FileType.values())
|
||||||
|
.forEach(fileType -> {
|
||||||
try {
|
try {
|
||||||
fileManagementStorageService.deleteObject(dossierId, fileId, fileType);
|
fileManagementStorageService.deleteObject(dossierId, fileId, fileType);
|
||||||
} catch (Exception e) {
|
} 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());
|
forceRedactionPersistenceService.hardDelete(fileId, annotation.getId().getAnnotationId());
|
||||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
||||||
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
||||||
});
|
});
|
||||||
|
|
||||||
removeRedactionPersistenceService.findRemoveRedactions(fileId, true).forEach(annotation -> {
|
removeRedactionPersistenceService.findRemoveRedactions(fileId, true)
|
||||||
|
.forEach(annotation -> {
|
||||||
removeRedactionPersistenceService.hardDelete(fileId, annotation.getId().getAnnotationId());
|
removeRedactionPersistenceService.hardDelete(fileId, annotation.getId().getAnnotationId());
|
||||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
||||||
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
||||||
});
|
});
|
||||||
|
|
||||||
addRedactionPersistenceService.findAddRedactions(fileId, true).forEach(annotation -> {
|
addRedactionPersistenceService.findAddRedactions(fileId, true)
|
||||||
|
.forEach(annotation -> {
|
||||||
addRedactionPersistenceService.hardDelete(fileId, annotation.getId().getAnnotationId());
|
addRedactionPersistenceService.hardDelete(fileId, annotation.getId().getAnnotationId());
|
||||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
||||||
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
||||||
});
|
});
|
||||||
|
|
||||||
recategorizationPersistenceService.findRecategorizations(fileId, true).forEach(recatigorization -> {
|
recategorizationPersistenceService.findRecategorizations(fileId, true)
|
||||||
|
.forEach(recatigorization -> {
|
||||||
recategorizationPersistenceService.hardDelete(fileId, recatigorization.getId().getAnnotationId());
|
recategorizationPersistenceService.hardDelete(fileId, recatigorization.getId().getAnnotationId());
|
||||||
commentPersistenceService.findCommentsByAnnotationId(fileId, recatigorization.getId().getAnnotationId(), true)
|
commentPersistenceService.findCommentsByAnnotationId(fileId, recatigorization.getId().getAnnotationId(), true)
|
||||||
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
||||||
});
|
});
|
||||||
|
|
||||||
resizeRedactionPersistenceService.findResizeRedactions(fileId, true).forEach(annotation -> {
|
resizeRedactionPersistenceService.findResizeRedactions(fileId, true)
|
||||||
|
.forEach(annotation -> {
|
||||||
resizeRedactionPersistenceService.hardDelete(fileId, annotation.getId().getAnnotationId());
|
resizeRedactionPersistenceService.hardDelete(fileId, annotation.getId().getAnnotationId());
|
||||||
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
commentPersistenceService.findCommentsByAnnotationId(fileId, annotation.getId().getAnnotationId(), true)
|
||||||
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
.forEach(comment -> commentPersistenceService.hardDelete(comment.getId()));
|
||||||
@ -232,10 +244,12 @@ public class FileService {
|
|||||||
|
|
||||||
public void undeleteFile(String dossierTemplateId, String dossierId, String fileId, OffsetDateTime softDeletedTime) {
|
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)) {
|
if (annotation.getSoftDeletedTime().equals(softDeletedTime) || annotation.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||||
forceRedactionPersistenceService.undelete(fileId, annotation.getId().getAnnotationId());
|
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)) {
|
if (comment.getSoftDeletedTime().equals(softDeletedTime) || comment.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||||
commentPersistenceService.undelete(comment.getId());
|
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)) {
|
if (annotation.getSoftDeletedTime().equals(softDeletedTime) || annotation.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||||
removeRedactionPersistenceService.undelete(fileId, annotation.getId().getAnnotationId());
|
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)) {
|
if (comment.getSoftDeletedTime().equals(softDeletedTime) || comment.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||||
commentPersistenceService.undelete(comment.getId());
|
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()
|
if (annotation != null && annotation.getSoftDeletedTime() != null && (annotation.getSoftDeletedTime().equals(softDeletedTime) || annotation.getSoftDeletedTime()
|
||||||
.isAfter(softDeletedTime))) {
|
.isAfter(softDeletedTime))) {
|
||||||
addRedactionPersistenceService.undelete(fileId, annotation.getId().getAnnotationId());
|
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)) {
|
if (comment.getSoftDeletedTime().equals(softDeletedTime) || comment.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||||
commentPersistenceService.undelete(comment.getId());
|
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)) {
|
if (recatigorization.getSoftDeletedTime().equals(softDeletedTime) || recatigorization.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||||
recategorizationPersistenceService.undelete(fileId, recatigorization.getId().getAnnotationId());
|
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)) {
|
if (comment.getSoftDeletedTime().equals(softDeletedTime) || comment.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||||
commentPersistenceService.undelete(comment.getId());
|
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)) {
|
if (annotation.getSoftDeletedTime().equals(softDeletedTime) || annotation.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||||
resizeRedactionPersistenceService.undelete(fileId, annotation.getId().getAnnotationId());
|
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)) {
|
if (comment.getSoftDeletedTime().equals(softDeletedTime) || comment.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||||
commentPersistenceService.undelete(comment.getId());
|
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)) {
|
if (annotation.getSoftDeletedTime().equals(softDeletedTime) || annotation.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||||
legalBasisChangePersistenceService.undelete(fileId, annotation.getId().getAnnotationId());
|
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)) {
|
if (comment.getSoftDeletedTime().equals(softDeletedTime) || comment.getSoftDeletedTime().isAfter(softDeletedTime)) {
|
||||||
commentPersistenceService.undelete(comment.getId());
|
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