RED-8480: don't merge recategorizations for images, create pending entry instead

* TODO: remove filter in report-service and pdftron-redaction-service
This commit is contained in:
Kilian Schuettler 2024-03-28 15:42:12 +01:00 committed by Ali Oezyetimoglu
parent 75676c33b1
commit efc2b200ad
3 changed files with 5 additions and 4 deletions

View File

@ -52,7 +52,7 @@ public class ManualRedactionDictionaryUpdateHandler {
public Set<String> handleAddToDictionaryAndReturnModifiedTypeIds(String fileId, String value, ManualRequestWithAddToDictionary manualRequestWithAddToDictionary) {
if (!manualRequestWithAddToDictionary.isAddToDictionary()) {
if (!manualRequestWithAddToDictionary.isAddToDictionary() || value == null) {
return Collections.emptySet();
}
Set<String> typeIdsOfModifiedDictionaries = new HashSet<>();
@ -99,7 +99,7 @@ public class ManualRedactionDictionaryUpdateHandler {
public Set<String> handleRemoveFromDictionaryAndReturnModifiedTypeIds(String fileId, ManualRequestWithRemoveFromDictionary manualRequestWithRemoveFromDictionary) {
if (!manualRequestWithRemoveFromDictionary.isRemoveFromDictionary()) {
if (!manualRequestWithRemoveFromDictionary.isRemoveFromDictionary() || manualRequestWithRemoveFromDictionary.getValue() == null) {
return Collections.emptySet();
}
String dossierId = manualRequestWithRemoveFromDictionary.getDossierId();

View File

@ -191,13 +191,12 @@ public class ManualRedactionMapper {
.addToDictionary(recategorizationRequest.isAddToDictionary())
.addToAllDossiers(recategorizationRequest.isAddToAllDossiers())
.dictionaryEntryType(getDictionaryEntryType(entityLogEntry))
.value(entityLogEntry.getValue())
.value(recategorizationRequest.getValue())
.typeToRemove(entityLogEntry.getType())
.dossierTemplateTypeId(toTypeId(recategorizationRequest.getType(), dossierTemplateId))
.legalBasis(Optional.ofNullable(recategorizationRequest.getLegalBasis())
.orElse(""))
.section(recategorizationRequest.getSection())
.value(recategorizationRequest.getValue())
.build();
if (!entityLogEntry.getEngines().contains(Engine.MANUAL) && !recategorizationRequest.isAddToAllDossiers() && !recategorizationRequest.isAddToDictionary()) {

View File

@ -240,6 +240,7 @@ public class ManualRedactionService {
Set<String> typeIdsOfDictionariesWithAdd = manualRedactionDictionaryUpdateHandler.handleAddToDictionaryAndReturnModifiedTypeIds(fileId,
recategorizationRequest.getValue(),
recategorizationRequest);
Set<String> typeIdsOfDictionariesWithDelete = manualRedactionDictionaryUpdateHandler.handleRemoveFromDictionaryAndReturnModifiedTypeIds(fileId,
recategorizationRequest);
@ -255,6 +256,7 @@ public class ManualRedactionService {
response.add(ManualAddResponse.builder().annotationId(recategorizationRequest.getAnnotationId()).commentId(commentId).build());
}
reprocess(dossierId, fileId);
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());