Package org.apache.jackrabbit.oak.api

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


        if (!types.exists()) {
            Tree system = root.getTree('/' + JCR_SYSTEM);
            if (!system.exists()) {
                system = root.getTree("/").addChild(JCR_SYSTEM);
            }
            types = system.addChild(JCR_NODE_TYPES);
        }
        return types;
    }

    @Override
View Full Code Here


            Root root = (Root) request.getAttribute("root");
            Tree tree = (Tree) request.getAttribute("tree");
            String path = (String) request.getAttribute("path");

            for (String name : PathUtils.elements(path)) {
                tree = tree.addChild(name);
            }

            ObjectMapper mapper = new ObjectMapper();
            JsonNode node = mapper.readTree(request.getInputStream());
            if (node.isObject()) {
View Full Code Here

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

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

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

    @Test
    public void oak962() throws CommitFailedException {
        Root root = session.getLatestRoot();
        Tree r = root.getTree("/").addChild("root");
        r.addChild("N3");
        r.addChild("N6");
        r.getChild("N6").addChild("N7");
        root.commit();
        root.move("/root/N6/N7", "/root/N3/N12");
        r.getChild("N3").getChild("N12").remove();
View Full Code Here

    @Test
    public void oak962() throws CommitFailedException {
        Root root = session.getLatestRoot();
        Tree r = root.getTree("/").addChild("root");
        r.addChild("N3");
        r.addChild("N6");
        r.getChild("N6").addChild("N7");
        root.commit();
        root.move("/root/N6/N7", "/root/N3/N12");
        r.getChild("N3").getChild("N12").remove();
        r.getChild("N6").remove();
View Full Code Here

    }

    @Test
    public void testFullTextTermName() throws Exception {
        Tree c = root.getTree("/").addChild("content");
        c.addChild("testFullTextTermNameSimple");
        c.addChild("testFullTextTermNameFile.txt");
        assertQuery("//*[jcr:contains(., 'testFullTextTermNameSimple')]",
                "xpath",
                ImmutableList.of("/content/testFullTextTermNameSimple"));
        assertQuery("//*[jcr:contains(., 'testFullTextTermNameFile.txt')]",
View Full Code Here

    @Test
    public void testFullTextTermName() throws Exception {
        Tree c = root.getTree("/").addChild("content");
        c.addChild("testFullTextTermNameSimple");
        c.addChild("testFullTextTermNameFile.txt");
        assertQuery("//*[jcr:contains(., 'testFullTextTermNameSimple')]",
                "xpath",
                ImmutableList.of("/content/testFullTextTermNameSimple"));
        assertQuery("//*[jcr:contains(., 'testFullTextTermNameFile.txt')]",
                "xpath",
View Full Code Here

    }

    @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.EXISTING, tree.getChild("one").getStatus());
        assertEquals(Tree.Status.MODIFIED, tree.getChild("one").getChild("two").getStatus());
View Full Code Here

        Tree large = tree.addChild("large");
        for (int c = 0; c < 10000; c++) {
            String name = "n" + c;
            added.add(name);
            large.addChild(name);
        }

        root.commit();

        for (Tree child : large.getChildren()) {
View Full Code Here

        Tree tree = root.getTree("/").addChild("test2");
        tree.setOrderableChildren(true);

        String[] childNames = new String[]{"a", "b", "c", "d"};
        for (String name : childNames) {
            tree.addChild(name);
        }

        int index = 0;
        for (Tree child : tree.getChildren()) {
            assertEquals(childNames[index++], child.getName());
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.