org.apache.jackrabbit.oak.api.Tree.getChildren()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中org.apache.jackrabbit.oak.api.Tree.getChildren()方法的一些代码示例,展示了Tree.getChildren()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.getChildren()方法的具体详情如下:
包路径:org.apache.jackrabbit.oak.api.Tree
类名称:Tree
方法名:getChildren

Tree.getChildren介绍

[英]All accessible children of this Tree instance. The returned Iterable has snapshot semantics. That is, it reflect the state of this Tree instance at the time of the call. Later changes to this instance are not visible to iterators obtained from the returned iterable.
[中]此树实例的所有可访问子级。返回的Iterable具有快照语义。也就是说,它反映了调用时此树实例的状态。对于从返回的iterable中获取的迭代器,对该实例的后续更改不可见。

代码示例

代码示例来源:origin: org.apache.jackrabbit/oak-core

private Collection<PermissionEntry> loadPermissionEntries(@NotNull String path,
                  @NotNull Tree tree) {
  Collection<PermissionEntry> ret = new TreeSet<>();
  for (Tree ace : tree.getChildren()) {
    if (ace.getName().charAt(0) != 'c') {
      ret.add(createPermissionEntry(path, ace));
    }
  }
  return ret;
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testKnownMemberThresholdReached() throws Exception {
  List<String> memberIds = new ArrayList();
  for (int i = 0; i <= MembershipWriter.DEFAULT_MEMBERSHIP_THRESHOLD; i++) {
    memberIds.add(userProvider.getContentID("m"+i));
  }
  groupTree.setProperty(REP_MEMBERS, memberIds, Type.STRINGS);
  importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, knownMemberContentId)));
  importer.processReferences();
  assertEquals(1, memberRefList.getChildrenCount(100));
  assertTrue(memberRefList.getChildren().iterator().next().hasProperty(REP_MEMBERS));
}

代码示例来源:origin: org.apache.jackrabbit/oak-core

