RED-8702: Explore document databases to store entityLog

* fix for analysisnumber 1 as first
This commit is contained in:
maverickstuder 2024-03-28 15:39:06 +01:00
parent fdfc56f9e6
commit 1c3205851b
2 changed files with 6 additions and 3 deletions

View File

@ -265,8 +265,9 @@ public class AnalyzeService {
EntityLog entityLog = entityLogChanges.getEntityLog(); EntityLog entityLog = entityLogChanges.getEntityLog();
// hotfix for tests : analysis numbers should be incremented in every follow-up request, // hotfix for tests : analysis numbers should be incremented in every follow-up request,
// then querying if the entity log exists would not be necessary // then querying if the entity log exists would not be necessary something like this could be done instead:
if (entityLog.getAnalysisNumber() <= 0 && !redactionStorageService.entityLogExists(analyzeRequest.getDossierId(), analyzeRequest.getFileId())) { // entityLog.getAnalysisNumber() <= 0
if (!redactionStorageService.entityLogExists(analyzeRequest.getDossierId(), analyzeRequest.getFileId())) {
redactionStorageService.insertEntityLog(analyzeRequest.getDossierId(), analyzeRequest.getFileId(), entityLog); redactionStorageService.insertEntityLog(analyzeRequest.getDossierId(), analyzeRequest.getFileId(), entityLog);
} else { } else {

View File

@ -608,6 +608,7 @@ public class RedactionIntegrationTest extends RulesIntegrationTest {
.build())); .build()));
analyzeDocumentStructure(LayoutParsingType.REDACT_MANAGER, request); analyzeDocumentStructure(LayoutParsingType.REDACT_MANAGER, request);
request.setAnalysisNumber(1);
AnalyzeResult result = analyzeService.analyze(request); AnalyzeResult result = analyzeService.analyze(request);
var entityLog = redactionStorageService.getEntityLog(TEST_DOSSIER_ID, TEST_FILE_ID); var entityLog = redactionStorageService.getEntityLog(TEST_DOSSIER_ID, TEST_FILE_ID);
@ -666,7 +667,7 @@ public class RedactionIntegrationTest extends RulesIntegrationTest {
.build())); .build()));
request.setManualRedactions(manualRedactions); request.setManualRedactions(manualRedactions);
request.setAnalysisNumber(2);
AnalyzeResult reanalyzeResult = analyzeService.reanalyze(request); AnalyzeResult reanalyzeResult = analyzeService.reanalyze(request);
entityLog = redactionStorageService.getEntityLog(TEST_DOSSIER_ID, TEST_FILE_ID); entityLog = redactionStorageService.getEntityLog(TEST_DOSSIER_ID, TEST_FILE_ID);
@ -688,6 +689,7 @@ public class RedactionIntegrationTest extends RulesIntegrationTest {
when(dictionaryClient.getDictionaryForType(VERTEBRATE_INDICATOR, null)).thenReturn(getDictionaryResponse(VERTEBRATE_INDICATOR, false)); when(dictionaryClient.getDictionaryForType(VERTEBRATE_INDICATOR, null)).thenReturn(getDictionaryResponse(VERTEBRATE_INDICATOR, false));
request.setAnalysisNumber(3);
analyzeService.reanalyze(request); analyzeService.reanalyze(request);
entityLog = redactionStorageService.getEntityLog(TEST_DOSSIER_ID, TEST_FILE_ID); entityLog = redactionStorageService.getEntityLog(TEST_DOSSIER_ID, TEST_FILE_ID);