// :childNodeCount is by default always included
// unless it is explicitly excluded in the filter
builder.key(":childNodeCount").value(childCount);
}
if (filter != null) {
NameFilter nf = filter.getPropertyFilter();
if (nf != null) {
// check whether :id has been explicitly included
if (nf.getInclusionPatterns().contains(":hash")
&& !nf.getExclusionPatterns().contains(":hash")) {
builder.key(":hash").value(rep.getRevisionStore().getId(node).toString());
}
// check whether :id has been explicitly included
if (nf.getInclusionPatterns().contains(":id")
&& !nf.getExclusionPatterns().contains(":id")) {
builder.key(":id").value(rep.getRevisionStore().getId(node).toString());
}
}
}
}
if (childCount > 0 && depth >= 0) {
if (filter != null) {
NameFilter childFilter = filter.getChildNodeFilter();
if (childFilter != null && !childFilter.containsWildcard()) {
// optimization for large child node lists:
// no need to iterate over the entire child node list if the filter
// does not include wildcards
int count = maxChildNodes == -1 ? Integer.MAX_VALUE : maxChildNodes;
for (String name : childFilter.getInclusionPatterns()) {
NodeState child = node.getChildNode(name);
if (child != null) {
boolean incl = true;
for (String exclName : childFilter.getExclusionPatterns()) {
if (name.equals(exclName)) {
incl = false;
break;
}
}