Package org.apache.jackrabbit.api.jsr283.retention

Examples of org.apache.jackrabbit.api.jsr283.retention.Hold


    }

    public void testAddHold() throws RepositoryException, NotExecutableException {
        SessionImpl s = (SessionImpl) helper.getSuperuserSession();
        RetentionRegistry re = s.getRetentionRegistry();
        Hold h = null;
        try {
            h = retentionMgr.addHold(childN2.getPath(), getHoldName(), false);
            // hold must not be effective yet
            assertFalse(re.hasEffectiveHold(s.getQPath(childN2.getPath()), false));
View Full Code Here


        super.tearDown();
    }

    public void testAddHoldTwice() throws RepositoryException, NotExecutableException {
        Hold h = retentionMgr.addHold(testNodePath, getHoldName(), true);

        try {
            retentionMgr.addHold(testNodePath, getHoldName(), true);
            fail("cannot add the same hold twice");
        } catch (RepositoryException e) {
View Full Code Here

            // success
        }       
    }
   
    public void testRemoveInvalidHold() throws RepositoryException, NotExecutableException {
        final Hold h = retentionMgr.addHold(testNodePath, getHoldName(), true);

        try {
            Hold invalidH = new Hold() {
                public boolean isDeep() throws RepositoryException {
                    return h.isDeep();
                }
                public String getName() throws RepositoryException {
                    return h.getName();
View Full Code Here

            // success
        }
    }

    public void testRemoveInvalidHold2() throws RepositoryException, NotExecutableException {
        final Hold h = retentionMgr.addHold(testNodePath, getHoldName(), true);

        try {
            Hold invalidH = new Hold() {
                public boolean isDeep() throws RepositoryException {
                    return h.isDeep();
                }
                public String getName() throws RepositoryException {
                    return "anyName";
View Full Code Here

            // success
        }
    }

    public void testRemoveInvalidHold3() throws RepositoryException, NotExecutableException {
        final Hold h = retentionMgr.addHold(testNodePath, getHoldName(), true);

        try {
            Hold invalidH = new Hold() {
                public boolean isDeep() throws RepositoryException {
                    return !h.isDeep();
                }
                public String getName() throws RepositoryException {
                    return h.getName();
View Full Code Here

                // by a hold on the node itself, by a hold on the parent or
                // by a deep hold on any ancestor.
                return true;
            } else {
                for (Iterator it = holds.iterator(); it.hasNext();) {
                    Hold h = (Hold) it.next();
                    if (h.isDeep()) {
                        return true;
                    }
                }
            }
        }
View Full Code Here

        this.acRootPath = session.getJCRPath(acRootPath);
    }

    ACLTemplate getACL(Principal principal) throws RepositoryException {
        if (!session.getPrincipalManager().hasPrincipal(principal.getName())) {
            throw new AccessControlException("Unknown principal.");
        }
        String nPath = getPathToAcNode(principal);
        if (session.nodeExists(nPath)) {
            return (ACLTemplate) getPolicies(nPath)[0];
        } else {
View Full Code Here

    /**
     * @see AccessControlEditor#editAccessControlPolicies(Principal)
     */
    public AccessControlPolicy[] editAccessControlPolicies(Principal principal) throws RepositoryException {
        if (!session.getPrincipalManager().hasPrincipal(principal.getName())) {
            throw new AccessControlException("Unknown principal.");
        }
        String nPath = getPathToAcNode(principal);
        if (!session.nodeExists(nPath)) {
            createAcNode(nPath);
        }
View Full Code Here

                }
            }
        }
        // node either not access-controlled or the passed policy didn't apply
        // to the node at 'nodePath' -> throw exception.no policy was removed
        throw new AccessControlException("Policy " + policy + " does not apply to " + nodePath);
    }
View Full Code Here

     */
    private void checkProtectsNode(String nodePath) throws RepositoryException {
        if (session.nodeExists(nodePath)) {
            NodeImpl n = (NodeImpl) session.getNode(nodePath);
            if (n.isNodeType(NT_REP_ACL) || n.isNodeType(NT_REP_ACE)) {
                throw new AccessControlException("Node " + nodePath + " defines ACL or ACE.");
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.api.jsr283.retention.Hold

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.