RED-8670: integrate table inference from research

* introduce controllerAdvice to ControllerV2 package
This commit is contained in:
Kilian Schuettler 2024-05-24 16:00:43 +02:00
parent 844466812b
commit 46e221a3f6
6 changed files with 27 additions and 18 deletions

View File

@ -65,6 +65,11 @@ java {
}
allprojects {
tasks.withType<Javadoc> {
options {
extra["javadoc.options"] = listOf("-quiet", "-Xdoclint:none")
}
}
publishing {
publications {
create<MavenPublication>(name) {

View File

@ -53,6 +53,7 @@ public class FileStatusProcessingUpdateInternalController implements FileStatusP
public void analysisSuccessful(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody AnalyzeResult analyzeResult) {
log.info("Received analysis result {}", analyzeResult);
fileStatusProcessingUpdateService.analysisSuccessful(dossierId, fileId, analyzeResult);
}

View File

@ -3,6 +3,7 @@ package com.iqser.red.service.persistence.management.v1.processor.service;
import org.apache.commons.lang3.StringUtils;
import org.springframework.retry.support.RetryTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.RestController;
import com.iqser.red.service.persistence.management.v1.processor.exception.ConflictException;

View File

@ -180,12 +180,12 @@ public class ReanalysisRequiredStatusService {
boolean needComma = false;
if (rulesVersionMatches) {
if (!rulesVersionMatches) {
messageBuilder.append("ruleVersions: ").append(fileStatus.getRulesVersion()).append("/").append(dossierTemplateVersions.getOrDefault(RULES, -1L));
needComma = true;
}
if (componentRulesVersionMatches) {
if (!componentRulesVersionMatches) {
if (needComma) {
messageBuilder.append(", ");
}
@ -196,7 +196,7 @@ public class ReanalysisRequiredStatusService {
needComma = true;
}
if (dictionaryVersionMatches) {
if (!dictionaryVersionMatches) {
if (needComma) {
messageBuilder.append(", ");
}
@ -204,7 +204,7 @@ public class ReanalysisRequiredStatusService {
needComma = true;
}
if (legalBasisVersionMatches) {
if (!legalBasisVersionMatches) {
if (needComma) {
messageBuilder.append(", ");
}
@ -212,7 +212,7 @@ public class ReanalysisRequiredStatusService {
needComma = true;
}
if (dossierDictionaryVersionMatches) {
if (!dossierDictionaryVersionMatches) {
if (needComma) {
messageBuilder.append(", ");
}
@ -220,7 +220,7 @@ public class ReanalysisRequiredStatusService {
needComma = true;
}
if (mappingVersionAllMatch) {
if (!mappingVersionAllMatch) {
if (needComma) {
messageBuilder.append(", ");
}

View File

@ -130,10 +130,6 @@ public class FileStatusPersistenceService {
return;
}
List<FileEntityComponentMappingVersionEntity> versionEntities = usedComponentMappings.stream()
.map(cm -> new FileEntityComponentMappingVersionEntity(cm.getName(), cm.getVersion()))
.toList();
fileRepository.updateProcessingStatus(fileId,
numberOfPages,
ProcessingStatus.PROCESSED,
@ -147,8 +143,18 @@ public class FileStatusPersistenceService {
OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS),
OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS),
analysisNumber,
calculateProcessingErrorCounter(fileId, ProcessingStatus.PROCESSED),
versionEntities);
calculateProcessingErrorCounter(fileId, ProcessingStatus.PROCESSED));
List<FileEntityComponentMappingVersionEntity> versionEntities = usedComponentMappings.stream()
.map(cm -> new FileEntityComponentMappingVersionEntity(cm.getName(), cm.getVersion()))
.toList();
FileEntity file = fileRepository.findById(fileId)
.orElseThrow(() -> new NotFoundException("File with id " + fileId + "not found!"));
file.setComponentMappingVersions(versionEntities);
fileRepository.save(file);
websocketService.sendAnalysisEvent(dossierId, fileId, AnalyseStatus.FINISHED, analysisNumber);
}

View File

@ -10,7 +10,6 @@ import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.FileEntity;
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.FileEntityComponentMappingVersionEntity;
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.projection.FilePageCountsProjection;
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.projection.FileProcessingStatusProjection;
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.projection.FileWorkflowStatusProjection;
@ -61,8 +60,7 @@ public interface FileRepository extends JpaRepository<FileEntity, String> {
f.numberOfAnalyses = :analysisNumber, \
f.lastUpdated = :lastUpdated, \
f.lastProcessed = :lastProcessed, \
f.processingErrorCounter = :processingErrorCounter, \
f.componentMappingVersions = :componentMappingVersions \
f.processingErrorCounter = :processingErrorCounter \
where f.id = :fileId""")
void updateProcessingStatus(@Param("fileId") String fileId,
@Param("numberOfPages") int numberOfPages,
@ -77,9 +75,7 @@ public interface FileRepository extends JpaRepository<FileEntity, String> {
@Param("lastUpdated") OffsetDateTime lastUpdated,
@Param("lastProcessed") OffsetDateTime lastProcessed,
@Param("analysisNumber") int analysisNumber,
@Param("processingErrorCounter") int processingErrorCounter,
@Param("componentMappingVersions")
List<FileEntityComponentMappingVersionEntity> versionEntities);
@Param("processingErrorCounter") int processingErrorCounter);
@Modifying