Package javax.jcr

Examples of javax.jcr.Session.move()


            // assert: child node locked
            assertTrue("Child node locked", childNode.isLocked());

            // move child node up
            String newPath = testRootNode.getPath() + "/" + childNode.getName();
            session.move(childNode.getPath(), newPath);

            // assert: child node locked, before save
            assertTrue("Child node locked before save", childNode.isLocked());
            session.save();
View Full Code Here


        // give 'add_child_nodes' and 'nt-management' privilege
        // -> not sufficient privileges for a move
        givePrivileges(path, privilegesFromNames(new String[] {Privilege.JCR_ADD_CHILD_NODES, Privilege.JCR_NODE_TYPE_MANAGEMENT}), getRestrictions(superuser, path));
        try {
            testSession.move(childNPath, destPath);
            testSession.save();
            fail("Move requires add and remove permission.");
        } catch (AccessDeniedException e) {
            // success.
        }
View Full Code Here

        // add 'remove_child_nodes' at 'path
        // -> not sufficient for a move since 'remove_node' privilege is missing
        //    on the move-target
        givePrivileges(path, privilegesFromName(Privilege.JCR_REMOVE_CHILD_NODES), getRestrictions(superuser, path));
        try {
            testSession.move(childNPath, destPath);
            testSession.save();
            fail("Move requires add and remove permission.");
        } catch (AccessDeniedException e) {
            // success.
        }
View Full Code Here

        }

        // allow 'remove_node' at childNPath
        // -> now move must succeed
        givePrivileges(childNPath, privilegesFromName(Privilege.JCR_REMOVE_NODE), getRestrictions(superuser, childNPath));
        testSession.move(childNPath, destPath);
        testSession.save();

        // withdraw  'add_child_nodes' privilege on former src-parent
        // -> moving child-node back must fail
        withdrawPrivileges(path, privilegesFromName(Privilege.JCR_ADD_CHILD_NODES), getRestrictions(superuser, path));
View Full Code Here

        // withdraw  'add_child_nodes' privilege on former src-parent
        // -> moving child-node back must fail
        withdrawPrivileges(path, privilegesFromName(Privilege.JCR_ADD_CHILD_NODES), getRestrictions(superuser, path));
        try {
            testSession.move(destPath, childNPath);
            testSession.save();
            fail("Move requires add and remove permission.");
        } catch (AccessDeniedException e) {
            // success.
        }
View Full Code Here

        String srcPath = childNode.getPath();
        String destPath = parentPath + "/"+ nodeName3;

        checkReadOnly(parentPath);
        try {
            s.move(srcPath, destPath);
            s.save();
            fail("Missing write privilege.");
        } catch (AccessDeniedException e) {
            // success
        }
View Full Code Here

        }

        // with simple write privilege moving a node is not allowed.
        modifyPrivileges(parentPath, Privilege.JCR_WRITE, true);
        try {
            s.move(srcPath, destPath);
            s.save();
            fail("Missing privilege jcr:nodeTypeManagement.");
        } catch (AccessDeniedException e) {
            // success
        }
View Full Code Here

            // success
        }

        // adding jcr:nodeTypeManagement privilege will grant permission to move.
        modifyPrivileges(parentPath, PrivilegeRegistry.REP_WRITE, true);
        s.move(srcPath, destPath);
        s.save();
    }
      
    public void testSessionImportXML() throws RepositoryException, NotExecutableException, IOException {
        Session s = getTestSession();
View Full Code Here

    public void beforeScanning(Node n) throws RepositoryException {
        if (n != null && n.getPath().equals("/testroot/node2")) {
            Session session = n.getSession();
            list(session.getRootNode());
            session.move("/testroot/node2/nodeWithBlob", "/testroot/node1/nodeWithBlob");
            session.save();
            LOG.debug("moved /testroot/node2/nodeWithBlob to /testroot/node1");
        }
    }
View Full Code Here

            // rename file or folder if necessary
            Session session = getNode().getSession();
            Node newNode;
            if (rename) {
                String destPath = PathManager.createCmisPath(node.getParent().getPath(), newName);
                session.move(node.getPath(), destPath);
                newNode = session.getNode(destPath);
            }
            else {
                newNode = node;
            }
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.