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

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

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

Tree.getStatus介绍

[英]Get the Status of this tree instance.
[中]获取此树实例的状态。

代码示例

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

@Override
@CheckForNull
public Status getStatus() {
  return tree.getStatus();
}

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

@Override
@Nullable
public Status getStatus() {
  return tree.getStatus();
}

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

@Override
@Nullable
public Status getStatus() {
  return tree.getStatus();
}

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

@NotNull
private Iterator<String> getMixinTypeNames(@NotNull Tree tree) throws RepositoryException {
  Iterator<String> mixinNames = Collections.emptyIterator();
  if (tree.hasProperty(JcrConstants.JCR_MIXINTYPES) || canReadMixinTypes(tree)) {
    mixinNames = TreeUtil.getNames(tree, JcrConstants.JCR_MIXINTYPES).iterator();
  } else if (tree.getStatus() != Status.NEW) {
    // OAK-2441: for backwards compatibility with Jackrabbit 2.x try to
    // read the primary type from the underlying node state.
    mixinNames = TreeUtil.getNames(
        RootFactory.createReadOnlyRoot(sessionDelegate.getRoot()).getTree(tree.getPath()),
        JcrConstants.JCR_MIXINTYPES).iterator();
  }
  return mixinNames;
}

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

@Nonnull
private Iterator<String> getMixinTypeNames(@Nonnull Tree tree) throws RepositoryException {
  Iterator<String> mixinNames = Collections.emptyIterator();
  if (tree.hasProperty(JcrConstants.JCR_MIXINTYPES) || canReadProperty(tree, JcrConstants.JCR_MIXINTYPES)) {
    mixinNames = TreeUtil.getNames(tree, JcrConstants.JCR_MIXINTYPES).iterator();
  } else if (tree.getStatus() != Status.NEW) {
    // OAK-2441: for backwards compatibility with Jackrabbit 2.x try to
    // read the primary type from the underlying node state.
    mixinNames = TreeUtil.getNames(
        RootFactory.createReadOnlyRoot(sessionDelegate.getRoot()).getTree(tree.getPath()),
        JcrConstants.JCR_MIXINTYPES).iterator();
  }
  return mixinNames;
}

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

@NotNull
private Iterator<String> getMixinTypeNames(@NotNull Tree tree) throws RepositoryException {
  Iterator<String> mixinNames = Collections.emptyIterator();
  if (tree.hasProperty(JcrConstants.JCR_MIXINTYPES) || canReadMixinTypes(tree)) {
    mixinNames = TreeUtil.getNames(tree, JcrConstants.JCR_MIXINTYPES).iterator();
  } else if (tree.getStatus() != Status.NEW) {
    // OAK-2441: for backwards compatibility with Jackrabbit 2.x try to
    // read the primary type from the underlying node state.
    mixinNames = TreeUtil.getNames(
        RootFactory.createReadOnlyRoot(sessionDelegate.getRoot()).getTree(tree.getPath()),
        JcrConstants.JCR_MIXINTYPES).iterator();
  }
  return mixinNames;
}

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

@Nullable
private String getPrimaryTypeName(@NotNull Tree tree) {
  String primaryTypeName = null;
  if (tree.hasProperty(JcrConstants.JCR_PRIMARYTYPE)) {
    primaryTypeName = TreeUtil.getPrimaryTypeName(tree);
  } else if (tree.getStatus() != Status.NEW) {
    // OAK-2441: for backwards compatibility with Jackrabbit 2.x try to
    // read the primary type from the underlying node state.
    primaryTypeName = TreeUtil.getPrimaryTypeName(RootFactory.createReadOnlyRoot(sessionDelegate.getRoot()).getTree(tree.getPath()));
  }
  return primaryTypeName;
}

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

@Nullable
private String getPrimaryTypeName(@NotNull Tree tree) {
  String primaryTypeName = null;
  if (tree.hasProperty(JcrConstants.JCR_PRIMARYTYPE)) {
    primaryTypeName = TreeUtil.getPrimaryTypeName(tree);
  } else if (tree.getStatus() != Status.NEW) {
    // OAK-2441: for backwards compatibility with Jackrabbit 2.x try to
    // read the primary type from the underlying node state.
    primaryTypeName = TreeUtil.getPrimaryTypeName(RootFactory.createReadOnlyRoot(sessionDelegate.getRoot()).getTree(tree.getPath()));
  }
  return primaryTypeName;
}

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

@CheckForNull
private String getPrimaryTypeName(@Nonnull Tree tree) {
  String primaryTypeName = null;
  if (tree.hasProperty(JcrConstants.JCR_PRIMARYTYPE)) {
    primaryTypeName = TreeUtil.getPrimaryTypeName(tree);
  } else if (tree.getStatus() != Status.NEW) {
    // OAK-2441: for backwards compatibility with Jackrabbit 2.x try to
    // read the primary type from the underlying node state.
    primaryTypeName = TreeUtil.getPrimaryTypeName(RootFactory.createReadOnlyRoot(sessionDelegate.getRoot()).getTree(tree.getPath()));
  }
  return primaryTypeName;
}

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

@Test
public void modifiedAfterRebase() throws CommitFailedException {
  Tree tree = root.getTree("/");
  tree.addChild("new");
  assertEquals(Status.MODIFIED, tree.getStatus());
  root.rebase();
  assertEquals(Status.MODIFIED, tree.getStatus());
}

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

