RED-8534: RECTANGLE is ENTITY instead of AREA
This commit is contained in:
parent
3b94e68af7
commit
01c44f6877
@ -57,9 +57,12 @@ public class PrecursorEntity implements IEntity {
|
|||||||
|
|
||||||
public static PrecursorEntity fromManualRedactionEntry(ManualRedactionEntry manualRedactionEntry, boolean hint) {
|
public static PrecursorEntity fromManualRedactionEntry(ManualRedactionEntry manualRedactionEntry, boolean hint) {
|
||||||
|
|
||||||
List<RectangleWithPage> rectangleWithPages = manualRedactionEntry.getPositions().stream().map(RectangleWithPage::fromAnnotationRectangle).toList();
|
List<RectangleWithPage> rectangleWithPages = manualRedactionEntry.getPositions()
|
||||||
|
.stream()
|
||||||
|
.map(RectangleWithPage::fromAnnotationRectangle)
|
||||||
|
.toList();
|
||||||
var entityType = hint ? EntityType.HINT : EntityType.ENTITY;
|
var entityType = hint ? EntityType.HINT : EntityType.ENTITY;
|
||||||
var entryType = hint ? EntryType.HINT : EntryType.ENTITY;
|
var entryType = hint ? EntryType.HINT : (manualRedactionEntry.isRectangle() ? EntryType.AREA : EntryType.ENTITY);
|
||||||
ManualChangeOverwrite manualChangeOverwrite = new ManualChangeOverwrite(entityType);
|
ManualChangeOverwrite manualChangeOverwrite = new ManualChangeOverwrite(entityType);
|
||||||
manualChangeOverwrite.addChange(manualRedactionEntry);
|
manualChangeOverwrite.addChange(manualRedactionEntry);
|
||||||
return PrecursorEntity.builder()
|
return PrecursorEntity.builder()
|
||||||
@ -85,7 +88,10 @@ public class PrecursorEntity implements IEntity {
|
|||||||
|
|
||||||
public static PrecursorEntity fromEntityLogEntry(EntityLogEntry entityLogEntry) {
|
public static PrecursorEntity fromEntityLogEntry(EntityLogEntry entityLogEntry) {
|
||||||
|
|
||||||
List<RectangleWithPage> rectangleWithPages = entityLogEntry.getPositions().stream().map(RectangleWithPage::fromEntityLogPosition).toList();
|
List<RectangleWithPage> rectangleWithPages = entityLogEntry.getPositions()
|
||||||
|
.stream()
|
||||||
|
.map(RectangleWithPage::fromEntityLogPosition)
|
||||||
|
.toList();
|
||||||
EntityType entityType = getEntityType(entityLogEntry.getEntryType());
|
EntityType entityType = getEntityType(entityLogEntry.getEntryType());
|
||||||
return PrecursorEntity.builder()
|
return PrecursorEntity.builder()
|
||||||
.id(entityLogEntry.getId())
|
.id(entityLogEntry.getId())
|
||||||
@ -108,17 +114,25 @@ public class PrecursorEntity implements IEntity {
|
|||||||
|
|
||||||
public static PrecursorEntity fromImportedEntry(ImportedRedaction importedRedaction) {
|
public static PrecursorEntity fromImportedEntry(ImportedRedaction importedRedaction) {
|
||||||
|
|
||||||
List<RectangleWithPage> rectangleWithPages = importedRedaction.getPositions().stream().map(RectangleWithPage::fromEntityLogPosition).toList();
|
List<RectangleWithPage> rectangleWithPages = importedRedaction.getPositions()
|
||||||
EntryType entryType = Optional.ofNullable(importedRedaction.getEntryType()).orElse(EntryType.ENTITY);
|
.stream()
|
||||||
|
.map(RectangleWithPage::fromEntityLogPosition)
|
||||||
|
.toList();
|
||||||
|
EntryType entryType = Optional.ofNullable(importedRedaction.getEntryType())
|
||||||
|
.orElse(EntryType.ENTITY);
|
||||||
EntityType entityType = getEntityType(entryType);
|
EntityType entityType = getEntityType(entryType);
|
||||||
String value = Optional.ofNullable(importedRedaction.getValue()).orElse("");
|
String value = Optional.ofNullable(importedRedaction.getValue())
|
||||||
|
.orElse("");
|
||||||
return PrecursorEntity.builder()
|
return PrecursorEntity.builder()
|
||||||
.id(importedRedaction.getId())
|
.id(importedRedaction.getId())
|
||||||
.value(value)
|
.value(value)
|
||||||
.entityPosition(rectangleWithPages)
|
.entityPosition(rectangleWithPages)
|
||||||
.reason(Optional.ofNullable(importedRedaction.getReason()).orElse(""))
|
.reason(Optional.ofNullable(importedRedaction.getReason())
|
||||||
.legalBasis(Optional.ofNullable(importedRedaction.getLegalBasis()).orElse(""))
|
.orElse(""))
|
||||||
.type(Optional.ofNullable(importedRedaction.getType()).orElse(IMPORTED_REDACTION_TYPE))
|
.legalBasis(Optional.ofNullable(importedRedaction.getLegalBasis())
|
||||||
|
.orElse(""))
|
||||||
|
.type(Optional.ofNullable(importedRedaction.getType())
|
||||||
|
.orElse(IMPORTED_REDACTION_TYPE))
|
||||||
.entityType(entityType)
|
.entityType(entityType)
|
||||||
.entryType(entryType)
|
.entryType(entryType)
|
||||||
.isDictionaryEntry(false)
|
.isDictionaryEntry(false)
|
||||||
@ -132,7 +146,10 @@ public class PrecursorEntity implements IEntity {
|
|||||||
|
|
||||||
public static PrecursorEntity fromManualResizeRedaction(ManualResizeRedaction manualResizeRedaction) {
|
public static PrecursorEntity fromManualResizeRedaction(ManualResizeRedaction manualResizeRedaction) {
|
||||||
|
|
||||||
List<RectangleWithPage> rectangleWithPages = manualResizeRedaction.getPositions().stream().map(RectangleWithPage::fromAnnotationRectangle).toList();
|
List<RectangleWithPage> rectangleWithPages = manualResizeRedaction.getPositions()
|
||||||
|
.stream()
|
||||||
|
.map(RectangleWithPage::fromAnnotationRectangle)
|
||||||
|
.toList();
|
||||||
return PrecursorEntity.builder()
|
return PrecursorEntity.builder()
|
||||||
.id(UUID.randomUUID().toString())
|
.id(UUID.randomUUID().toString())
|
||||||
.value(manualResizeRedaction.getValue())
|
.value(manualResizeRedaction.getValue())
|
||||||
@ -153,7 +170,8 @@ public class PrecursorEntity implements IEntity {
|
|||||||
@Override
|
@Override
|
||||||
public String type() {
|
public String type() {
|
||||||
|
|
||||||
return getManualOverwrite().getType().orElse(type);
|
return getManualOverwrite().getType()
|
||||||
|
.orElse(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user