Merge branch 'RED-9084' into 'master'

RED-9084: Paragraph/Location value missing for manual redaction on re-uploaded preview file

Closes RED-9084

See merge request redactmanager/redaction-service!391
This commit is contained in:
Maverick Studer 2024-05-06 17:08:46 +02:00
commit 0e16d9012c
7 changed files with 32 additions and 6 deletions

View File

@ -7,7 +7,7 @@ description = "redaction-service-api-v1"
dependencies {
implementation("org.springframework:spring-web:6.0.12")
implementation("com.iqser.red.service:persistence-service-internal-api-v1:2.410.0")
implementation("com.iqser.red.service:persistence-service-internal-api-v1:2.411.0")
}
publishing {

View File

@ -16,7 +16,7 @@ val layoutParserVersion = "0.116.0"
val jacksonVersion = "2.15.2"
val droolsVersion = "9.44.0.Final"
val pdfBoxVersion = "3.0.0"
val persistenceServiceVersion = "2.410.0"
val persistenceServiceVersion = "2.411.0"
val springBootStarterVersion = "3.1.5"
val springCloudVersion = "4.0.4"
val testContainersVersion = "1.19.7"

View File

@ -130,11 +130,12 @@ public class PrecursorEntity implements IEntity {
.orElse(""))
.type(Optional.ofNullable(importedRedaction.getType())
.orElse(IMPORTED_REDACTION_TYPE))
.section(importedRedaction.getManualOverwriteSection())
.entityType(entityType)
.isDictionaryEntry(false)
.isDossierDictionaryEntry(false)
.rectangle(value.isBlank() || entryType.equals(EntryType.IMAGE) || entryType.equals(EntryType.IMAGE_HINT) || entryType.equals(EntryType.AREA))
.manualOverwrite(new ManualChangeOverwrite(entityType))
.manualOverwrite(new ManualChangeOverwrite(entityType, importedRedaction.getManualOverwriteSection()))
.engines(Set.of(Engine.IMPORTED))
.build();
}

View File

@ -34,6 +34,7 @@ public class ManualChangeOverwrite {
IdRemoval.class, "removed by manual override", //
ManualRecategorization.class, "recategorized by manual override");
@Builder.Default
List<BaseAnnotation> manualChanges = new LinkedList<>();
boolean changed;
List<String> descriptions;
@ -59,6 +60,13 @@ public class ManualChangeOverwrite {
public ManualChangeOverwrite(EntityType entityType) {
this.entityType = entityType;
this.manualChanges = new LinkedList<>();
}
public ManualChangeOverwrite(EntityType entityType, String section) {
this(entityType);
this.section = section;
}

View File

@ -83,6 +83,18 @@ public class TextEntity implements IEntity {
}
public static TextEntity initialEntityNode(TextRange textRange, String type, EntityType entityType, String id, String manualOverwriteSection) {
return TextEntity.builder()
.id(id)
.type(type)
.entityType(entityType)
.textRange(textRange)
.manualOverwrite(ManualChangeOverwrite.builder().entityType(entityType).section(manualOverwriteSection).build())
.build();
}
private static String buildId(SemanticNode node, TextRange textRange, String type, EntityType entityType) {
Map<Page, List<Rectangle2D>> rectanglesPerLinePerPage = node.getPositionsPerPage(textRange);

View File

@ -157,7 +157,7 @@ public class EntityLogCreatorService {
.forEach(imageNode -> entries.add(createEntityLogEntry(imageNode, dossierTemplateId)));
notFoundPrecursorEntries.stream()
.filter(entity -> !entity.removed())
.forEach(precursorEntity -> entries.add(createEntityLogEntry(precursorEntity, dossierTemplateId)));
.forEach(precursorEntity -> entries.add(createEntityLogEntry(precursorEntity)));
return entries;
}
@ -213,7 +213,7 @@ public class EntityLogCreatorService {
}
private EntityLogEntry createEntityLogEntry(PrecursorEntity precursorEntity, String dossierTemplateId) {
private EntityLogEntry createEntityLogEntry(PrecursorEntity precursorEntity) {
String type = precursorEntity.getManualOverwrite().getType()
.orElse(precursorEntity.getType());

View File

@ -125,7 +125,12 @@ public class EntityFromPrecursorCreationService {
precursorEntity.getEntityType(),
closestEntity.getDeepestFullyContainingNode());
} else {
correctEntity = TextEntity.initialEntityNode(closestEntity.getTextRange(), precursorEntity.type(), precursorEntity.getEntityType(), precursorEntity.getId());
correctEntity = TextEntity.initialEntityNode(closestEntity.getTextRange(),
precursorEntity.type(),
precursorEntity.getEntityType(),
precursorEntity.getId(),
precursorEntity.getManualOverwrite().getSection()
.orElse(null));
}
correctEntity.setDeepestFullyContainingNode(closestEntity.getDeepestFullyContainingNode());
correctEntity.setIntersectingNodes(new ArrayList<>(closestEntity.getIntersectingNodes()));