Count subnodes of workspace
Create list of the amount of subnodes, that each node in this workspace has
import javax.jcr.Node;
import info.magnolia.jcr.predicate.NodeTypePredicate;
Node rootNode = SessionUtil.getNode("<workpace>", "/");
Iterable<Node> nodeList = NodeUtil.collectAllChildren(rootNode, new NodeTypePredicate("mgnl:folder"));
println "path,count"
for (Node node : nodeList) {
if (node.hasNodes()) {
println node.getPath() + "," + node.getNodes().size();
}
}
return "--- end"
Contact the author