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

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

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

Tree.getProperties介绍

[英]All accessible property states. 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 no visible to iterators obtained from the returned iterable.
[中]所有可访问的属性状态。返回的Iterable具有快照语义。也就是说,它反映了调用时此树实例的状态。从返回的iterable中获取的迭代器看不到对该实例的后续更改。

代码示例

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

private Iterable<? extends PropertyState> getFilteredProperties() {
  return Iterables.filter(tree.getProperties(), getPropertyFilters());
}

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

public static Map<String, String> getNamespaceMap(Tree root) {
  Map<String, String> map = collectNamespaces(getNamespaceTree(root).getProperties());
  map.put("", ""); // default namespace, not included in tree
  return map;
}

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

public static Map<String, String> getNamespaceMap(Tree root) {
  Map<String, String> map = collectNamespaces(getNamespaceTree(root).getProperties());
  map.put("", ""); // default namespace, not included in tree
  return map;
}

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

@NotNull
public Iterable<String> getVersionLabels() throws RepositoryException {
  Tree versionLabels = getVersionLabelsTree();
  List<String> labels = new ArrayList<String>();
  for (PropertyState p : versionLabels.getProperties()) {
    if (p.getType() == Type.REFERENCE) {
      labels.add(p.getName());
    }
  }
  return labels;
}

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

@Nonnull
public Iterable<String> getVersionLabels() throws RepositoryException {
  Tree versionLabels = getVersionLabelsTree();
  List<String> labels = new ArrayList<String>();
  for (PropertyState p : versionLabels.getProperties()) {
    if (p.getType() == Type.REFERENCE) {
      labels.add(p.getName());
    }
  }
  return labels;
}

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

@NotNull
private Map<String, PropertyState> getRestrictionProperties(Tree aceTree) {
  Tree rTree = getRestrictionsTree(aceTree);
  Map<String, PropertyState> restrictionProperties = new HashMap<>();
  for (PropertyState property : rTree.getProperties()) {
    String name = property.getName();
    if (isRestrictionProperty(name)) {
      restrictionProperties.put(name, property);
    }
  }
  return restrictionProperties;
}

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

private static void render(Tree tree, JsonGenerator generator)
    throws IOException {
  generator.writeStartObject();
  for (PropertyState property : tree.getProperties()) {
    generator.writeFieldName(property.getName());
    render(property, generator);
  }
  for (Tree child : tree.getChildren()) {
    generator.writeFieldName(child.getName());
    generator.writeStartObject();
    generator.writeEndObject();
  }
  generator.writeEndObject();
}

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

@NotNull
public Iterable<String> getVersionLabels() throws RepositoryException {
  Tree versionLabels = getVersionLabelsTree();
  List<String> labels = new ArrayList<String>();
  for (PropertyState p : versionLabels.getProperties()) {
    if (p.getType() == Type.REFERENCE) {
      labels.add(p.getName());
    }
  }
  return labels;
}

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

@Nonnull
private Map<String, PropertyState> getRestrictionProperties(Tree aceTree) {
  Tree rTree = getRestrictionsTree(aceTree);
  Map<String, PropertyState> restrictionProperties = new HashMap<String, PropertyState>();
  for (PropertyState property : rTree.getProperties()) {
    String name = property.getName();
    if (isRestrictionProperty(name)) {
      restrictionProperties.put(name, property);
    }
  }
  return restrictionProperties;
}

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

public static Map<String, String> getNamespaceMap(Tree root) {
  Map<String, String> map = newHashMap();
  map.put("", ""); // default namespace, not included in tree
  Tree namespaces = getNamespaceTree(root);
  for (PropertyState property : namespaces.getProperties()) {
    String prefix = property.getName();
    if (STRING.equals(property.getType()) && isValidPrefix(prefix)) {
      map.put(prefix, property.getValue(STRING));
    }
  }
  return map;
}

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

private void copy(Tree source, Tree targetParent, String targetName) {
  Tree target = targetParent.addChild(targetName);
  for (PropertyState property : source.getProperties()) {
    target.setProperty(property);
  }
  for (Tree child : source.getChildren()) {
    copy(child, target, child.getName());
  }
}

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

