RED-9782: Added analysis function that only imports imported redactions #470

Merged
dominique.eiflaender1 merged 1 commits from RED-9782-master into master 2024-08-07 10:34:30 +02:00
5 changed files with 52 additions and 4 deletions

View File

@ -4,7 +4,7 @@ plugins {
}
description = "redaction-service-api-v1"
val persistenceServiceVersion = "2.473.0"
val persistenceServiceVersion = "2.503.0"
dependencies {
implementation("org.springframework:spring-web:6.0.12")

View File

@ -16,7 +16,7 @@ val layoutParserVersion = "0.141.0"
val jacksonVersion = "2.15.2"
val droolsVersion = "9.44.0.Final"
val pdfBoxVersion = "3.0.0"
val persistenceServiceVersion = "2.496.0"
val persistenceServiceVersion = "2.503.0"
val springBootStarterVersion = "3.1.5"
val springCloudVersion = "4.0.4"
val testContainersVersion = "1.19.7"
@ -69,7 +69,7 @@ dependencies {
implementation("org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}")
implementation("net.logstash.logback:logstash-logback-encoder:7.4")
implementation("ch.qos.logback:logback-classic")
api("ch.qos.logback:logback-classic")
implementation("org.reflections:reflections:0.10.2")

View File

@ -110,7 +110,14 @@ public class RedactionMessageReceiver {
log.info("-------------------------------------------------------------------------------------------------");
shouldRespond = false;
break;
case IMPORTED_REDACTIONS_ONLY:
log.info("------------------------------Imported Redactions Analysis Only------------------------------------------");
log.info("Starting Imported Redactions Analysis Only for file {} in dossier {}", analyzeRequest.getFileId(), analyzeRequest.getDossierId());
log.debug(analyzeRequest.getManualRedactions().toString());
result = analyzeService.analyzeImportedRedactionsOnly(analyzeRequest);
log.info("Successful Imported Redactions Analysis Only dossier {} file {}", analyzeRequest.getDossierId(), analyzeRequest.getFileId());
log.info("-------------------------------------------------------------------------------------------------");
break;
default:
throw new IllegalArgumentException("Unknown MessageType: " + analyzeRequest.getMessageType());
}

View File

@ -199,6 +199,45 @@ public class AnalyzeService {
}
@Timed("redactmanager_analyzeImportedRedactionsOnly")
@Observed(name = "AnalyzeService", contextualName = "analyzeImportedRedactionsOnly")
public AnalyzeResult analyzeImportedRedactionsOnly(AnalyzeRequest analyzeRequest) {
long startTime = System.currentTimeMillis();
AnalysisData analysisData = analysisPreparationService.getAnalysisData(analyzeRequest);
Context context = new Context(analyzeRequest.getFileId(),
analyzeRequest.getDossierId(),
analyzeRequest.getDossierTemplateId(),
analysisData.kieWrapperEntityRules().rulesVersion(),
analyzeRequest.getAnalysisNumber(),
TenantContext.getTenantId());
var notFoundManualOrImportedEntries = Stream.of(analysisData.notFoundManualRedactionEntries(), analysisData.notFoundImportedEntries())
.flatMap(Collection::stream)
.collect(Collectors.toList());
EntityLogChanges entityLogChanges = entityLogCreatorService.createInitialEntityLog(analyzeRequest,
analysisData.document(),
notFoundManualOrImportedEntries,
analysisData.dictionary().getVersion(),
analysisData.kieWrapperEntityRules().rulesVersion());
notFoundImportedEntitiesService.processEntityLog(entityLogChanges.getEntityLog(), analyzeRequest, analysisData.notFoundImportedEntries());
return finalizeAnalysis(analyzeRequest,
startTime,
analysisData.kieWrapperComponentRules(),
entityLogChanges,
analysisData.document(),
analysisData.document().getNumberOfPages(),
false,
new HashSet<>(),
context);
}
private AnalyzeResult finalizeAnalysis(AnalyzeRequest analyzeRequest,
long startTime,
KieWrapper kieWrapperComponentRules,

View File

@ -46,6 +46,8 @@ dependencies {
implementation("org.kie:kie-api:9.44.0.Final")
implementation("org.drools:drools-compiler:9.44.0.Final")
testImplementation("org.kie:kie-ci:9.44.0.Final")
api("ch.qos.logback:logback-classic:1.4.11")
}
tasks.test {