本文整理了Java中org.apache.jackrabbit.oak.api.Tree.hasChild()
方法的一些代码示例,展示了Tree.hasChild()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.hasChild()
方法的具体详情如下:
包路径:org.apache.jackrabbit.oak.api.Tree
类名称:Tree
方法名:hasChild
[英]Determine if a child of this Tree instance exists. If no child exists or an existing child isn't accessible this method returns false.
[中]确定此树实例的子实例是否存在。如果不存在子项或现有子项不可访问,则此方法返回false。
代码示例来源:origin: apache/jackrabbit-oak
/**
* Utility to determine if a given group has any members.
*
* @param groupTree The tree of the target group.
* @return {@code true} if the group has any members i.e. if it has a rep:members
* property or a rep:membersList child node.
*/
private static boolean hasMembers(@NotNull Tree groupTree) {
return groupTree.getPropertyStatus(REP_MEMBERS) != null || groupTree.hasChild(REP_MEMBERS_LIST);
}
代码示例来源:origin: org.apache.jackrabbit/oak-core
/**
* Utility to determine if a given group has any members.
*
* @param groupTree The tree of the target group.
* @return {@code true} if the group has any members i.e. if it has a rep:members
* property or a rep:membersList child node.
*/
private static boolean hasMembers(@NotNull Tree groupTree) {
return groupTree.getPropertyStatus(REP_MEMBERS) != null || groupTree.hasChild(REP_MEMBERS_LIST);
}
代码示例来源:origin: apache/jackrabbit-oak
@Override
public Collection<PermissionEntry> getEntries(@NotNull Tree accessControlledTree) {
return (accessControlledTree.hasChild(AccessControlConstants.REP_POLICY)) ?
getEntries(accessControlledTree.getPath()) :
Collections.<PermissionEntry>emptyList();
}
}
代码示例来源:origin: org.apache.jackrabbit/oak-core
@Override
public boolean hasNodeType(String name) throws RepositoryException {
Tree types = getTypes();
return types != null && types.hasChild(getOakName(name));
}
代码示例来源:origin: apache/jackrabbit-oak
private static Tree getOrCreateChild(Tree tree, String name){
if (tree.hasChild(name)){
return tree.getChild(name);
}
Tree child = tree.addChild(name);
child.setOrderableChildren(true);
child.setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED, NAME);
return child;
}
代码示例来源:origin: apache/jackrabbit-oak
private static Tree getOrCreateChild(Tree tree, String name){
if (tree.hasChild(name)){
return tree.getChild(name);
}
Tree child = tree.addChild(name);
child.setOrderableChildren(true);
child.setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED, NAME);
return child;
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testHasChild() throws Exception {
Tree rootTree = testRoot.getTree("/");
assertTrue(rootTree.hasChild("a"));
assertFalse(rootTree.hasChild(AccessControlConstants.REP_POLICY));
Tree a = rootTree.getChild("a");
assertTrue(a.hasChild("b"));
assertFalse(a.hasChild("bb"));
Tree b = a.getChild("b");
assertTrue(b.hasChild("c"));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testAllowChild() throws Exception {
Tree rootTree1 = testRoot1.getTree("/");
Tree rootTree2 = testRoot2.getTree("/");
assertFalse(rootTree1.hasChild("a/bb"));
assertFalse(rootTree2.hasChild("a/bb"));
// now allow read with root session
setupPermission("/a/bb", testPrincipal, true, PrivilegeConstants.JCR_READ);
// the test sessions still need to see the old ACLs
assertFalse(rootTree1.hasChild("a/bb"));
assertFalse(rootTree2.hasChild("a/bb"));
}
代码示例来源:origin: apache/jackrabbit-oak
@Override
public boolean matches(@NotNull Tree tree, @Nullable PropertyState property) {
boolean match = false;
// configured property name found on underlying jcr:content node has precedence
if (tree.hasChild(JcrConstants.JCR_CONTENT)) {
match = tree.getChild(JcrConstants.JCR_CONTENT).hasProperty(propertyName);
}
if (!match) {
match = tree.hasProperty(propertyName);
}
return negate ? !match : match;
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testGetBitsKnownPrivName() {
when(privTree.exists()).thenReturn(true);
when(privTree.hasChild(KNOWN_PRIV_NAME)).thenReturn(true);
when(privTree.getChild(KNOWN_PRIV_NAME)).thenReturn(pTree);
assertEquals(bits.unmodifiable(), bitsProvider.getBits(KNOWN_PRIV_NAME));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void removeChild() throws CommitFailedException {
Tree tree = root.getTree("/");
assertTrue(tree.hasChild("x"));
tree.getChild("x").remove();
assertFalse(tree.hasChild("x"));
root.commit();
assertFalse(tree.hasChild("x"));
}
代码示例来源:origin: apache/jackrabbit-oak
private Tree createPath(String path){
Tree base = root.getTree("/");
for (String e : PathUtils.elements(path)){
base = base.hasChild(e) ? base.getChild(e) : base.addChild(e);
}
return base;
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testUnknownMember() throws Exception {
importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, unknownContentId)));
importer.processReferences();
// default importbehavior == IGNORE
assertFalse(memberRefList.hasChild("memberRef"));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testMixedMembers() throws Exception {
importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, unknownContentId, knownMemberContentId)));
importer.processReferences();
assertFalse(memberRefList.hasChild("memberRef"));
}
代码示例来源:origin: apache/jackrabbit-oak
/**
* Test asserting that {@link AuthorizableAction#onCreate(User, String, Root, NamePathMapper)}
* is omitted upon calling {@link UserManager#createSystemUser(String, String)}.
*/
@Test
public void testOnCreateOmitted() throws Exception {
User user = createUser(null);
Tree t = root.getTree(user.getPath());
assertFalse(t.hasChild(AccessControlConstants.REP_POLICY));
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void addExistingChild() throws CommitFailedException {
Tree tree = root.getTree("/");
assertFalse(tree.hasChild("new"));
tree.addChild("new");
root.commit();
assertTrue(tree.hasChild("new"));
Tree added = tree.addChild("new");
assertTrue(added.exists());
assertEquals("new", added.getName());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testWriteInvalidRestrictions() throws Exception {
PropertyState ps = PropertyStates.createProperty(REP_GLOB, valueFactory.createValue(false));
Tree aceTree = getAceTree();
restrictionProvider.writeRestrictions(testPath, aceTree, ImmutableSet.<Restriction>of(new RestrictionImpl(ps, false)));
assertTrue(aceTree.hasChild(REP_RESTRICTIONS));
Tree restr = aceTree.getChild(REP_RESTRICTIONS);
assertEquals(ps, restr.getProperty(REP_GLOB));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testPropertiesCompletedClearsCache() throws Exception {
Tree userTree = createUserTree();
Tree cacheTree = userTree.addChild(CacheConstants.REP_CACHE);
cacheTree.setProperty(JcrConstants.JCR_PRIMARYTYPE, CacheConstants.NT_REP_CACHE);
importer.propertiesCompleted(cacheTree);
assertFalse(cacheTree.exists());
assertFalse(userTree.hasChild(CacheConstants.REP_CACHE));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testPolicyChild() throws Exception {
assertTrue(root.getTree('/' + AccessControlConstants.REP_POLICY).exists());
// 'testUser' must not have access to the policy node
Tree rootTree = testRoot.getTree("/");
assertFalse(rootTree.hasChild(AccessControlConstants.REP_POLICY));
assertFalse(rootTree.getChild(AccessControlConstants.REP_POLICY).exists());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testOnlySystemCreatesCache() throws Exception {
Set<? extends Principal> principals = principalProvider.getPrincipals(getTestUser().getID());
assertPrincipals(principals, EveryonePrincipal.getInstance(), testGroup.getPrincipal(), getTestUser().getPrincipal());
root.refresh();
Tree userTree = root.getTree(getTestUser().getPath());
assertFalse(userTree.hasChild(CacheConstants.REP_CACHE));
}
内容来源于网络,如有侵权,请联系作者删除!