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;
}
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);
}
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);
}
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();
}
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());
}
Aggregations