Package javax.jcr.retention

Examples of javax.jcr.retention.RetentionManager


        retentionMgr.setRetentionPolicy(childPath, getApplicableRetentionPolicy());
        testRootNode.getSession().save();

        Session otherS = getHelper().getSuperuserSession();
        try {
            RetentionManager rmgr = getRetentionManager(otherS);
            rmgr.removeRetentionPolicy(childPath);
            fail("Removing a retention policy on a locked node must throw LockException.");
        } catch (LockException e) {
            // success
        } finally {
            otherS.logout();
View Full Code Here


        String childPath = child.getPath();

        // get another session.
        Session otherS = getHelper().getSuperuserSession();
        try {
            RetentionManager rmgr = getRetentionManager(otherS);
            rmgr.setRetentionPolicy(childPath, getApplicableRetentionPolicy());
            otherS.save();

            fail("Setting a retention policy on a checked-in node must throw VersionException.");
        } catch (VersionException e) {
            // success
View Full Code Here

        superuser.save();
        child.checkin();

        Session otherS = getHelper().getSuperuserSession();
        try {
            RetentionManager rmgr = getRetentionManager(otherS);
            rmgr.removeRetentionPolicy(child.getPath());
            otherS.save();
            fail("Removing a retention policy on a checked-in node must throw VersionException.");
        } catch (VersionException e) {
            // success
        } finally {
View Full Code Here

    }

    public void testReadOnlySession() throws NotExecutableException, RepositoryException {
        javax.jcr.Session s = getHelper().getReadOnlySession();
        try {
            RetentionManager rmgr = getRetentionManager(s);
            try {
                rmgr.getHolds(testNodePath);
                fail("Read-only session doesn't have sufficient privileges to retrieve holds.");
            } catch (AccessDeniedException e) {
                // success
            }
            try {
                rmgr.addHold(testNodePath, getHoldName(), false);
                fail("Read-only session doesn't have sufficient privileges to retrieve holds.");
            } catch (AccessDeniedException e) {
                // success
            }
        } finally {
View Full Code Here

        List<Hold> holdsBefore = Arrays.asList(retentionMgr.getHolds(child.getPath()));

        // get another session.
        javax.jcr.Session otherS = getHelper().getSuperuserSession();
        try {
            RetentionManager rmgr = getRetentionManager(otherS);           
            rmgr.addHold(child.getPath(), getHoldName(), false);
            otherS.save();

            fail("Adding hold on a locked node must throw LockException.");
        } catch (LockException e) {
            // success
View Full Code Here

        Hold h = retentionMgr.addHold(child.getPath(), getHoldName(), false);
        testRootNode.getSession().save();

        javax.jcr.Session otherS = getHelper().getSuperuserSession();
        try {
            RetentionManager rmgr = getRetentionManager(otherS);
            Hold[] holds = rmgr.getHolds(child.getPath());

            if (holds.length > 0) {
                rmgr.removeHold(child.getPath(), holds[0]);
                otherS.save();
                fail("Removing a hold on a locked node must throw LockException.");
            }
        } catch (LockException e) {
            // success
View Full Code Here

        child.checkin();

        // get another session.
        javax.jcr.Session otherS = getHelper().getSuperuserSession();
        try {
            RetentionManager rmgr = getRetentionManager(otherS);
            rmgr.addHold(child.getPath(), getHoldName(), false);
            otherS.save();

            fail("Adding hold on a checked-in node must throw VersionException.");
        } catch (VersionException e) {
            // success
View Full Code Here

        // checkin on the parent node make the hold-containing node checked-in.
        vn.checkin();

        javax.jcr.Session otherS = getHelper().getSuperuserSession();
        try {
            RetentionManager rmgr = getRetentionManager(otherS);
            Hold[] holds = rmgr.getHolds(n.getPath());

            if (holds.length > 0) {
                rmgr.removeHold(n.getPath(), holds[0]);
                otherS.save();
                fail("Removing a hold on a checked-in node must throw VersionException.");
            }
        } catch (VersionException e) {
            // success
View Full Code Here

        s.refresh(false);
        Node root = s.getRootNode();
        Node testRootNode;

        if (root.hasNode(testPath)) {
            RetentionManager rm;
            try {
                rm = s.getRetentionManager();
            } catch (UnsupportedRepositoryOperationException e) {
                rm = null;
            }

            // clean test root
            testRootNode = root.getNode(testPath);
            NodeIterator children = testRootNode.getNodes();
            while (children.hasNext()) {
                Node child = children.nextNode();

                // Remove retention policy if needed
                String childPath = child.getPath();
                if (rm != null && rm.getRetentionPolicy(childPath) != null) {
                    rm.removeRetentionPolicy(childPath);
                    s.save();
                }

                NodeDefinition nodeDef = child.getDefinition();
                if (!nodeDef.isMandatory() && !nodeDef.isProtected()) {
View Full Code Here

        // do a 'rollback'
        s.refresh(false);
        Node root = s.getRootNode();
        Node testRootNode;
       
        RetentionManager rm;
        try {
            rm = s.getRetentionManager();
        } catch (UnsupportedRepositoryOperationException ex) {
            rm = null;
        }
       
        if (root.hasNode(testPath)) {
            // clean test root
            testRootNode = root.getNode(testPath);
            for (NodeIterator children = testRootNode.getNodes(); children.hasNext();) {
                Node child = children.nextNode();

                // Remove retention policy if needed
                if (rm != null) {
                    RetentionPolicy pol = rm.getRetentionPolicy(child.getPath());
                    if (pol != null) {
                        rm.removeRetentionPolicy(child.getPath());
                        s.save();
                    }
                }
               
                NodeDefinition nodeDef = child.getDefinition();
View Full Code Here

TOP

Related Classes of javax.jcr.retention.RetentionManager

Copyright © 2018 www.massapicom. 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.