Merge branch 'RED-9140-fp' into 'master'

RED-9140 - Properly distinct between REMOVED and IGNORED Change type

Closes RED-9140

See merge request redactmanager/redaction-service!464
This commit is contained in:
Andrei Isvoran 2024-07-23 15:58:26 +02:00
commit 2ab536dfee
3 changed files with 11 additions and 6 deletions

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.473.0"
val persistenceServiceVersion = "2.496.0"
val springBootStarterVersion = "3.1.5"
val springCloudVersion = "4.0.4"
val testContainersVersion = "1.19.7"

View File

@ -102,7 +102,7 @@ public class EntityChangeLogService {
if (previousEntry.getManualChanges().isEmpty() && !currentEntry.getManualChanges().isEmpty()) {
currentLastManualChange = currentEntry.getManualChanges()
.get(currentEntry.getManualChanges().size() - 1);
return manualChange(propertyChanges, analysisNumber, currentLastManualChange);
return manualChange(propertyChanges, analysisNumber, currentLastManualChange, currentEntry.getState());
}
previousLastManualChange = previousEntry.getManualChanges()
@ -113,7 +113,7 @@ public class EntityChangeLogService {
if (Objects.equals(previousLastManualChange, currentLastManualChange)) {
return systemChange(propertyChanges, analysisNumber, previousEntry.getState(), currentEntry.getState());
} else {
return manualChange(propertyChanges, analysisNumber, currentLastManualChange);
return manualChange(propertyChanges, analysisNumber, currentLastManualChange, currentEntry.getState());
}
}
@ -136,12 +136,17 @@ public class EntityChangeLogService {
}
private Change manualChange(List<PropertyChange> propertyChanges, int analysisNumber, ManualChange manualChange) {
private Change manualChange(List<PropertyChange> propertyChanges, int analysisNumber, ManualChange manualChange, EntryState entryState) {
return ChangeFactory.toChange(convertToChangeType(manualChange.getManualRedactionType()),
Change change = ChangeFactory.toChange(convertToChangeType(manualChange.getManualRedactionType()),
manualChange.getRequestedDate(),
analysisNumber,
propertyChanges.toArray(new PropertyChange[0]));
if (change.getType().equals(ChangeType.REMOVED) && entryState.equals(EntryState.IGNORED)) {
change.setType(ChangeType.IGNORED);
}
return change;
}

View File

@ -1990,7 +1990,7 @@ public class RedactionIntegrationTest extends RulesIntegrationTest {
assertEquals(responseDavidKsenia.getChanges()
.get(0).getType(), ChangeType.ADDED);
assertEquals(responseDavidKsenia.getChanges()
.get(1).getType(), ChangeType.REMOVED);
.get(1).getType(), ChangeType.IGNORED);
assertEquals(responseDavidKsenia.getChanges()
.get(1).getPropertyChanges()
.get("reason"), "No vertebrate found -> removed by manual override");