RED-9139: move document to its own module, add TableOfContents and TableOfContentsItem
This commit is contained in:
parent
5432635037
commit
b52d3928ef
@ -7,6 +7,8 @@ description = "redaction-service-document"
|
|||||||
val persistenceServiceVersion = "2.612.0-RED10072.1"
|
val persistenceServiceVersion = "2.612.0-RED10072.1"
|
||||||
val layoutParserVersion = "newNode"
|
val layoutParserVersion = "newNode"
|
||||||
|
|
||||||
|
group = "com.knecon.fforesight"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("com.iqser.red.service:persistence-service-internal-api-v1:${persistenceServiceVersion}")
|
implementation("com.iqser.red.service:persistence-service-internal-api-v1:${persistenceServiceVersion}")
|
||||||
implementation("com.google.protobuf:protobuf-java-util:4.28.3")
|
implementation("com.google.protobuf:protobuf-java-util:4.28.3")
|
||||||
|
|||||||
@ -296,6 +296,22 @@ public class DocumentTree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Optional<Entry> findEntryById(List<Integer> treeId) {
|
||||||
|
|
||||||
|
if (treeId.isEmpty()) {
|
||||||
|
return Optional.of(root);
|
||||||
|
}
|
||||||
|
Entry entry = root;
|
||||||
|
for (int id : treeId) {
|
||||||
|
if (id < 0 || id >= entry.children.size()) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
entry = entry.children.get(id);
|
||||||
|
}
|
||||||
|
return Optional.of(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Stream<Entry> mainEntries() {
|
public Stream<Entry> mainEntries() {
|
||||||
|
|
||||||
return root.children.stream();
|
return root.children.stream();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user