if (protectedParent.getStatus() == Tree.Status.NEW) {
  if (a.isGroup()) {
    userManager.onCreate((Group) a);

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

@Test
public void testDisconnectAfterRefresh() {
  Tree x = root.getTree("/x");
  x.setProperty("p", "any");
  Tree xx = x.addChild("xx");
  xx.setProperty("q", "any");
  assertEquals(Status.MODIFIED, x.getStatus());
  assertEquals(Status.NEW, x.getPropertyStatus("p"));
  assertEquals(Status.NEW, xx.getStatus());
  assertEquals(Status.NEW, xx.getPropertyStatus("q"));
  root.refresh();
  assertEquals(Status.UNCHANGED, x.getStatus());
  assertNull(x.getPropertyStatus("p"));
  assertFalse(xx.exists());
}

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

@Test
public void noTransitiveModifiedStatus() throws CommitFailedException {
  Tree tree = root.getTree("/");
  tree.addChild("one").addChild("two");
  root.commit();
  tree.getChild("one").getChild("two").addChild("three");
  assertEquals(Tree.Status.UNCHANGED, tree.getChild("one").getStatus());
  assertEquals(Tree.Status.MODIFIED, tree.getChild("one").getChild("two").getStatus());
}

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

@Test
public void purgePreservesStatus() throws CommitFailedException {
  Tree x = session.getLatestRoot().getTree("/x");
  Tree added = x.addChild("added");
  for (int k = 0; k < 10000; k++) {
    assertEquals("k=" + k, NEW, x.getChild("added").getStatus());
    x.addChild("k" + k);
  }
}

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

@Test
public void moveExistingParent() throws CommitFailedException {
  Root root = session.getLatestRoot();
  root.getTree("/").addChild("parent").addChild("new");
  root.commit();
  Tree parent = root.getTree("/parent");
  Tree n = root.getTree("/parent/new");
  root.move("/parent", "/moved");
  assertEquals(Status.NEW, parent.getStatus());
  assertEquals(Status.NEW, n.getStatus());
  assertEquals("/moved", parent.getPath());
  assertEquals("/moved/new", n.getPath());
}

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

@Test
public void isNew() throws CommitFailedException {
  Tree tree = root.getTree("/");
  tree.addChild("c");
  root.commit();
  tree.getChild("c").remove();
  Tree c = tree.addChild("c");
  assertEquals(Status.NEW, c.getStatus());
}

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

@Test
public void nodeStatus() throws CommitFailedException {
  Tree tree = root.getTree("/");
  tree.addChild("new");
  assertEquals(Tree.Status.NEW, tree.getChild("new").getStatus());
  root.commit();
  assertEquals(Tree.Status.UNCHANGED, tree.getChild("new").getStatus());
  Tree added = tree.getChild("new");
  added.addChild("another");
  assertEquals(Tree.Status.MODIFIED, tree.getChild("new").getStatus());
  root.commit();
  assertEquals(Tree.Status.UNCHANGED, tree.getChild("new").getStatus());
  tree.getChild("new").getChild("another").remove();
  assertEquals(Tree.Status.MODIFIED, tree.getChild("new").getStatus());
  root.commit();
  assertEquals(Tree.Status.UNCHANGED, tree.getChild("new").getStatus());
  assertFalse(tree.getChild("new").getChild("another").exists());
  Tree x = root.getTree("/x");
  Tree y = x.addChild("y");
  x.remove();
  assertFalse(x.exists());
  assertFalse(y.exists());
}

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

@Test
public void rebasePreservesStatus() throws CommitFailedException {
  Root root1 = session.getLatestRoot();
  Root root2 = session.getLatestRoot();
  Tree x = root1.getTree("/x");
  Tree added = x.addChild("added");
  assertEquals(NEW, added.getStatus());
  root2.getTree("/x").addChild("bar");
  root2.commit();
  root1.rebase();
  assertTrue(x.hasChild("added"));
  assertEquals(NEW, x.getChild("added").getStatus());
  assertTrue(x.hasChild("bar"));
}

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

@Test
public void testDisconnectAfterRemove() {
  Tree x = root.getTree("/x");
  x.setProperty("p", "any");
  Tree xx = x.addChild("xx");
  xx.setProperty("q", "any");
  assertEquals(Status.MODIFIED, x.getStatus());
  assertEquals(Status.NEW, x.getPropertyStatus("p"));
  assertEquals(Status.NEW, xx.getStatus());
  assertEquals(Status.NEW, xx.getPropertyStatus("q"));
  root.getTree("/x").remove();
  assertFalse(x.exists());
  assertFalse(xx.exists());
}

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

@Test
public void moveRemoveAdd() {
  Root root = session.getLatestRoot();
  Tree x = root.getTree("/x");
  Tree z = root.getTree("/z");
  z.setProperty("p", "1");
  root.move("/z", "/x/z");
  root.getTree("/x/z").remove();
  assertFalse(z.exists());
  x.addChild("z");
  assertEquals(Status.NEW, z.getStatus());
  x.getChild("z").setProperty("p", "2");
  PropertyState p = z.getProperty("p");
  assertNotNull(p);
  assertEquals("2", p.getValue(Type.STRING));
}

相关文章