Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exclude metadata nodes from child streams
Browse files Browse the repository at this point in the history
eschleb committed Jan 17, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 12e7658 commit 2dd5fd5
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -19,6 +19,13 @@
import java.util.stream.StreamSupport;

public class NodeService {
private static final Predicate<Node> EXCLUDE_META_DATA_FILTER = node -> {
try {
return !node.getName().startsWith(NodeTypes.JCR_PREFIX) && !NodeUtil.isNodeType(node, NodeTypes.MetaData.NAME);
}catch (RepositoryException e) {
return false;
}
};
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private final LocalizedNameProvider localizedNameProvider;
private final NodeNameHelper nodeNameHelper;
@@ -196,7 +203,8 @@ public Stream<Node> streamChildren(final Node node) {
.map(nodeIterator -> (Iterator<Node>)nodeIterator)
.flatMap(nodeIterator ->
StreamSupport.stream(Spliterators.spliteratorUnknownSize(nodeIterator, Spliterator.ORDERED), false)
);
)
.filter(EXCLUDE_META_DATA_FILTER);
}

public Stream<Node> streamChildren(final Node node, final Predicate<Node> predicate) {

0 comments on commit 2dd5fd5

Please sign in to comment.