private MemberReferenceIterator(@NotNull Tree groupTree) {
  this.trees = Iterators.concat(
      Iterators.singletonIterator(groupTree),
      groupTree.getChild(REP_MEMBERS_LIST).getChildren().iterator()
  );
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

private MemberReferenceIterator(@Nonnull Tree groupTree) {
  this.trees = Iterators.concat(
      Iterators.singletonIterator(groupTree),
      groupTree.getChild(REP_MEMBERS_LIST).getChildren().iterator()
  );
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public Iterable<Tree> children(@NotNull  Tree root) {
    //Break at maxLevel
    if (PathUtils.getDepth(root.getPath()) >= maxDepth) {
      return Collections.emptyList();
    }
    return root.getChildren();
  }
};

代码示例来源:origin: apache/jackrabbit-oak

private Tree findExisting(String includePath) {
  for (Tree tree : aggregate.getChildren()){
    if (includePath.equals(tree.getProperty(FulltextIndexConstants.AGG_PATH).getValue(Type.STRING))){
      return tree;
    }
  }
  return null;
}

代码示例来源:origin: apache/jackrabbit-oak

private Tree findExisting(String includePath) {
  for (Tree tree : aggregate.getChildren()){
    if (includePath.equals(tree.getProperty(FulltextIndexConstants.AGG_PATH).getValue(Type.STRING))){
      return tree;
    }
  }
  return null;
}

代码示例来源:origin: apache/jackrabbit-oak

public static String findDefaultPrimaryType(Tree definitions, boolean sns) {
  for (Tree definition : definitions.getChildren()) {
    String defaultName = getName(definition, JCR_DEFAULTPRIMARYTYPE);
    if (defaultName != null
        && (!sns || getBoolean(definition, JCR_SAMENAMESIBLINGS))) {
      return defaultName;
    }
  }
  return null;
}

代码示例来源:origin: apache/jackrabbit-oak

private void loadExisting(Tree aggregate) {
  for (Tree tree : aggregate.getChildren()){
    if (tree.hasProperty(FulltextIndexConstants.AGG_PATH)) {
      Include include = new Include(this, tree);
      includes.put(include.getPath(), include);
    }
  }
}

代码示例来源:origin: apache/jackrabbit-oak

private Tree findExisting(String name) {
  for (Tree tree : getPropsTree().getChildren()){
    if (name.equals(tree.getProperty(FulltextIndexConstants.PROP_NAME).getValue(Type.STRING))){
      return tree;
    }
  }
  return null;
}

代码示例来源:origin: apache/jackrabbit-oak

private void loadExisting(Tree aggregate) {
  for (Tree tree : aggregate.getChildren()){
    if (tree.hasProperty(FulltextIndexConstants.AGG_PATH)) {
      Include include = new Include(this, tree);
      includes.put(include.getPath(), include);
    }
  }
}

代码示例来源:origin: org.apache.jackrabbit/oak-lucene

private Tree findExisting(String name) {
  for (Tree tree : getPropsTree().getChildren()){
    if (name.equals(tree.getProperty(FulltextIndexConstants.PROP_NAME).getValue(Type.STRING))){
      return tree;
    }
  }
  return null;
}

代码示例来源:origin: org.apache.jackrabbit/oak-lucene

private void loadExisting(Tree aggregate) {
  for (Tree tree : aggregate.getChildren()){
    if (tree.hasProperty(FulltextIndexConstants.AGG_PATH)) {
      Include include = new Include(this, tree);
      includes.put(include.getPath(), include);
    }
  }
}

代码示例来源:origin: org.apache.jackrabbit/oak-core

@Override
public NodeTypeIterator getAllNodeTypes() throws RepositoryException {
  List<NodeType> list = Lists.newArrayList();
  Tree types = getTypes();
  if (types != null) {
    NamePathMapper mapper = getNamePathMapper();
    for (Tree type : types.getChildren()) {
      list.add(new NodeTypeImpl(type, mapper));
    }
  }
  return new NodeTypeIteratorAdapter(list);
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
public NodeTypeIterator getAllNodeTypes() throws RepositoryException {
  List<NodeType> list = Lists.newArrayList();
  Tree types = getTypes();
  if (types != null) {
    NamePathMapper mapper = getNamePathMapper();
    for (Tree type : types.getChildren()) {
      list.add(new NodeTypeImpl(type, mapper));
    }
  }
  return new NodeTypeIteratorAdapter(list);
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testGetHiddenChildren() {
  Iterable<Tree> children = parent.getChildren();
  assertFalse(children.iterator().hasNext());
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testGetPrivilegeNamesFromCache() {
  when(privTree.exists()).thenReturn(true);
  when(privTree.getChildren()).thenReturn(ImmutableSet.of(pTree));
  Set<String> names = bitsProvider.getPrivilegeNames(bits);
  assertSame(names, bitsProvider.getPrivilegeNames(bits));
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testCanReadPropertyAceNode2() throws Exception {
  Tree aceTree = root.getTree(REPO_POLICY_PATH).getChildren().iterator().next();
  PropertyState principalProp = aceTree.getProperty(REP_PRINCIPAL_NAME);
  TreePermission tp = getTreePermission(noAccessSession, aceTree.getPath());
  assertFalse(tp.canRead(principalProp));
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testEndWithoutChildInfo() throws Exception {
  init();
  importer.start(aclTree);
  importer.end(aclTree);
  assertTrue(root.hasPendingChanges());
  assertFalse(aclTree.getChildren().iterator().hasNext());
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void ruleOrder() throws Exception{
  builder.indexRule("nt:unstructured");
  builder.indexRule("nt:base");
  Tree tree = TreeFactory.createTree(EMPTY_NODE.builder());
  builder.build(tree);
  //Assert the order
  Iterator<Tree> children = tree.getChild("indexRules").getChildren().iterator();
  assertEquals("nt:unstructured", children.next().getName());
  assertEquals("nt:base", children.next().getName());
}

相关文章