From 0e645ab273114b4d1b0c7ec78e1cef1db4d4f227 Mon Sep 17 00:00:00 2001 From: Timo Date: Thu, 26 Nov 2020 20:12:36 +0200 Subject: [PATCH] fixed Tests & fallback --- .../redaction/service/DictionaryService.java | 22 ++++++++++++++++++- .../service/AnnotationHighlightService.java | 15 +++---------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/service/DictionaryService.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/service/DictionaryService.java index b6dd23d6..ce246b5b 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/service/DictionaryService.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/service/DictionaryService.java @@ -122,6 +122,26 @@ public class DictionaryService { } public boolean isCaseInsensitiveDictionary(String type) { - return localAccessMap.get(type).isCaseInsensitive(); + DictionaryModel dictionaryModel = localAccessMap.get(type); + if (dictionaryModel != null) { + return dictionaryModel.isCaseInsensitive(); + } + return false; + } + + public float[] getColor(String type) { + DictionaryModel model = localAccessMap.get(type); + if (model != null) { + return model.getColor(); + } + return defaultColor; + } + + public boolean isHint(String type) { + DictionaryModel model = localAccessMap.get(type); + if (model != null) { + return model.isHint(); + } + return false; } } \ No newline at end of file diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/visualization/service/AnnotationHighlightService.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/visualization/service/AnnotationHighlightService.java index 7eac420c..f2f09acd 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/visualization/service/AnnotationHighlightService.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/visualization/service/AnnotationHighlightService.java @@ -401,10 +401,7 @@ public class AnnotationHighlightService { if (!entity.isRedaction() && !isHint(entity)) { return dictionaryService.getNotRedactedColor(); } - if (!dictionaryService.getEntryColors().containsKey(entity.getType())) { - return dictionaryService.getDefaultColor(); - } - return dictionaryService.getEntryColors().get(entity.getType()); + return dictionaryService.getColor(entity.getType()); } @@ -420,18 +417,12 @@ public class AnnotationHighlightService { private float[] getColor(String type) { - - if (!dictionaryService.getEntryColors().containsKey(type)) { - return dictionaryService.getDefaultColor(); - } - return dictionaryService.getEntryColors().get(type); + return dictionaryService.getColor(type); } private boolean isHint(Entity entity) { - - List hintTypes = dictionaryService.getHintTypes(); - return CollectionUtils.isNotEmpty(hintTypes) && hintTypes.contains(entity.getType()); + return dictionaryService.isHint(entity.getType()); }