RED-4497: Refactored method to remove resizeRedactions with addToDictionary
This commit is contained in:
parent
a49f67aa7d
commit
ae5e05e341
@ -816,15 +816,7 @@ public class ManualRedactionService {
|
||||
removeFromDictionary(buildTypeId(redactionLogEntry, dossier), redactionLogEntry.getValue(), dossier.getId(), fileId, DictionaryEntryType.ENTRY);
|
||||
|
||||
// This is needed to remove resizeRedactions with addToDictionary.
|
||||
var resizeRedactionsWithSameValue = resizeRedactionPersistenceService.findByAnnotationStatusAndValue(AnnotationStatus.APPROVED, redactionLogEntry.getValue());
|
||||
resizeRedactionsWithSameValue.forEach(resizeRedaction -> {
|
||||
var file = fileStatusPersistenceService.getStatus(resizeRedaction.getId().getFileId());
|
||||
var dossierForResizeRedaction = dossierPersistenceService.findByDossierId(file.getDossierId());
|
||||
if(!file.getWorkflowStatus().equals(WorkflowStatus.APPROVED) && dossier.getDossierTemplateId().equals(dossierForResizeRedaction.getDossierTemplateId())) {
|
||||
resizeRedactionPersistenceService.hardDelete(resizeRedaction.getId()
|
||||
.getFileId(), resizeRedaction.getId().getAnnotationId());
|
||||
}
|
||||
});
|
||||
removeResizeRedactionsWithAddToDictionary(dossier.getDossierTemplateId(), redactionLogEntry.getValue());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -832,6 +824,17 @@ public class ManualRedactionService {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void removeResizeRedactionsWithAddToDictionary(String dossierTemplateId, String redactionLogEntryValue) {
|
||||
var resizeRedactionsWithSameValue = resizeRedactionPersistenceService.findByAnnotationStatusAndValue(AnnotationStatus.APPROVED, redactionLogEntryValue);
|
||||
resizeRedactionsWithSameValue.forEach(resizeRedaction -> {
|
||||
var file = fileStatusPersistenceService.getStatus(resizeRedaction.getId().getFileId());
|
||||
var dossierForResizeRedaction = dossierPersistenceService.findByDossierId(file.getDossierId());
|
||||
if(!file.getWorkflowStatus().equals(WorkflowStatus.APPROVED) && dossierTemplateId.equals(dossierForResizeRedaction.getDossierTemplateId())) {
|
||||
resizeRedactionPersistenceService.hardDelete(resizeRedaction.getId()
|
||||
.getFileId(), resizeRedaction.getId().getAnnotationId());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addToDictionary(String typeId, String value, String dossierId, String fileId,
|
||||
DictionaryEntryType dictionaryEntryType) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user