use of org.apache.jackrabbit.oak.spi.state.ChildNodeEntry in project jackrabbit-oak by apache.
the class HybridPropertyIndexInfo method collectBucketData.
private void collectBucketData(NodeState propIdxState) {
String head = propIdxState.getString(PROP_HEAD_BUCKET);
String previous = propIdxState.getString(PROP_PREVIOUS_BUCKET);
for (ChildNodeEntry cne : propIdxState.getChildNodeEntries()) {
String bucketName = cne.getName();
NodeState bucket = cne.getNodeState();
json.key(bucketName).object();
json.key("type");
if (Objects.equals(head, bucketName)) {
json.value("head");
} else if (Objects.equals(previous, bucketName)) {
json.value("previous");
} else {
json.value("garbage");
}
json.key("keyCount").value(bucket.getChildNodeCount(Integer.MAX_VALUE));
collectCounts(bucket);
json.endObject();
}
}
use of org.apache.jackrabbit.oak.spi.state.ChildNodeEntry in project jackrabbit-oak by apache.
the class HybridPropertyIndexInfo method collectCounts.
private void collectCounts(NodeState bucket) {
TreeTraverser<NodeState> t = new TreeTraverser<NodeState>() {
@Override
public Iterable<NodeState> children(NodeState root) {
return Iterables.transform(root.getChildNodeEntries(), ChildNodeEntry::getNodeState);
}
};
AtomicInteger matches = new AtomicInteger();
int totalCount = t.preOrderTraversal(bucket).transform((st) -> {
if (st.getBoolean("match")) {
matches.incrementAndGet();
}
return st;
}).size();
json.key("entryCount").value(matches.get());
json.key("totalCount").value(totalCount);
}
use of org.apache.jackrabbit.oak.spi.state.ChildNodeEntry in project jackrabbit-oak by apache.
the class HybridPropertyIndexInfo method getInfoAsJson.
public String getInfoAsJson() {
json.resetWriter();
json.object();
NodeState propertyIndexNode = idx.getChildNode(PROPERTY_INDEX);
for (ChildNodeEntry cne : propertyIndexNode.getChildNodeEntries()) {
NodeState propIdxState = cne.getNodeState();
String propName = cne.getName();
json.key(propName).object();
if (simplePropertyIndex(propIdxState)) {
collectBucketData(propIdxState);
} else if (uniquePropertyIndex(propIdxState)) {
json.key("entryCount").value(propIdxState.getChildNodeCount(Integer.MAX_VALUE));
json.key("unique").value(true);
}
json.endObject();
}
json.endObject();
return JsopBuilder.prettyPrint(json.toString());
}
use of org.apache.jackrabbit.oak.spi.state.ChildNodeEntry in project jackrabbit-oak by apache.
the class RecursiveDelete method deleteChildNodes.
private int deleteChildNodes(NodeState node, String path) throws CommitFailedException {
int currentSize = 0;
for (ChildNodeEntry cne : node.getChildNodeEntries()) {
String name = cne.getName();
String childPath = PathUtils.concat(path, name);
currentSize += delete(cne.getNodeState(), childPath);
if (save(childPath, currentSize, false)) {
currentSize = 0;
}
}
return currentSize;
}
use of org.apache.jackrabbit.oak.spi.state.ChildNodeEntry in project jackrabbit-oak by apache.
the class IndexDefinition method buildMimeTypeMap.
private static Map<String, String> buildMimeTypeMap(NodeState node) {
ImmutableMap.Builder<String, String> map = ImmutableMap.builder();
for (ChildNodeEntry child : node.getChildNodeEntries()) {
for (ChildNodeEntry subChild : child.getNodeState().getChildNodeEntries()) {
StringBuilder typeBuilder = new StringBuilder(child.getName()).append('/').append(subChild.getName());
PropertyState property = subChild.getNodeState().getProperty(TIKA_MAPPED_TYPE);
if (property != null) {
map.put(typeBuilder.toString(), property.getValue(Type.STRING));
}
}
}
return map.build();
}
Aggregations