RED-10708: Tables as components in DM

This commit is contained in:
maverickstuder 2025-02-04 13:16:29 +01:00
parent c3e0aae800
commit a9fff497b5
4 changed files with 15 additions and 7 deletions

View File

@ -82,9 +82,9 @@ class TableComponentsIntegrationTest extends AbstractRedactionIntegrationTest {
var entityLog = redactionStorageService.getEntityLog(TEST_DOSSIER_ID, TEST_FILE_ID);
boolean tableEntityFound = entityLog.getEntityLogEntry()
.stream()
.anyMatch(entry -> entry.getMatchedRule() != null && entry.getMatchedRule().contains("DOC.100.0"));
.anyMatch(entry -> entry.getMatchedRule() != null && entry.getMatchedRule().contains("T.0.0"));
assertTrue(tableEntityFound, "Expected table entity creation ('DOC.100.0') to be present in the entity log");
assertTrue(tableEntityFound, "Expected table entity creation ('T.0.0') to be present in the entity log");
}
}

View File

@ -69,12 +69,12 @@ query "getFileAttributes"
//------------------------------------ table rules ------------------------------------
rule "DOC.100.0: Create TableEntities for all Tables"
rule "T.0.0: Create TableEntities for all Tables"
when
$table: Table()
then
Optional<TableEntity> tableEntity = entityCreationService.bySemanticNode($table, "Table", EntityType.ENTITY);
tableEntity.ifPresent(t -> t.apply("DOC.100.0", "Table found.", "n-a"));
tableEntity.ifPresent(t -> t.apply("T.0.0", "Table found.", "n-a"));
end
//------------------------------------ Headlines rules ------------------------------------

View File

@ -45,12 +45,11 @@ query "getComponents"
//------------------------------------ table rules ------------------------------------
rule "TableComponents.900.0: Create components for all table entities."
salience -900
rule "TableComponents.0.0: Create components for all table entities."
when
$tables: List() from collect (Entity(type == "Table"))
then
componentCreationService.createComponentForTables("TableComponents.900.0", $tables);
componentCreationService.createComponentForTables("TableComponents.0.0", $tables);
end
//------------------------------------ Default Components rules ------------------------------------

View File

@ -68,6 +68,15 @@ query "getFileAttributes"
$fileAttribute: FileAttribute()
end
//------------------------------------ T rules ------------------------------------
rule "T.0.0: Create TableEntities for all Tables"
when
$table: Table()
then
Optional<TableEntity> tableEntity = entityCreationService.bySemanticNode($table, "Table", EntityType.ENTITY);
tableEntity.ifPresent(t -> t.apply("T.0.0", "Table found.", "n-a"));
end
//------------------------------------ H rules ------------------------------------
// Rule unit: H.0