@Test
public void testGetProperties() {
  Set<String> propertyNames = Sets.newHashSet(JcrConstants.JCR_PRIMARYTYPE, "aProp");
  Tree a = root.getTree("/a");
  for (PropertyState prop : a.getProperties()) {
    assertTrue(propertyNames.remove(prop.getName()));
  }
  assertTrue(propertyNames.isEmpty());
}

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

@Test
public void testGetProperties() {
  Set<String> propertyNames = Sets.newHashSet(JcrConstants.JCR_PRIMARYTYPE, "aProp");
  Tree a = root.getTree("/a");
  for (PropertyState prop : a.getProperties()) {
    assertTrue(propertyNames.remove(prop.getName()));
  }
  assertTrue(propertyNames.isEmpty());
}

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

@Test
  public void testGetProperties() throws Exception {
    setupPermission("/a", testPrincipal, false, PrivilegeConstants.REP_READ_PROPERTIES);

    testRoot.refresh();
    Tree a = testRoot.getTree("/a");
    Iterable<? extends PropertyState> props = a.getProperties();
    assertFalse(props.iterator().hasNext());
  }
}

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

@Override
public boolean check(MountedNodeStore mountedStore, Tree tree, ErrorHolder errorHolder, Context context) {
  
  String name = tree.getName();
  String path = tree.getPath();
  
  validate(mountedStore, errorHolder, context, name, path);
  
  for ( PropertyState prop : tree.getProperties() ) {
    String propName = prop.getName();
    validate(mountedStore, errorHolder, context, propName, PathUtils.concat(tree.getPath(), propName));
  }
  
  return true;
}

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

private String chooseProperty(String parentPath) {
  Tree state = root1.getTree(parentPath);
  int k = random.nextInt((int) (state.getPropertyCount() + 1));
  int c = 0;
  for (PropertyState entry : state.getProperties()) {
    if (c++ == k) {
      return PathUtils.concat(parentPath, entry.getName());
    }
  }
  return null;
}

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

@SuppressWarnings("unused")
private static void walktree(final Tree t) {
  System.out.println("+ " + t.getPath());
  for (PropertyState p : t.getProperties()) {
    System.out.println("  -" + p.getName() + "=" + p.getValue(STRING));
  }
  for (Tree t1 : t.getChildren()) {
    walktree(t1);
  }
}

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

@Test
public void testIsGranted() {
  for (String path : paths) {
    Tree tree = getRootProvider().createReadOnlyRoot(root).getTree(path);
    assertFalse(noPermissions.isGranted(tree, null, Permissions.NO_PERMISSION));
    for (PropertyState prop : tree.getProperties()) {
      assertFalse(noPermissions.isGranted(tree, prop, Permissions.NO_PERMISSION));
    }
    for (Tree child : tree.getChildren()) {
      assertFalse(noPermissions.isGranted(child, null, Permissions.NO_PERMISSION));
    }
  }
}

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

private static void checkEqual(Tree tree1, Tree tree2) {
    assertEquals(tree1.getChildrenCount(Long.MAX_VALUE), tree2.getChildrenCount(Long.MAX_VALUE));
    assertEquals(tree1.getPropertyCount(), tree2.getPropertyCount());

    for (PropertyState property1 : tree1.getProperties()) {
      assertEquals(property1, tree2.getProperty(property1.getName()));
    }

    for (Tree child1 : tree1.getChildren()) {
      checkEqual(child1, tree2.getChild(child1.getName()));
    }
  }
}

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

@Test
public void testIsGranted() {
  for (String path : paths) {
    Tree tree = getRootProvider().createReadOnlyRoot(root).getTree(path);
    assertTrue(tree.exists());
    assertTrue(all.isGranted(tree, null, Permissions.ALL));
    for (PropertyState prop : tree.getProperties()) {
      assertTrue(all.isGranted(tree, prop, Permissions.ALL));
    }
    for (Tree child : tree.getChildren()) {
      assertTrue(all.isGranted(child, null, Permissions.ALL));
    }
  }
}

相关文章