Package javax.jcr

Examples of javax.jcr.Node.orderBefore()


        assertEquals("c", iterator.nextNode().getName());
        assertEquals("a", iterator.nextNode().getName());
        assertEquals("b", iterator.nextNode().getName());
        assertFalse(iterator.hasNext());

        root.orderBefore("b", "c");
        iterator = root.getNodes();
        assertEquals("b", iterator.nextNode().getName());
        assertEquals("c", iterator.nextNode().getName());
        assertEquals("a", iterator.nextNode().getName());
        assertFalse(iterator.hasNext());
View Full Code Here


        try {
            if (!n.getPrimaryNodeType().hasOrderableChildNodes()) {
                throw new NotExecutableException("Reordering child nodes is not supported..");
            }

            n.orderBefore(Text.getName(childNPath), Text.getName(childNPath2));
            testSession.save();
            fail("test session must not be allowed to reorder nodes.");
        } catch (AccessDeniedException e) {
            // success.
        }
View Full Code Here

        }

        // grant all privileges
        givePrivileges(path, privilegesFromNames(new String[] {Privilege.JCR_ALL}), getRestrictions(superuser, path));

        n.orderBefore("rep:policy", Text.getName(childNPath2));
        testSession.save();
    }
}
View Full Code Here

        try {
            if (!n.getPrimaryNodeType().hasOrderableChildNodes()) {
                throw new NotExecutableException("Reordering child nodes is not supported..");
            }

            n.orderBefore(Text.getName(childNPath), Text.getName(childNPath2));
            testSession.save();
            fail("test session must not be allowed to reorder nodes.");
        } catch (AccessDeniedException e) {
            // success.
        }
View Full Code Here

        // give 'add_child_nodes' and 'nt-management' privilege
        // -> not sufficient privileges for a reorder
        givePrivileges(path, privilegesFromNames(new String[] {Privilege.JCR_ADD_CHILD_NODES, Privilege.JCR_NODE_TYPE_MANAGEMENT}), getRestrictions(superuser, path));
        try {
            n.orderBefore(Text.getName(childNPath), Text.getName(childNPath2));
            testSession.save();
            fail("test session must not be allowed to reorder nodes.");
        } catch (AccessDeniedException e) {
            // success.
        }
View Full Code Here

        }

        // add 'remove_child_nodes' at 'path
        // -> reorder must now succeed
        givePrivileges(path, privilegesFromName(Privilege.JCR_REMOVE_CHILD_NODES), getRestrictions(superuser, path));
        n.orderBefore(Text.getName(childNPath), Text.getName(childNPath2));
        testSession.save();
    }

    public void testRename() throws RepositoryException, NotExecutableException {
        Session testSession = getTestSession();
View Full Code Here

                .debug("ordering before. from " + n.getPath() + "/"
                        + srcChildPath + " to " + n.getPath() + "/"
                        + destChildPath);
        }

        n.orderBefore(srcChildPath, destChildPath);

        return false;
    }

    /**
 
View Full Code Here

        try {
            if (!n.getPrimaryNodeType().hasOrderableChildNodes()) {
                throw new NotExecutableException("Reordering child nodes is not supported..");
            }

            n.orderBefore(Text.getName(childNPath), Text.getName(childNPath2));
            testSession.save();
            fail("test session must not be allowed to reorder nodes.");
        } catch (AccessDeniedException e) {
            // success.
        }
View Full Code Here

        // give 'add_child_nodes' and 'nt-management' privilege
        // -> not sufficient privileges for a reorder
        givePrivileges(path, privilegesFromNames(new String[] {Privilege.JCR_ADD_CHILD_NODES, Privilege.JCR_NODE_TYPE_MANAGEMENT}), getRestrictions(superuser, path));
        try {
            n.orderBefore(Text.getName(childNPath), Text.getName(childNPath2));
            testSession.save();
            fail("test session must not be allowed to reorder nodes.");
        } catch (AccessDeniedException e) {
            // success.
        }
View Full Code Here

        // add 'remove_child_nodes' at 'path
        // -> not sufficient for a reorder since 'remove_node' privilege is missing
        //    on the target
        givePrivileges(path, privilegesFromName(Privilege.JCR_REMOVE_CHILD_NODES), getRestrictions(superuser, path));
        try {
            n.orderBefore(Text.getName(childNPath), Text.getName(childNPath2));
            testSession.save();
            fail("test session must not be allowed to reorder nodes.");
        } catch (AccessDeniedException e) {
            // success.
        }
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.