Hi, I have a requirement to check if a node has child nodes, which do not match a certain pattern. This is definitely important, because
node.hasChildren() will return true, if there is a "rep:policy" childnode below it. But this node is an implementation detail of Oak, and it does not indicate that there is a "real" child node below this node. The same happens with "jcr:content" child nodes or other implementation specific nodes, which are not considered as "independent child nodes" from an application point of view. The existing API allows only to check for the presence of child nodes matching a certain glob (but not "not matching"), so it is of no help for me. Right now it is implemented by iterating over the child nodes and returning when the first child is detected which does not match the above criteria. This works fine, but it is slow when the child node list is very long (e.g. hundreds of nodes). Because then just getting the iterator can take miliseconds, especially when the Oak repo is backed by Mongo. On top i need to execute this operation quite a number of times within a single request, so that getting these iterators can consume quite some time, making my requests slower than they should be. I would like to have an API similar to the existing API, maybe looking like this: node.hasChildren(Pattern notmatchingNodeNames) which allows me to provide a pattern to it. As soon as a childnode's name is found not matching the pattern, the function returns true. This would allow the implementation to iterate only over the minimal number of child nodes, and I would expect it to be much faster than my existing implementation for these larger folders. I know that the JCR API can hardly be extended by this, but having this in a Util class would be fine as well. WDYT? Jörg -- Cheers, Jörg Hoh, https://cqdump.joerghoh.de Twitter: @joerghoh
