Hi, could you tell me what is the best way how to get count of
subfolders? There may be thousands so I think recursion:
private int countAllChildren(int c, Node node) {
try {
NodeIterator iterator = node.getNodes();
while (iterator.hasNext()) {
Node child = (Node) iterator.next();
if (child.isNodeType("nt:folder")) {
c = countAllChildren(++c, child);
}
}
return c;
} catch (RepositoryException e) {
throw new RuntimeException(e);
}
}
is not good choice.
I would like to use JCR-SQL2 query language, but every query what I
tried didn't work, e.g.:
SELECT * FROM [nt:folder] WHERE ISCHILDNODE(["+node.getPath()+"])
or
SELECT * FROM [nt:folder] as fld WHERE fld.[jcr:path] LIKE
'"+node.getPath()+"/%'
Thanks.