Search in sources :

Example 6 with RetentionPolicy

use of javax.jcr.retention.RetentionPolicy in project jackrabbit by apache.

the class RetentionRegistryImpl method hasEffectiveRetention.

/**
     * @see RetentionRegistry#hasEffectiveRetention(org.apache.jackrabbit.spi.Path,boolean)
     */
public boolean hasEffectiveRetention(Path nodePath, boolean checkParent) throws RepositoryException {
    if (!initialized) {
        throw new IllegalStateException("Not initialized.");
    }
    if (retentionCnt <= 0) {
        return false;
    }
    RetentionPolicy rp = null;
    PathMap.Element<RetentionPolicyImpl> element = retentionMap.map(nodePath, true);
    if (element != null) {
        rp = element.get();
    }
    if (rp == null && checkParent && (!nodePath.denotesRoot())) {
        element = retentionMap.map(nodePath.getAncestor(1), true);
        if (element != null) {
            rp = element.get();
        }
    }
    return rp != null;
}
Also used : PathMap(org.apache.jackrabbit.spi.commons.name.PathMap) RetentionPolicy(javax.jcr.retention.RetentionPolicy)

Example 7 with RetentionPolicy

use of javax.jcr.retention.RetentionPolicy in project jackrabbit-oak by apache.

the class TestContentLoader method addRetentionTestData.

/**
     * Creates a node with a RetentionPolicy
     */
private void addRetentionTestData(Node node) throws RepositoryException {
    RetentionPolicy rp = createRetentionPolicy("testRetentionPolicy", node.getSession());
    node.getSession().getRetentionManager().setRetentionPolicy(node.getPath(), rp);
}
Also used : RetentionPolicy(javax.jcr.retention.RetentionPolicy)

Example 8 with RetentionPolicy

use of javax.jcr.retention.RetentionPolicy in project jackrabbit by apache.

the class RetentionPolicyTest method testGetRetentionPolicy.

public void testGetRetentionPolicy() throws RepositoryException, NotExecutableException {
    retentionMgr.setRetentionPolicy(testNodePath, getApplicableRetentionPolicy());
    RetentionPolicy policy = retentionMgr.getRetentionPolicy(testNodePath);
    assertNotNull("RetentionManager.getRetentionPolicy must return the policy set before.", policy);
}
Also used : RetentionPolicy(javax.jcr.retention.RetentionPolicy)

Example 9 with RetentionPolicy

use of javax.jcr.retention.RetentionPolicy in project jackrabbit by apache.

the class RetentionPolicyEffectTest method tearDown.

protected void tearDown() throws Exception {
    if (otherS != null) {
        otherS.logout();
    }
    superuser.refresh(false);
    RetentionPolicy rp = retentionMgr.getRetentionPolicy(testNodePath);
    if (rp != null) {
        retentionMgr.removeRetentionPolicy(testNodePath);
        superuser.save();
    }
    super.tearDown();
}
Also used : RetentionPolicy(javax.jcr.retention.RetentionPolicy)

Example 10 with RetentionPolicy

use of javax.jcr.retention.RetentionPolicy in project jackrabbit by apache.

the class RetentionPolicyTest method testRetentionPolicyGetName.

public void testRetentionPolicyGetName() throws RepositoryException, NotExecutableException {
    RetentionPolicy p = getApplicableRetentionPolicy();
    retentionMgr.setRetentionPolicy(testNodePath, p);
    RetentionPolicy policy = retentionMgr.getRetentionPolicy(testNodePath);
    assertEquals("RetentionPolicy.getName() must match the name of the policy set before.", p.getName(), policy.getName());
}
Also used : RetentionPolicy(javax.jcr.retention.RetentionPolicy)

Aggregations

RetentionPolicy (javax.jcr.retention.RetentionPolicy)10 RepositoryException (javax.jcr.RepositoryException)2 NodeImpl (org.apache.jackrabbit.core.NodeImpl)1 PathMap (org.apache.jackrabbit.spi.commons.name.PathMap)1