From 440c64a03739c7851f1673f7c19ee39219cae8cb Mon Sep 17 00:00:00 2001 From: Ali Oezyetimoglu Date: Mon, 15 Apr 2024 13:49:20 +0200 Subject: [PATCH] RED-8762: do not update addToDictionaryAction for dossier dictionaries when updating dossier template dictionary ONLY if dossierDictionaryOnly --- .../v1/processor/service/DictionaryService.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/service/DictionaryService.java b/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/service/DictionaryService.java index 46d087172..484fd0c37 100644 --- a/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/service/DictionaryService.java +++ b/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/service/DictionaryService.java @@ -129,7 +129,7 @@ public class DictionaryService { updateType(dossierTemplateId, toTypeId(type, dossierTemplateId), typeValue); var dossierTypes = dictionaryPersistenceService.getAllDossierTypesForDossierTemplateAndType(dossierTemplateId, type, false); - dossierTypes.forEach(t -> this.updateDossierType(t.getType(), dossierTemplateId, typeValue, t.getDossierId())); + dossierTypes.forEach(t -> this.updateDossierType(t.getType(), dossierTemplateId, typeValue, t.getDossierId(), t)); } @@ -155,11 +155,12 @@ public class DictionaryService { @PreAuthorize("hasAuthority('" + ADD_UPDATE_DOSSIER_DICTIONARY_TYPE + "')") - public void updateDossierType(String type, String dossierTemplateId, UpdateTypeValue typeValue, String dossierId) { + public void updateDossierType(String type, String dossierTemplateId, UpdateTypeValue typeValue, String dossierId, TypeEntity typeEntity) { accessControlService.verifyUserIsDossierOwner(dossierId); - // we do not set the flag addToDictionaryAction when updating the global type - dictionaryManagementService.updateTypeValue(toTypeId(type, dossierTemplateId, dossierId), + + if (typeEntity.isDossierDictionaryOnly()) { + dictionaryManagementService.updateTypeValue(toTypeId(type, dossierTemplateId, dossierId), Type.builder() .dossierTemplateId(dossierTemplateId) .hexColor(typeValue.getHexColor()) @@ -170,10 +171,14 @@ public class DictionaryService { .isCaseInsensitive(typeValue.isCaseInsensitive()) .isRecommendation(typeValue.isRecommendation()) .description(typeValue.getDescription()) + .addToDictionaryAction(typeEntity.isAddToDictionaryAction()) .label(typeValue.getLabel()) .hasDictionary(typeValue.isHasDictionary()) .autoHideSkipped(typeValue.isAutoHideSkipped()) .build()); + } else { + updateType(dossierTemplateId, toTypeId(type, dossierTemplateId, dossierId), typeValue); + } } -- 2.47.2