I know how to search for something in the JCR via JCR SQL2 queries.
However, I would like to use Java in certain cases, using the JCR API: javax.jcr.Node
, javax.jcr.NodeIterator
and the like.
I'm afraid I will simply reinvent the wheel by coding my own.
Is there anything already available (Gist
, Github
or else
)?
I ended up writing my own implementations.
Feel free to improve or add comments for potential improvements.
Further info
Java is probably NOT the most efficient way of searching through the JCR, so mind the performance hit (vs using
JCR SQL2
).However, there are cases where using JCR SQL2 will be rather annoying. For instance: JCR SQL2 - result query order as in JCR browser
I'd recommend launching your search as low as possible in the tree.
Solution
Read the comments above each method to find our more.
Usage of first utility method
Usage of second utility method
Resources: