use of org.apache.jackrabbit.oak.plugins.nodetype.TypePredicate in project jackrabbit-oak by apache.
the class NodeTypePredicateTest method singleNodeTypeMiss.
@Test
public void singleNodeTypeMiss() {
NodeState node = createNodeOfType(NT_BASE);
TypePredicate p = new TypePredicate(node, new String[] { NT_FILE });
assertFalse(p.apply(node));
}
use of org.apache.jackrabbit.oak.plugins.nodetype.TypePredicate in project jackrabbit-oak by apache.
the class NodeTypePredicateTest method singleNodeTypeMatch.
@Test
public void singleNodeTypeMatch() {
NodeState node = createNodeOfType(NT_BASE);
TypePredicate p = new TypePredicate(node, new String[] { NT_BASE });
assertTrue(p.apply(node));
}
use of org.apache.jackrabbit.oak.plugins.nodetype.TypePredicate in project jackrabbit-oak by apache.
the class SameNameSiblingsEditor method parseNamedChildNodeDefs.
private static List<ChildTypeDef> parseNamedChildNodeDefs(NodeState root, NodeState parentType, TypePredicate parentTypePredicate) {
List<ChildTypeDef> defs = new ArrayList<ChildTypeDef>();
NodeState namedChildNodeDefinitions = parentType.getChildNode(REP_NAMED_CHILD_NODE_DEFINITIONS);
for (ChildNodeEntry childName : namedChildNodeDefinitions.getChildNodeEntries()) {
for (String childType : filterChildren(childName.getNodeState(), NO_SNS_PROPERTY)) {
TypePredicate childTypePredicate = new TypePredicate(root, childType);
defs.add(new ChildTypeDef(parentTypePredicate, childName.getName(), childTypePredicate));
}
}
return defs;
}
use of org.apache.jackrabbit.oak.plugins.nodetype.TypePredicate in project jackrabbit-oak by apache.
the class SameNameSiblingsEditor method prepareChildDefsWithoutSns.
/**
* Prepare a list of node definitions that doesn't allow having SNS children.
*
* @param root Repository root
* @return a list of node definitions denying SNS children
*/
private static List<ChildTypeDef> prepareChildDefsWithoutSns(NodeState root) {
List<ChildTypeDef> defs = new ArrayList<ChildTypeDef>();
NodeState types = root.getChildNode(JCR_SYSTEM).getChildNode(JCR_NODE_TYPES);
for (ChildNodeEntry typeEntry : types.getChildNodeEntries()) {
NodeState type = typeEntry.getNodeState();
TypePredicate typePredicate = new TypePredicate(root, typeEntry.getName());
defs.addAll(parseResidualChildNodeDefs(root, type, typePredicate));
defs.addAll(parseNamedChildNodeDefs(root, type, typePredicate));
}
return defs;
}
use of org.apache.jackrabbit.oak.plugins.nodetype.TypePredicate in project jackrabbit-oak by apache.
the class SameNameSiblingsEditor method parseResidualChildNodeDefs.
private static List<ChildTypeDef> parseResidualChildNodeDefs(NodeState root, NodeState parentType, TypePredicate parentTypePredicate) {
List<ChildTypeDef> defs = new ArrayList<ChildTypeDef>();
NodeState resChildNodeDefinitions = parentType.getChildNode(REP_RESIDUAL_CHILD_NODE_DEFINITIONS);
for (String childType : filterChildren(resChildNodeDefinitions, NO_SNS_PROPERTY)) {
TypePredicate childTypePredicate = new TypePredicate(root, childType);
defs.add(new ChildTypeDef(parentTypePredicate, childTypePredicate));
}
return defs;
}
Aggregations