Package javax.jcr

Examples of javax.jcr.Session.move()


    }

    public static void moveResource(Resource res, String path) throws PersistenceException {
        try{
            Session session = res.adaptTo(Node.class).getSession();
            session.move(res.getPath(), path);
        } catch(RepositoryException re) {
            throw new PersistenceException(String.valueOf(re), re);
        }
    }
View Full Code Here


        final String newPath = cleanPath(newName);

        Session session = null;
        try {
            session = this.createSession();
            session.move(oldPath, newPath);
            session.save();

            this.handleChangeEvent(oldName);
            this.handleChangeEvent(newName);
View Full Code Here

        if (session.itemExists(destPath)) {
            session.getItem(destPath).remove();
        }
       
        session.move(sourcePath, destPath);
        changes.add(Modification.onMoved(sourcePath, destPath));
        return session.getItem(destPath);
    }

}
View Full Code Here

            if (sourceItem.isNode()) {

                // node move/copy through session
                if (isMove) {
                    checkoutIfNecessary(sourceItem.getParent(), changes, versioningConfiguration);
                    session.move(source, propPath);
                } else {
                    Node sourceNode = (Node) sourceItem;
                    Node destParent = (Node) session.getItem(property.getParentPath());
                    checkoutIfNecessary(destParent, changes, versioningConfiguration);
                    CopyOperation.copy(sourceNode, destParent,
View Full Code Here

        ExpectationListener listener = new ExpectationListener();
        observationManager.addEventListener(listener, NODE_MOVED, "/", true, null, null, false);

        String src1 = nodeA.getPath();
        String dst1 = nodeT.getPath() + "/b";
        session.move(src1, dst1);
        listener.expectMove(src1, dst1);

        String src2 = nodeT.getPath() + "/b/aa";
        String dst2 = nodeS.getPath() + "/bb";
        session.move(src2, dst2);
View Full Code Here

        session.move(src1, dst1);
        listener.expectMove(src1, dst1);

        String src2 = nodeT.getPath() + "/b/aa";
        String dst2 = nodeS.getPath() + "/bb";
        session.move(src2, dst2);
        listener.expectMove(src1 + "/aa", dst2);

        session.save();

        List<Expectation> missing = listener.getMissing(2, TimeUnit.SECONDS);
View Full Code Here

        node.addNode("target");
        session.save();

        session.refresh(true);
        Node sourceNode = session.getNode("/source/node");
        session.move("/source/node", "/target/moved");
        // assertEquals("/target/moved", sourceNode.getPath());  // passes on JR2, fails on Oak
        try {
            sourceNode.getPath();
        }
        catch (InvalidItemStateException expected) {
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

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.