本文整理了Java中org.apache.jackrabbit.oak.api.Tree.remove()
方法的一些代码示例,展示了Tree.remove()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.remove()
方法的具体详情如下:
包路径:org.apache.jackrabbit.oak.api.Tree
类名称:Tree
方法名:remove
[英]Remove this tree instance. This operation never succeeds for the root tree.
[中]删除此树实例。对于根树,此操作永远不会成功。
代码示例来源:origin: org.apache.jackrabbit/oak-remote
@Override
public void apply(Root root) throws RemoteCommitException {
logger.debug("performing 'remove' operation on path={}", path);
Tree tree = root.getTree(path);
if (!tree.exists()) {
throw new RemoteCommitException("tree does not exists");
}
if (!tree.remove()) {
throw new RemoteCommitException("unable to remove the tree");
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Override
public void after() throws Exception {
try {
root.getTree("/content").remove();
root.getTree("/var").remove();
root.commit();
} finally {
super.after();
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Override
public boolean remove() {
Tree tokenTree = getTokenTree(this);
if (tokenTree.exists()) {
try {
if (tokenTree.remove()) {
root.commit(CommitMarker.asCommitAttributes());
return true;
}
} catch (CommitFailedException e) {
log.debug("Error while removing expired token {}", e.getMessage());
}
}
return false;
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testDefaultMount() throws Exception {
setUp();
ContentSession s = repository.login(null, null);
Root r = s.getLatestRoot();
Tree t = r.getTree("/").addChild("test");
t.addChild("node1").setProperty("jcr:primaryType", "nt:base");
t.addChild("node2").setProperty("jcr:primaryType", "nt:base");
t.addChild("node3").setProperty("jcr:primaryType", "nt:base");
r.commit();
t.getChild("node1").removeProperty("jcr:primaryType");
r.commit();
t.getChild("node1").remove();
r.commit();
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testRemoveExternalUserTree() throws Exception {
root.getTree(externalUserPath).remove();
root.commit();
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Override
public void onDisable(@NotNull User user, @Nullable String disableReason, @NotNull Root root, @NotNull NamePathMapper namePathMapper) throws RepositoryException {
if (disableReason != null) {
Tree t = root.getTree(user.getPath());
if (t.exists() && t.hasChild("profiles")) {
t.getChild("profiles").remove();
}
}
}
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak
@Override
public boolean remove() {
Tree tokenTree = getTokenTree(this);
if (tokenTree.exists()) {
try {
if (tokenTree.remove()) {
root.commit(CommitMarker.asCommitAttributes());
return true;
}
} catch (CommitFailedException e) {
log.debug("Error while removing expired token {}", e.getMessage());
}
}
return false;
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void propertyStatus() throws CommitFailedException {
Tree tree = root.getTree("/");
tree.setProperty("new", "value1");
assertEquals(Tree.Status.NEW, tree.getPropertyStatus("new"));
root.commit();
assertEquals(Tree.Status.UNCHANGED, tree.getPropertyStatus("new"));
tree.setProperty("new", "value2");
assertEquals(Tree.Status.MODIFIED, tree.getPropertyStatus("new"));
root.commit();
assertEquals(Tree.Status.UNCHANGED, tree.getPropertyStatus("new"));
tree.removeProperty("new");
assertNull(tree.getPropertyStatus("new"));
root.commit();
assertNull(tree.getPropertyStatus("new"));
Tree x = root.getTree("/x");
x.setProperty("y", "value1");
x.remove();
}
代码示例来源:origin: apache/jackrabbit-oak
@After
public void after() throws Exception {
// Remove test tree
root.getTree("/UnionQueryTest").remove();
root.commit();
}
代码示例来源:origin: apache/jackrabbit-oak
@Test(expected = IllegalStateException.class)
public void testGetTreeNotExisting() throws Exception {
root.getTree(authorizable.getPath()).remove();
// getTree must throw
authorizable.getTree();
}
代码示例来源:origin: org.apache.jackrabbit/oak-core
@Override
public boolean remove() {
Tree tokenTree = getTokenTree(this);
if (tokenTree.exists()) {
try {
if (tokenTree.remove()) {
root.commit(CommitMarker.asCommitAttributes());
return true;
}
} catch (CommitFailedException e) {
log.debug("Error while removing expired token {}", e.getMessage());
}
}
return false;
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testDeleteDeletedNode() throws CommitFailedException {
theirRoot.getTree("/x").remove();
ourRoot.getTree("/x").remove();
theirRoot.commit();
ourRoot.commit();
assertFalse(ourRoot.getTree("/x").exists());
}
代码示例来源:origin: apache/jackrabbit-oak
@Override
void apply(Root root) {
String parentPath = PathUtils.getParentPath(path);
String name = PathUtils.getName(path);
root.getTree(parentPath).getChild(name).remove();
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testRemoveTokenNode() throws Exception {
TokenInfo info = tokenProvider.createToken(userId, Collections.<String, Object>emptyMap());
getTokenTree(info).remove();
root.commit();
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testDeleteDeletedNode() throws CommitFailedException {
theirRoot.getTree("/x").remove();
ourRoot.getTree("/x").remove();
theirRoot.commit();
ourRoot.commit();
assertFalse(ourRoot.getTree("/x").exists());
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test(expected = AccessControlException.class)
public void testRemovePolicyNodeRemoved() throws Exception {
setupPolicy(testPath);
AccessControlPolicy acl = acMgr.getPolicies(testPath)[0];
root.getTree(testPath + "/" + REP_POLICY).remove();
acMgr.removePolicy(testPath, acl);
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testRemoveCache() throws Exception {
Tree cache = getCache(getTestUser());
cache.remove();
root.commit();
}
代码示例来源:origin: apache/jackrabbit-oak
@Override
public void after() throws Exception {
try {
root.refresh();
root.getTree("/test").remove();
root.commit();
} finally {
super.after();
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testRemoveParentTree() throws Exception {
UserProvider up = createUserProvider();
Tree u1 = up.createUser("b", "b");
Tree u2 = up.createUser("bb", "bb");
Tree folder = root.getTree(Text.getRelativeParent(u1.getPath(), 2));
folder.remove();
if (up.getAuthorizable("b") != null) {
fail("Removing the top authorizable folder must remove all users contained.");
u1.remove();
}
if (up.getAuthorizable("bb") != null) {
fail("Removing the top authorizable folder must remove all users contained.");
u2.remove();
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testGetVersionableTargetRemoved() throws Exception {
Tree baseVersion = checkNotNull(versionManager.getBaseVersion(versionable));
versionable.remove();
root.commit();
Tree t = versionManager.getVersionable(baseVersion, workspaceName);
assertNotNull(t);
assertFalse(t.exists());
}
内容来源于网络,如有侵权,请联系作者删除!