DM-483 - Prevent endless loops
* cleanups and renaming redaction log to entity log
This commit is contained in:
parent
92ea6fdb99
commit
5cf8a06761
@ -105,7 +105,7 @@ public class RedactionStorageService {
|
||||
try {
|
||||
return storageService.readJSONObject(TenantContext.getTenantId(), StorageIdUtils.getStorageId(dossierId, fileId, FileType.ENTITY_LOG), EntityLog.class);
|
||||
} catch (StorageObjectDoesNotExist e) {
|
||||
log.debug("RedactionLog not available.");
|
||||
log.debug("EntityLog not available.");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -112,7 +112,7 @@ public class DocumineFloraTest extends AbstractRedactionIntegrationTest {
|
||||
// Fix In BodyTextFrameService destroys header detection in files/new/SYNGENTA_EFSA_sanitisation_GFL_v1_moreSections.pdf
|
||||
// TODO unify logic
|
||||
|
||||
AnalyzeRequest request = uploadFileToStorage("files/Documine/Flora/402Study.pdf");
|
||||
AnalyzeRequest request = uploadFileToStorage("files/Documine/Flora/402Study-ocred.pdf");
|
||||
|
||||
System.out.println("Start Full integration test");
|
||||
analyzeDocumentStructure(LayoutParsingType.DOCUMINE, request);
|
||||
|
||||
@ -82,13 +82,13 @@ public class AnnotationService {
|
||||
|
||||
private void annotate(PDDocument document, EntityLog entityLog) throws IOException {
|
||||
|
||||
Map<Integer, List<EntityLogEntry>> redactionLogPerPage = groupingByPageNumber(entityLog);
|
||||
Map<Integer, List<EntityLogEntry>> entityLogPerPage = groupingByPageNumber(entityLog);
|
||||
|
||||
for (int page = 1; page <= document.getNumberOfPages(); page++) {
|
||||
|
||||
PDPage pdPage = document.getPage(page - 1);
|
||||
|
||||
List<EntityLogEntry> logEntries = redactionLogPerPage.get(page);
|
||||
List<EntityLogEntry> logEntries = entityLogPerPage.get(page);
|
||||
if (logEntries != null && !logEntries.isEmpty()) {
|
||||
addAnnotations(logEntries, pdPage, page);
|
||||
}
|
||||
@ -98,20 +98,20 @@ public class AnnotationService {
|
||||
|
||||
private Map<Integer, List<EntityLogEntry>> groupingByPageNumber(EntityLog redactionLog) {
|
||||
|
||||
Map<Integer, List<EntityLogEntry>> redactionLogPerPage = new HashMap<>();
|
||||
Map<Integer, List<EntityLogEntry>> entityLogPerPage = new HashMap<>();
|
||||
if (redactionLog == null) {
|
||||
return redactionLogPerPage;
|
||||
return entityLogPerPage;
|
||||
}
|
||||
for (EntityLogEntry entry : redactionLog.getEntityLogEntry()) {
|
||||
int page = 0;
|
||||
for (Position position : entry.getPositions()) {
|
||||
if (position.getPageNumber() != page) {
|
||||
redactionLogPerPage.computeIfAbsent(position.getPageNumber(), x -> new ArrayList<>()).add(entry);
|
||||
entityLogPerPage.computeIfAbsent(position.getPageNumber(), x -> new ArrayList<>()).add(entry);
|
||||
page = position.getPageNumber();
|
||||
}
|
||||
}
|
||||
}
|
||||
return redactionLogPerPage;
|
||||
return entityLogPerPage;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
C. J. Alfred XinyiP
|
||||
C. J. Alfred Xinyi
|
||||
Loading…
x
Reference in New Issue
Block a user