diff --git a/redaction-service-v1/redaction-service-api-v1/build.gradle.kts b/redaction-service-v1/redaction-service-api-v1/build.gradle.kts index 0d385f43..5e08a2fc 100644 --- a/redaction-service-v1/redaction-service-api-v1/build.gradle.kts +++ b/redaction-service-v1/redaction-service-api-v1/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } description = "redaction-service-api-v1" -val persistenceServiceVersion = "2.574.0" +val persistenceServiceVersion = "2.580.0" dependencies { implementation("org.springframework:spring-web:6.0.12") diff --git a/redaction-service-v1/redaction-service-server-v1/build.gradle.kts b/redaction-service-v1/redaction-service-server-v1/build.gradle.kts index cd20988b..6a6f38c5 100644 --- a/redaction-service-v1/redaction-service-server-v1/build.gradle.kts +++ b/redaction-service-v1/redaction-service-server-v1/build.gradle.kts @@ -16,7 +16,7 @@ val layoutParserVersion = "0.174.0" val jacksonVersion = "2.15.2" val droolsVersion = "9.44.0.Final" val pdfBoxVersion = "3.0.0" -val persistenceServiceVersion = "2.574.0" +val persistenceServiceVersion = "2.580.0" val llmServiceVersion = "1.11.0" val springBootStarterVersion = "3.1.5" val springCloudVersion = "4.0.4" diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/AnalyzeService.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/AnalyzeService.java index 3dee194d..261c82e7 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/AnalyzeService.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/AnalyzeService.java @@ -382,6 +382,7 @@ public class AnalyzeService { ComponentLog componentLog = componentLogCreatorService.buildComponentLog(analyzeRequest.getAnalysisNumber(), components, kieWrapperComponentRules.rulesVersion(), + analyzeRequest.getComponentDefinitions(), context.getDateFormatsVersion()); redactionStorageService.saveComponentLog(analyzeRequest.getDossierId(), analyzeRequest.getFileId(), componentLog); diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/components/ComponentLogCreatorService.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/components/ComponentLogCreatorService.java index d0deceb6..e4c57ccb 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/components/ComponentLogCreatorService.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/components/ComponentLogCreatorService.java @@ -1,9 +1,15 @@ package com.iqser.red.service.redaction.v1.server.service.components; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; import org.springframework.stereotype.Service; @@ -12,6 +18,7 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.componentlog.ComponentLogEntry; import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.componentlog.ComponentLogEntryValue; import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.Position; +import com.iqser.red.service.persistence.service.v1.api.shared.model.component.ComponentDefinition; import com.iqser.red.service.redaction.v1.server.model.component.Component; import com.iqser.red.service.redaction.v1.server.model.component.Entity; import com.iqser.red.service.redaction.v1.server.service.document.ComponentComparator; @@ -20,7 +27,11 @@ import com.iqser.red.service.redaction.v1.server.service.document.EntityComparat @Service public class ComponentLogCreatorService { - public ComponentLog buildComponentLog(int analysisNumber, List components, long componentRulesVersion, long dateFormatsVersion) { + public ComponentLog buildComponentLog(int analysisNumber, + List components, + long componentRulesVersion, + List componentDefinitions, + long dateFormatsVersion) { Map> map = new HashMap<>(); components.stream() @@ -29,11 +40,23 @@ public class ComponentLogCreatorService { ComponentLogEntryValue componentLogEntryValue = buildComponentLogEntry(component); map.computeIfAbsent(component.getName(), k -> new ArrayList<>()).add(componentLogEntryValue); }); - List componentLogComponents = map.entrySet() + List componentLogEntries = map.entrySet() .stream() .map(entry -> new ComponentLogEntry(entry.getKey(), entry.getValue(), entry.getValue(), false)) - .toList(); - return new ComponentLog(analysisNumber, componentRulesVersion, dateFormatsVersion, componentLogComponents); + .collect(Collectors.toList()); + + Set existingComponentNames = map.keySet() + .stream() + .map(s -> s.toLowerCase(Locale.ROOT)) + .collect(Collectors.toSet()); + for (ComponentDefinition componentDefinition : componentDefinitions) { + String technicalName = componentDefinition.getTechnicalName().toLowerCase(Locale.ROOT); + if (!existingComponentNames.contains(technicalName)) { + componentLogEntries.add(new ComponentLogEntry(componentDefinition.getDisplayName(), null, null, false)); + } + } + + return new ComponentLog(analysisNumber, componentRulesVersion, dateFormatsVersion, componentLogEntries); }