RM-2130 (Check classification after method execution, filtering results where appropriate)

+review RM-94

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/DEV/ENFORCE@107164 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2015-06-25 22:45:52 +00:00
parent 1ded55a6d8
commit 03e696e524
2 changed files with 75 additions and 7 deletions

View File

@@ -1,12 +1,12 @@
<?xml version='1.0' encoding='UTF-8'?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd ">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd ">
<!-- Classified content model bootstrap -->
@@ -60,13 +60,17 @@
<bean id="classificationMethodInterceptorPostProcessor"
class="org.alfresco.module.org_alfresco_module_rm.classification.interceptor.ClassificationMethodInterceptorPostProcessor" />
<bean id="basePostMethodInvocationProcessorCache" class="org.alfresco.repo.cache.DefaultSimpleCache" />
<bean id="basePostMethodInvocationProcessor"
abstract="true"
init-method="register">
<property name="nodeService" ref="NodeService" />
<property name="dictionaryService" ref="DictionaryService" />
<property name="contentClassificationService" ref="ContentClassificationService" />
<property name="securityClearanceService" ref="SecurityClearanceService" />
<property name="postMethodInvocationProcessor" ref="postMethodInvocationProcessor" />
<property name="cache" ref="basePostMethodInvocationProcessorCache" />
</bean>
<bean id="abstractPostMethodInvocationProcessor"

View File

@@ -23,9 +23,12 @@ import static org.alfresco.model.ContentModel.TYPE_CONTENT;
import java.util.Collection;
import org.alfresco.module.org_alfresco_module_rm.classification.ContentClassificationService;
import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearanceService;
import org.alfresco.repo.cache.SimpleCache;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.util.Pair;
/**
* Base class for post method invocation processors
@@ -44,9 +47,15 @@ public abstract class BasePostMethodInvocationProcessor
/** Content classification service */
private ContentClassificationService contentClassificationService;
/** Security Clearance Service */
private SecurityClearanceService securityClearanceService;
/** Post method invocation processor */
private PostMethodInvocationProcessor postMethodInvocationProcessor;
/** Cache to hold the filtered node information */
private SimpleCache<Pair<String, NodeRef>, Pair<Boolean, NodeRef>> cache;
/**
* @return the nodeService
*/
@@ -71,6 +80,14 @@ public abstract class BasePostMethodInvocationProcessor
return this.contentClassificationService;
}
/**
* @return the securityClearanceService
*/
protected SecurityClearanceService getSecurityClearanceService()
{
return this.securityClearanceService;
}
/**
* @return the postMethodInvocationProcessor
*/
@@ -79,6 +96,14 @@ public abstract class BasePostMethodInvocationProcessor
return this.postMethodInvocationProcessor;
}
/**
* @return the cache
*/
protected SimpleCache<Pair<String, NodeRef>, Pair<Boolean, NodeRef>> getCache()
{
return this.cache;
}
/**
* @param nodeService the nodeService to set
*/
@@ -103,6 +128,14 @@ public abstract class BasePostMethodInvocationProcessor
this.contentClassificationService = contentClassificationService;
}
/**
* @param securityClearanceService the securityClearanceService to set
*/
public void setSecurityClearanceService(SecurityClearanceService securityClearanceService)
{
this.securityClearanceService = securityClearanceService;
}
/**
* @param postMethodInvocationProcessor the postMethodInvocationProcessor to set
*/
@@ -111,6 +144,14 @@ public abstract class BasePostMethodInvocationProcessor
this.postMethodInvocationProcessor = postMethodInvocationProcessor;
}
/**
* @param cache the cache to set
*/
public void setCache(SimpleCache<Pair<String, NodeRef>, Pair<Boolean, NodeRef>> cache)
{
this.cache = cache;
}
/**
* Gets the class name
*
@@ -164,6 +205,29 @@ public abstract class BasePostMethodInvocationProcessor
filter = null;
}
// if (filter != null)
// {
// String uniqueCacheKey = getFullyAuthenticatedUser() /*+ userClearance?*/;
//
// Pair<String, NodeRef> cacheKey = new Pair<String, NodeRef>(uniqueCacheKey, filter);
// Pair<Boolean, NodeRef> cacheValue = getCache().get(cacheKey);
//
// if (cacheValue == null || !cacheValue.getFirst().booleanValue())
// {
// if (getNodeService().exists(nodeRef) &&
// getDictionaryService().isSubClass(getNodeService().getType(nodeRef), TYPE_CONTENT) &&
// !getContentClassificationService().hasClearance(nodeRef))
// {
// filter = null;
// }
// getCache().put(new Pair<String, NodeRef>(uniqueCacheKey, nodeRef), new Pair<Boolean, NodeRef>(true, filter));
// }
// else
// {
// filter = getCache().get(cacheKey).getSecond();
// }
// }
return filter;
}
}