RED-10146: Include defined components in component log
This commit is contained in:
parent
c7bd8c8a8d
commit
1cff5666b5
@ -4,7 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
description = "redaction-service-api-v1"
|
description = "redaction-service-api-v1"
|
||||||
val persistenceServiceVersion = "2.465.60"
|
val persistenceServiceVersion = "2.465.79"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.springframework:spring-web:6.0.12")
|
implementation("org.springframework:spring-web:6.0.12")
|
||||||
|
|||||||
@ -16,7 +16,7 @@ val layoutParserVersion = "0.142.6"
|
|||||||
val jacksonVersion = "2.15.2"
|
val jacksonVersion = "2.15.2"
|
||||||
val droolsVersion = "9.44.0.Final"
|
val droolsVersion = "9.44.0.Final"
|
||||||
val pdfBoxVersion = "3.0.0"
|
val pdfBoxVersion = "3.0.0"
|
||||||
val persistenceServiceVersion = "2.465.60"
|
val persistenceServiceVersion = "2.465.79"
|
||||||
val springBootStarterVersion = "3.1.5"
|
val springBootStarterVersion = "3.1.5"
|
||||||
val springCloudVersion = "4.0.4"
|
val springCloudVersion = "4.0.4"
|
||||||
val testContainersVersion = "1.19.7"
|
val testContainersVersion = "1.19.7"
|
||||||
|
|||||||
@ -358,7 +358,10 @@ public class AnalyzeService {
|
|||||||
|
|
||||||
log.info("Finished component rule execution for file {} in dossier {}", analyzeRequest.getFileId(), analyzeRequest.getDossierId());
|
log.info("Finished component rule execution for file {} in dossier {}", analyzeRequest.getFileId(), analyzeRequest.getDossierId());
|
||||||
|
|
||||||
ComponentLog componentLog = componentLogCreatorService.buildComponentLog(analyzeRequest.getAnalysisNumber(), components, kieWrapperComponentRules.rulesVersion());
|
ComponentLog componentLog = componentLogCreatorService.buildComponentLog(analyzeRequest.getAnalysisNumber(),
|
||||||
|
components,
|
||||||
|
kieWrapperComponentRules.rulesVersion(),
|
||||||
|
analyzeRequest.getComponentDefinitions());
|
||||||
|
|
||||||
redactionStorageService.storeObject(analyzeRequest.getDossierId(), analyzeRequest.getFileId(), FileType.COMPONENT_LOG, componentLog);
|
redactionStorageService.storeObject(analyzeRequest.getDossierId(), analyzeRequest.getFileId(), FileType.COMPONENT_LOG, componentLog);
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,15 @@
|
|||||||
package com.iqser.red.service.redaction.v1.server.service.components;
|
package com.iqser.red.service.redaction.v1.server.service.components;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
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.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.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.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.Component;
|
||||||
import com.iqser.red.service.redaction.v1.server.model.component.Entity;
|
import com.iqser.red.service.redaction.v1.server.model.component.Entity;
|
||||||
import com.iqser.red.service.redaction.v1.server.service.document.ComponentComparator;
|
import com.iqser.red.service.redaction.v1.server.service.document.ComponentComparator;
|
||||||
@ -20,7 +27,10 @@ import com.iqser.red.service.redaction.v1.server.service.document.EntityComparat
|
|||||||
@Service
|
@Service
|
||||||
public class ComponentLogCreatorService {
|
public class ComponentLogCreatorService {
|
||||||
|
|
||||||
public ComponentLog buildComponentLog(int analysisNumber, List<Component> components, long componentRulesVersion) {
|
public ComponentLog buildComponentLog(int analysisNumber,
|
||||||
|
List<Component> components,
|
||||||
|
long componentRulesVersion,
|
||||||
|
List<ComponentDefinition> componentDefinitions) {
|
||||||
|
|
||||||
Map<String, List<ComponentLogEntryValue>> map = new HashMap<>();
|
Map<String, List<ComponentLogEntryValue>> map = new HashMap<>();
|
||||||
components.stream()
|
components.stream()
|
||||||
@ -29,11 +39,23 @@ public class ComponentLogCreatorService {
|
|||||||
ComponentLogEntryValue componentLogEntryValue = buildComponentLogEntry(component);
|
ComponentLogEntryValue componentLogEntryValue = buildComponentLogEntry(component);
|
||||||
map.computeIfAbsent(component.getName(), k -> new ArrayList<>()).add(componentLogEntryValue);
|
map.computeIfAbsent(component.getName(), k -> new ArrayList<>()).add(componentLogEntryValue);
|
||||||
});
|
});
|
||||||
List<ComponentLogEntry> componentLogComponents = map.entrySet()
|
List<ComponentLogEntry> componentLogEntries = map.entrySet()
|
||||||
.stream()
|
.stream()
|
||||||
.map(entry -> new ComponentLogEntry(entry.getKey(), entry.getValue(), false))
|
.map(entry -> new ComponentLogEntry(entry.getKey(), entry.getValue(), false))
|
||||||
.toList();
|
.collect(Collectors.toList());
|
||||||
return new ComponentLog(analysisNumber, componentRulesVersion, componentLogComponents);
|
|
||||||
|
Set<String> 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, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ComponentLog(analysisNumber, componentRulesVersion, componentLogEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user