Package org.apache.jackrabbit.oak.api

Examples of org.apache.jackrabbit.oak.api.Tree.removeChild()


    public void removeChild() throws CommitFailedException {
        RootImpl root = new RootImpl(store, "test");
        Tree tree = root.getTree("/");

        assertTrue(tree.hasChild("x"));
        tree.removeChild("x");
        assertFalse(tree.hasChild("x"));

        root.commit();
        tree = root.getTree("/");
       
View Full Code Here


        RootImpl root = new RootImpl(store, "test");
        Tree tree = root.getTree("/");

        assertEquals(3, tree.getChildrenCount());

        tree.removeChild("x");
        assertEquals(2, tree.getChildrenCount());

        tree.addChild("a");
        assertEquals(3, tree.getChildrenCount());
View Full Code Here

        root1.rebase();
        checkEqual(root1.getTree("/"), (root2.getTree("/")));

        Tree one = root2.getTree("/one");
        one.removeChild("two");
        one.addChild("four");
        root2.commit();

        root1.rebase();
        checkEqual(root1.getTree("/"), (root2.getTree("/")));
View Full Code Here

    public void removeChild() throws CommitFailedException {
        RootImpl root = new RootImpl(store, null);
        Tree tree = root.getTree("/");

        assertTrue(tree.hasChild("x"));
        tree.removeChild("x");
        assertFalse(tree.hasChild("x"));

        root.commit(DefaultConflictHandler.OURS);
        tree = root.getTree("/");
       
View Full Code Here

        RootImpl root = new RootImpl(store, null);
        Tree tree = root.getTree("/");

        assertEquals(3, tree.getChildrenCount());

        tree.removeChild("x");
        assertEquals(2, tree.getChildrenCount());

        tree.addChild("a");
        assertEquals(3, tree.getChildrenCount());
View Full Code Here

        root1.rebase(DefaultConflictHandler.OURS);
        checkEqual(root1.getTree("/"), (root2.getTree("/")));

        Tree one = root2.getTree("/one");
        one.removeChild("two");
        one.addChild("four");
        root2.commit(DefaultConflictHandler.OURS);

        root1.rebase(DefaultConflictHandler.OURS);
        checkEqual(root1.getTree("/"), (root2.getTree("/")));
View Full Code Here

     * Remove the node if not root. Does nothing otherwise
     */
    public void remove() throws InvalidItemStateException {
        Tree parentTree = getParentTree();
        if (parentTree != null) {
            parentTree.removeChild(getName());
        }
    }

    // -----------------------------------------------------------< private >---

View Full Code Here

        try {
            Root root = (Root) request.getAttribute("root");
            Tree tree = (Tree) request.getAttribute("tree");
            Tree parent = tree.getParent();
            if (parent != null) {
                parent.removeChild(tree.getName());
                root.commit(DefaultConflictHandler.OURS);
                response.sendError(HttpServletResponse.SC_OK);
            } else {
                // Can't remove the root node
                response.sendError(HttpServletResponse.SC_FORBIDDEN);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.