mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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@106356 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -42,6 +42,9 @@
|
|||||||
<bean id="classificationMethodInterceptorPostProcessor"
|
<bean id="classificationMethodInterceptorPostProcessor"
|
||||||
class="org.alfresco.module.org_alfresco_module_rm.classification.interceptor.ClassificationMethodInterceptorPostProcessor" />
|
class="org.alfresco.module.org_alfresco_module_rm.classification.interceptor.ClassificationMethodInterceptorPostProcessor" />
|
||||||
|
|
||||||
|
<bean id="postMethodInvocationProcessorRegistry"
|
||||||
|
class="org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.PostMethodInvocationProcessorRegistry" />
|
||||||
|
|
||||||
<bean id="basePostMethodInvocationProcessor"
|
<bean id="basePostMethodInvocationProcessor"
|
||||||
abstract="true"
|
abstract="true"
|
||||||
init-method="register">
|
init-method="register">
|
||||||
@@ -49,25 +52,32 @@
|
|||||||
<property name="nodeService" ref="NodeService" />
|
<property name="nodeService" ref="NodeService" />
|
||||||
<property name="dictionaryService" ref="DictionaryService" />
|
<property name="dictionaryService" ref="DictionaryService" />
|
||||||
<property name="contentClassificationService" ref="ContentClassificationService" />
|
<property name="contentClassificationService" ref="ContentClassificationService" />
|
||||||
|
<property name="postMethodInvocationProcessorRegistry" ref="postMethodInvocationProcessorRegistry" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="abstractPostMethodInvocationProcessor"
|
||||||
|
abstract="true"
|
||||||
|
parent="basePostMethodInvocationProcessor"
|
||||||
|
class="org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.AbstractPostMethodInvocationProcessor">
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="nodeRefPostMethodInvocationProcessor"
|
<bean id="nodeRefPostMethodInvocationProcessor"
|
||||||
parent="basePostMethodInvocationProcessor"
|
parent="abstractPostMethodInvocationProcessor"
|
||||||
class="org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.NodeRefPostMethodInvocationProcessor">
|
class="org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.NodeRefPostMethodInvocationProcessor">
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="storeRefPostMethodInvocationProcessor"
|
<bean id="storeRefPostMethodInvocationProcessor"
|
||||||
parent="basePostMethodInvocationProcessor"
|
parent="abstractPostMethodInvocationProcessor"
|
||||||
class="org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.StoreRefPostMethodInvocationProcessor">
|
class="org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.StoreRefPostMethodInvocationProcessor">
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="childAssociationRefPostMethodInvocationProcessor"
|
<bean id="childAssociationRefPostMethodInvocationProcessor"
|
||||||
parent="basePostMethodInvocationProcessor"
|
parent="abstractPostMethodInvocationProcessor"
|
||||||
class="org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.ChildAssociationRefPostMethodInvocationProcessor">
|
class="org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.ChildAssociationRefPostMethodInvocationProcessor">
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="associationRefPostMethodInvocationProcessor"
|
<bean id="associationRefPostMethodInvocationProcessor"
|
||||||
parent="basePostMethodInvocationProcessor"
|
parent="abstractPostMethodInvocationProcessor"
|
||||||
class="org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.AssociationRefPostMethodInvocationProcessor">
|
class="org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.AssociationRefPostMethodInvocationProcessor">
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
@@ -75,9 +85,6 @@
|
|||||||
abstract="true"
|
abstract="true"
|
||||||
parent="basePostMethodInvocationProcessor"
|
parent="basePostMethodInvocationProcessor"
|
||||||
class="org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.CollectionPostMethodInvocationProcessor">
|
class="org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.CollectionPostMethodInvocationProcessor">
|
||||||
<property name="nodeRefPostMethodInvocationProcessor" ref="nodeRefPostMethodInvocationProcessor" />
|
|
||||||
<property name="childAssociationRefPostMethodInvocationProcessor" ref="childAssociationRefPostMethodInvocationProcessor" />
|
|
||||||
<property name="associationRefPostMethodInvocationProcessor" ref="associationRefPostMethodInvocationProcessor" />
|
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- FIXME: Causes issues for the integration tests -->
|
<!-- FIXME: Causes issues for the integration tests -->
|
||||||
|
@@ -22,13 +22,12 @@ import static org.alfresco.model.ContentModel.TYPE_CONTENT;
|
|||||||
import static org.codehaus.plexus.util.StringUtils.isNotBlank;
|
import static org.codehaus.plexus.util.StringUtils.isNotBlank;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.alfresco.jlan.server.filesys.AccessDeniedException;
|
import org.alfresco.jlan.server.filesys.AccessDeniedException;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceBootstrap;
|
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceBootstrap;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.classification.ContentClassificationService;
|
import org.alfresco.module.org_alfresco_module_rm.classification.ContentClassificationService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor;
|
import org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.PostMethodInvocationProcessorRegistry;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.util.AlfrescoTransactionSupport;
|
import org.alfresco.module.org_alfresco_module_rm.util.AlfrescoTransactionSupport;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||||
@@ -56,9 +55,6 @@ public class ClassificationMethodInterceptor implements MethodInterceptor, Appli
|
|||||||
/** Logger */
|
/** Logger */
|
||||||
private static Logger LOG = Logger.getLogger(ClassificationMethodInterceptor.class);
|
private static Logger LOG = Logger.getLogger(ClassificationMethodInterceptor.class);
|
||||||
|
|
||||||
/** Post method invocation processors */
|
|
||||||
private Map<Class<?>, BasePostMethodInvocationProcessor> processors = new HashMap<Class<?>, BasePostMethodInvocationProcessor>();
|
|
||||||
|
|
||||||
private static final String KEY_PROCESSING = GUID.generate();
|
private static final String KEY_PROCESSING = GUID.generate();
|
||||||
|
|
||||||
/** application context */
|
/** application context */
|
||||||
@@ -112,14 +108,9 @@ public class ClassificationMethodInterceptor implements MethodInterceptor, Appli
|
|||||||
return (DictionaryService)applicationContext.getBean("dictionaryService");
|
return (DictionaryService)applicationContext.getBean("dictionaryService");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected PostMethodInvocationProcessorRegistry getPostMethodInvocationProcessorRegistry()
|
||||||
* Registers the post method invocation processors
|
|
||||||
*
|
|
||||||
* @param object The object to register
|
|
||||||
*/
|
|
||||||
public void register(BasePostMethodInvocationProcessor object)
|
|
||||||
{
|
{
|
||||||
processors.put(object.getClassName(), object);
|
return (PostMethodInvocationProcessorRegistry)applicationContext.getBean("postMethodInvocationProcessorRegistry");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -238,7 +229,7 @@ public class ClassificationMethodInterceptor implements MethodInterceptor, Appli
|
|||||||
if (isUserValid && postInvocation != null)
|
if (isUserValid && postInvocation != null)
|
||||||
{
|
{
|
||||||
Class<? extends Object> clazz = postInvocation.getClass();
|
Class<? extends Object> clazz = postInvocation.getClass();
|
||||||
BasePostMethodInvocationProcessor processor = getProcessor(processors, clazz);
|
BasePostMethodInvocationProcessor processor = getPostMethodInvocationProcessorRegistry().getProcessor(clazz);
|
||||||
|
|
||||||
if (processor != null)
|
if (processor != null)
|
||||||
{
|
{
|
||||||
@@ -252,27 +243,4 @@ public class ClassificationMethodInterceptor implements MethodInterceptor, Appli
|
|||||||
|
|
||||||
return postInvocation;
|
return postInvocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the processor from the available processors
|
|
||||||
*
|
|
||||||
* @param processors Available processors
|
|
||||||
* @param clazz The runtime class of the post invocation object
|
|
||||||
* @return The suitable processor for the given class
|
|
||||||
*/
|
|
||||||
private BasePostMethodInvocationProcessor getProcessor(Map<Class<?>, BasePostMethodInvocationProcessor> processors, Class<? extends Object> clazz)
|
|
||||||
{
|
|
||||||
BasePostMethodInvocationProcessor result = null;
|
|
||||||
|
|
||||||
for (Map.Entry<Class<?>, BasePostMethodInvocationProcessor> processor : processors.entrySet())
|
|
||||||
{
|
|
||||||
if (processor.getKey().isAssignableFrom(clazz))
|
|
||||||
{
|
|
||||||
result = processor.getValue();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor;
|
||||||
|
|
||||||
|
import static org.alfresco.util.ParameterCheck.mandatory;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract Post Method Invocation Processor
|
||||||
|
*
|
||||||
|
* @author Tuna Aksoy
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public abstract class AbstractPostMethodInvocationProcessor extends BasePostMethodInvocationProcessor
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Abstract method to process a single element
|
||||||
|
*
|
||||||
|
* @param object The element to process
|
||||||
|
* @return Processed element
|
||||||
|
*/
|
||||||
|
protected abstract <T> T processSingleElement(T object);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract method to process a collection
|
||||||
|
*
|
||||||
|
* @param collection The collection to process
|
||||||
|
* @return Processed collection
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
protected abstract Collection processCollection(Collection collection);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#process(java.lang.Object)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
|
@Override
|
||||||
|
public <T> T process(T object)
|
||||||
|
{
|
||||||
|
mandatory("object", object);
|
||||||
|
|
||||||
|
T result = null;
|
||||||
|
|
||||||
|
if (isCollection(object))
|
||||||
|
{
|
||||||
|
Collection collection = ((Collection) object);
|
||||||
|
if (!collection.isEmpty())
|
||||||
|
{
|
||||||
|
checkObjectClass(collection.iterator().next());
|
||||||
|
result = (T) processCollection(collection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
checkObjectClass(object);
|
||||||
|
result = (T) processSingleElement(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@@ -18,10 +18,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor;
|
package org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor;
|
||||||
|
|
||||||
import static org.alfresco.util.ParameterCheck.mandatory;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.util.collections.CollectionUtils;
|
||||||
|
import org.alfresco.util.collections.Filter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AssociationRef Post Method Invocation Processor
|
* AssociationRef Post Method Invocation Processor
|
||||||
@@ -29,27 +31,24 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
* @author Tuna Aksoy
|
* @author Tuna Aksoy
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class AssociationRefPostMethodInvocationProcessor extends BasePostMethodInvocationProcessor
|
public class AssociationRefPostMethodInvocationProcessor extends AbstractPostMethodInvocationProcessor
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#getClassName()
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#getClassName()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Class<AssociationRef> getClassName()
|
protected Class<AssociationRef> getClassName()
|
||||||
{
|
{
|
||||||
return AssociationRef.class;
|
return AssociationRef.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#process(java.lang.Object)
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.AbstractPostMethodInvocationProcessor#processSingleElement(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public <T> T process(T object)
|
protected <T> T processSingleElement(T object)
|
||||||
{
|
{
|
||||||
mandatory("object", object);
|
AssociationRef associationRef = (AssociationRef) object;
|
||||||
checkObjectClass(object);
|
|
||||||
|
|
||||||
AssociationRef associationRef = ((AssociationRef) object);
|
|
||||||
|
|
||||||
NodeRef sourceRef = associationRef.getSourceRef();
|
NodeRef sourceRef = associationRef.getSourceRef();
|
||||||
NodeRef filteredSource = filter(sourceRef);
|
NodeRef filteredSource = filter(sourceRef);
|
||||||
@@ -59,4 +58,21 @@ public class AssociationRefPostMethodInvocationProcessor extends BasePostMethodI
|
|||||||
|
|
||||||
return (filteredSource == null || filteredTarget == null) ? null : object;
|
return (filteredSource == null || filteredTarget == null) ? null : object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.AbstractPostMethodInvocationProcessor#processCollection(java.util.Collection)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
|
@Override
|
||||||
|
protected Collection processCollection(Collection collection)
|
||||||
|
{
|
||||||
|
return CollectionUtils.filter(collection, new Filter<AssociationRef>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Boolean apply(AssociationRef associationRef)
|
||||||
|
{
|
||||||
|
return processSingleElement(associationRef) != null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,6 +20,8 @@ package org.alfresco.module.org_alfresco_module_rm.classification.interceptor.pr
|
|||||||
|
|
||||||
import static org.alfresco.model.ContentModel.TYPE_CONTENT;
|
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.ContentClassificationService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.classification.interceptor.ClassificationMethodInterceptor;
|
import org.alfresco.module.org_alfresco_module_rm.classification.interceptor.ClassificationMethodInterceptor;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.ClassificationPostMethodInvocationException.NotSupportedClassTypeException;
|
import org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.ClassificationPostMethodInvocationException.NotSupportedClassTypeException;
|
||||||
@@ -47,6 +49,9 @@ public abstract class BasePostMethodInvocationProcessor
|
|||||||
/** Content classification service */
|
/** Content classification service */
|
||||||
private ContentClassificationService contentClassificationService;
|
private ContentClassificationService contentClassificationService;
|
||||||
|
|
||||||
|
/** Post method invocation processor registry */
|
||||||
|
private PostMethodInvocationProcessorRegistry postMethodInvocationProcessorRegistry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the classificationMethodInterceptor
|
* @return the classificationMethodInterceptor
|
||||||
*/
|
*/
|
||||||
@@ -79,6 +84,14 @@ public abstract class BasePostMethodInvocationProcessor
|
|||||||
return this.contentClassificationService;
|
return this.contentClassificationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the postMethodInvocationProcessorRegistry
|
||||||
|
*/
|
||||||
|
protected PostMethodInvocationProcessorRegistry getPostMethodInvocationProcessorRegistry()
|
||||||
|
{
|
||||||
|
return this.postMethodInvocationProcessorRegistry;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param classificationMethodInterceptor the classificationMethodInterceptor to set
|
* @param classificationMethodInterceptor the classificationMethodInterceptor to set
|
||||||
*/
|
*/
|
||||||
@@ -111,12 +124,20 @@ public abstract class BasePostMethodInvocationProcessor
|
|||||||
this.contentClassificationService = contentClassificationService;
|
this.contentClassificationService = contentClassificationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param postMethodInvocationProcessorRegistry the postMethodInvocationProcessorRegistry to set
|
||||||
|
*/
|
||||||
|
public void setPostMethodInvocationProcessorRegistry(PostMethodInvocationProcessorRegistry postMethodInvocationProcessorRegistry)
|
||||||
|
{
|
||||||
|
this.postMethodInvocationProcessorRegistry = postMethodInvocationProcessorRegistry;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the class name
|
* Gets the class name
|
||||||
*
|
*
|
||||||
* @return The class name
|
* @return The class name
|
||||||
*/
|
*/
|
||||||
public abstract Class<?> getClassName();
|
protected abstract Class<?> getClassName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs checks on the given object and throws exception if not all checks pass
|
* Performs checks on the given object and throws exception if not all checks pass
|
||||||
@@ -131,7 +152,7 @@ public abstract class BasePostMethodInvocationProcessor
|
|||||||
*/
|
*/
|
||||||
public void register()
|
public void register()
|
||||||
{
|
{
|
||||||
getClassificationMethodInterceptor().register(this);
|
getPostMethodInvocationProcessorRegistry().register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -147,6 +168,17 @@ public abstract class BasePostMethodInvocationProcessor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the given object is a collection
|
||||||
|
*
|
||||||
|
* @param object Object to check
|
||||||
|
* @return <code>true</code> if the code is a collection, <code>false</code> otherwise
|
||||||
|
*/
|
||||||
|
protected <T> boolean isCollection(T object)
|
||||||
|
{
|
||||||
|
return Collection.class.isAssignableFrom(object.getClass());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the node if the give node reference exist and it is a
|
* Filters the node if the give node reference exist and it is a
|
||||||
* content but the logged in user is not cleared to see the it.
|
* content but the logged in user is not cleared to see the it.
|
||||||
|
@@ -18,10 +18,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor;
|
package org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor;
|
||||||
|
|
||||||
import static org.alfresco.util.ParameterCheck.mandatory;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.util.collections.CollectionUtils;
|
||||||
|
import org.alfresco.util.collections.Filter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ChildAssociationRef Post Method Invocation Processor
|
* ChildAssociationRef Post Method Invocation Processor
|
||||||
@@ -29,26 +31,23 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
* @author Tuna Aksoy
|
* @author Tuna Aksoy
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class ChildAssociationRefPostMethodInvocationProcessor extends BasePostMethodInvocationProcessor
|
public class ChildAssociationRefPostMethodInvocationProcessor extends AbstractPostMethodInvocationProcessor
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#getClassName()
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#getClassName()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Class<ChildAssociationRef> getClassName()
|
protected Class<ChildAssociationRef> getClassName()
|
||||||
{
|
{
|
||||||
return ChildAssociationRef.class;
|
return ChildAssociationRef.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#process(java.lang.Object)
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.AbstractPostMethodInvocationProcessor#processSingleElement(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public <T> T process(T object)
|
protected <T> T processSingleElement(T object)
|
||||||
{
|
{
|
||||||
mandatory("object", object);
|
|
||||||
checkObjectClass(object);
|
|
||||||
|
|
||||||
ChildAssociationRef childAssociationRef = ((ChildAssociationRef) object);
|
ChildAssociationRef childAssociationRef = ((ChildAssociationRef) object);
|
||||||
|
|
||||||
NodeRef childRef = childAssociationRef.getChildRef();
|
NodeRef childRef = childAssociationRef.getChildRef();
|
||||||
@@ -59,4 +58,21 @@ public class ChildAssociationRefPostMethodInvocationProcessor extends BasePostMe
|
|||||||
|
|
||||||
return (filteredChildRef == null || filteredParentRef == null) ? null : object;
|
return (filteredChildRef == null || filteredParentRef == null) ? null : object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.AbstractPostMethodInvocationProcessor#processCollection(java.util.Collection)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
|
@Override
|
||||||
|
protected Collection processCollection(Collection collection)
|
||||||
|
{
|
||||||
|
return CollectionUtils.filter(collection, new Filter<ChildAssociationRef>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Boolean apply(ChildAssociationRef childAssociationRef)
|
||||||
|
{
|
||||||
|
return process(childAssociationRef) != null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,12 +23,6 @@ import static org.alfresco.util.ParameterCheck.mandatory;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
|
||||||
import org.alfresco.util.collections.CollectionUtils;
|
|
||||||
import org.alfresco.util.collections.Filter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collection Post Method Invocation Processor
|
* Collection Post Method Invocation Processor
|
||||||
*
|
*
|
||||||
@@ -37,63 +31,6 @@ import org.alfresco.util.collections.Filter;
|
|||||||
*/
|
*/
|
||||||
public abstract class CollectionPostMethodInvocationProcessor extends BasePostMethodInvocationProcessor
|
public abstract class CollectionPostMethodInvocationProcessor extends BasePostMethodInvocationProcessor
|
||||||
{
|
{
|
||||||
/** Node ref post method invocation processor */
|
|
||||||
private NodeRefPostMethodInvocationProcessor nodeRefPostMethodInvocationProcessor;
|
|
||||||
|
|
||||||
/** Association post method invocation processor */
|
|
||||||
private AssociationRefPostMethodInvocationProcessor associationRefPostMethodInvocationProcessor;
|
|
||||||
|
|
||||||
/** Child association post method invocation processor */
|
|
||||||
private ChildAssociationRefPostMethodInvocationProcessor childAssociationRefPostMethodInvocationProcessor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the nodeRefPostMethodInvocationProcessor
|
|
||||||
*/
|
|
||||||
protected NodeRefPostMethodInvocationProcessor getNodeRefPostMethodInvocationProcessor()
|
|
||||||
{
|
|
||||||
return this.nodeRefPostMethodInvocationProcessor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the associationRefPostMethodInvocationProcessor
|
|
||||||
*/
|
|
||||||
protected AssociationRefPostMethodInvocationProcessor getAssociationRefPostMethodInvocationProcessor()
|
|
||||||
{
|
|
||||||
return this.associationRefPostMethodInvocationProcessor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the childAssociationRefPostMethodInvocationProcessor
|
|
||||||
*/
|
|
||||||
protected ChildAssociationRefPostMethodInvocationProcessor getChildAssociationRefPostMethodInvocationProcessor()
|
|
||||||
{
|
|
||||||
return this.childAssociationRefPostMethodInvocationProcessor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param nodeRefPostMethodInvocationProcessor the nodeRefPostMethodInvocationProcessor to set
|
|
||||||
*/
|
|
||||||
public void setNodeRefPostMethodInvocationProcessor(NodeRefPostMethodInvocationProcessor nodeRefPostMethodInvocationProcessor)
|
|
||||||
{
|
|
||||||
this.nodeRefPostMethodInvocationProcessor = nodeRefPostMethodInvocationProcessor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param associationRefPostMethodInvocationProcessor the associationRefPostMethodInvocationProcessor to set
|
|
||||||
*/
|
|
||||||
public void setAssociationRefPostMethodInvocationProcessor(AssociationRefPostMethodInvocationProcessor associationRefPostMethodInvocationProcessor)
|
|
||||||
{
|
|
||||||
this.associationRefPostMethodInvocationProcessor = associationRefPostMethodInvocationProcessor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param childAssociationRefPostMethodInvocationProcessor the childAssociationRefPostMethodInvocationProcessor to set
|
|
||||||
*/
|
|
||||||
public void setChildAssociationRefPostMethodInvocationProcessor(ChildAssociationRefPostMethodInvocationProcessor childAssociationRefPostMethodInvocationProcessor)
|
|
||||||
{
|
|
||||||
this.childAssociationRefPostMethodInvocationProcessor = childAssociationRefPostMethodInvocationProcessor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#process(java.lang.Object)
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#process(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
@@ -102,91 +39,24 @@ public abstract class CollectionPostMethodInvocationProcessor extends BasePostMe
|
|||||||
public <T> T process(T object)
|
public <T> T process(T object)
|
||||||
{
|
{
|
||||||
mandatory("object", object);
|
mandatory("object", object);
|
||||||
checkObjectClass(object);
|
|
||||||
|
|
||||||
Object result = object;
|
Object result = object;
|
||||||
|
|
||||||
Collection collection = ((Collection) object);
|
Collection collection = ((Collection) object);
|
||||||
|
|
||||||
if (!collection.isEmpty())
|
if (!collection.isEmpty())
|
||||||
{
|
{
|
||||||
Iterator iterator = collection.iterator();
|
Iterator iterator = collection.iterator();
|
||||||
if (iterator.hasNext())
|
if (iterator.hasNext())
|
||||||
{
|
{
|
||||||
Class<? extends Object> clazz = iterator.next().getClass();
|
Class<? extends Object> clazz = iterator.next().getClass();
|
||||||
if (NodeRef.class.isAssignableFrom(clazz))
|
BasePostMethodInvocationProcessor processor = getPostMethodInvocationProcessorRegistry().getProcessor(clazz);
|
||||||
|
if (processor != null)
|
||||||
{
|
{
|
||||||
result = processNodeRef(collection);
|
result = processor.process(object);
|
||||||
}
|
|
||||||
|
|
||||||
if (AssociationRef.class.isAssignableFrom(clazz))
|
|
||||||
{
|
|
||||||
result = processAssociationRef(collection);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ChildAssociationRef.class.isAssignableFrom(clazz))
|
|
||||||
{
|
|
||||||
result = processChildAssociationRef(collection);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (T) result;
|
return (T) result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Processes a {@link NodeRef} collection
|
|
||||||
*
|
|
||||||
* @param collection The collection to process
|
|
||||||
* @return The processed collection
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
|
||||||
private Collection processNodeRef(Collection collection)
|
|
||||||
{
|
|
||||||
return CollectionUtils.filter(collection, new Filter<NodeRef>()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public Boolean apply(NodeRef nodeRef)
|
|
||||||
{
|
|
||||||
return getNodeRefPostMethodInvocationProcessor().process(nodeRef) != null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Processes a {@link AssociationRef} collection
|
|
||||||
*
|
|
||||||
* @param collection The collection to process
|
|
||||||
* @return The processed collection
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
|
||||||
private Collection processAssociationRef(Collection collection)
|
|
||||||
{
|
|
||||||
return CollectionUtils.filter(collection, new Filter<AssociationRef>()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public Boolean apply(AssociationRef associationRef)
|
|
||||||
{
|
|
||||||
return getAssociationRefPostMethodInvocationProcessor().process(associationRef) != null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Processes a {@link ChildAssociationRef} collection
|
|
||||||
*
|
|
||||||
* @param collection The collection to process
|
|
||||||
* @return The processed collection
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
|
||||||
private Collection processChildAssociationRef(Collection collection)
|
|
||||||
{
|
|
||||||
return CollectionUtils.filter(collection, new Filter<ChildAssociationRef>()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public Boolean apply(ChildAssociationRef childAssociationRef)
|
|
||||||
{
|
|
||||||
return getChildAssociationRefPostMethodInvocationProcessor().process(childAssociationRef) != null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ public class ListPostMethodInvocationProcessor extends CollectionPostMethodInvoc
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
@Override
|
@Override
|
||||||
public Class<List> getClassName()
|
protected Class<List> getClassName()
|
||||||
{
|
{
|
||||||
return List.class;
|
return List.class;
|
||||||
}
|
}
|
||||||
|
@@ -18,9 +18,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor;
|
package org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor;
|
||||||
|
|
||||||
import static org.alfresco.util.ParameterCheck.mandatory;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.util.collections.CollectionUtils;
|
||||||
|
import org.alfresco.util.collections.Filter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NodeRef Post Method Invocation Processor
|
* NodeRef Post Method Invocation Processor
|
||||||
@@ -28,26 +30,41 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
* @author Tuna Aksoy
|
* @author Tuna Aksoy
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class NodeRefPostMethodInvocationProcessor extends BasePostMethodInvocationProcessor
|
public class NodeRefPostMethodInvocationProcessor extends AbstractPostMethodInvocationProcessor
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#getClassName()
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#getClassName()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Class<NodeRef> getClassName()
|
protected Class<NodeRef> getClassName()
|
||||||
{
|
{
|
||||||
return NodeRef.class;
|
return NodeRef.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#process(java.lang.Object)
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.AbstractPostMethodInvocationProcessor#processSingleElement(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public <T> T process(T object)
|
protected <T> T processSingleElement(T object)
|
||||||
{
|
{
|
||||||
mandatory("object", object);
|
NodeRef nodeRef = (NodeRef) object;
|
||||||
checkObjectClass(object);
|
return filter(nodeRef) == null ? null : object;
|
||||||
|
}
|
||||||
|
|
||||||
return filter((NodeRef) object) == null ? null : object;
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.AbstractPostMethodInvocationProcessor#processCollection(java.util.Collection)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
|
@Override
|
||||||
|
protected Collection processCollection(Collection collection)
|
||||||
|
{
|
||||||
|
return CollectionUtils.filter(collection, new Filter<NodeRef>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Boolean apply(NodeRef nodeRef)
|
||||||
|
{
|
||||||
|
return processSingleElement(nodeRef) != null;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor;
|
||||||
|
|
||||||
|
import static org.alfresco.util.ParameterCheck.mandatory;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registry for post method invocation processors
|
||||||
|
*
|
||||||
|
* @author Tuna Aksoy
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public class PostMethodInvocationProcessorRegistry
|
||||||
|
{
|
||||||
|
/** Post method invocation processors */
|
||||||
|
private Map<Class<?>, BasePostMethodInvocationProcessor> processors = new HashMap<Class<?>, BasePostMethodInvocationProcessor>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a post method invocation processor
|
||||||
|
*
|
||||||
|
* @param Post method invocation processor object
|
||||||
|
*/
|
||||||
|
public void register(BasePostMethodInvocationProcessor object)
|
||||||
|
{
|
||||||
|
mandatory("object", object);
|
||||||
|
|
||||||
|
processors.put(object.getClassName(), object);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all the available processors
|
||||||
|
*
|
||||||
|
* @return the processors Available processors
|
||||||
|
*/
|
||||||
|
public Map<Class<?>, BasePostMethodInvocationProcessor> getProcessors()
|
||||||
|
{
|
||||||
|
return this.processors;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the processor from the available processors
|
||||||
|
*
|
||||||
|
* @param clazz The runtime class of the post invocation object
|
||||||
|
* @return The suitable processor for the given class
|
||||||
|
*/
|
||||||
|
public BasePostMethodInvocationProcessor getProcessor(Class<? extends Object> clazz)
|
||||||
|
{
|
||||||
|
mandatory("clazz", clazz);
|
||||||
|
|
||||||
|
BasePostMethodInvocationProcessor result = null;
|
||||||
|
|
||||||
|
for (Map.Entry<Class<?>, BasePostMethodInvocationProcessor> processor : processors.entrySet())
|
||||||
|
{
|
||||||
|
if (processor.getKey().isAssignableFrom(clazz))
|
||||||
|
{
|
||||||
|
result = processor.getValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@@ -33,7 +33,7 @@ public class SetPostMethodInvocationProcessor extends CollectionPostMethodInvoca
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
@Override
|
@Override
|
||||||
public Class<Set> getClassName()
|
protected Class<Set> getClassName()
|
||||||
{
|
{
|
||||||
return Set.class;
|
return Set.class;
|
||||||
}
|
}
|
||||||
|
@@ -18,10 +18,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor;
|
package org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor;
|
||||||
|
|
||||||
import static org.alfresco.util.ParameterCheck.mandatory;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
|
import org.alfresco.util.collections.CollectionUtils;
|
||||||
|
import org.alfresco.util.collections.Filter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* StoreRef Post Method Invocation Processor
|
* StoreRef Post Method Invocation Processor
|
||||||
@@ -29,28 +31,41 @@ import org.alfresco.service.cmr.repository.StoreRef;
|
|||||||
* @author Tuna Aksoy
|
* @author Tuna Aksoy
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class StoreRefPostMethodInvocationProcessor extends BasePostMethodInvocationProcessor
|
public class StoreRefPostMethodInvocationProcessor extends AbstractPostMethodInvocationProcessor
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#getClassName()
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#getClassName()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Class<StoreRef> getClassName()
|
protected Class<StoreRef> getClassName()
|
||||||
{
|
{
|
||||||
return StoreRef.class;
|
return StoreRef.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#process(java.lang.Object)
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.AbstractPostMethodInvocationProcessor#processSingleElement(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public <T> T process(T object)
|
protected <T> T processSingleElement(T object)
|
||||||
{
|
{
|
||||||
mandatory("object", object);
|
|
||||||
checkObjectClass(object);
|
|
||||||
|
|
||||||
NodeRef nodeRef = getNodeService().getRootNode((StoreRef) object);
|
NodeRef nodeRef = getNodeService().getRootNode((StoreRef) object);
|
||||||
|
|
||||||
return filter(nodeRef) == null ? null : object;
|
return filter(nodeRef) == null ? null : object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.AbstractPostMethodInvocationProcessor#processCollection(java.util.Collection)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
|
@Override
|
||||||
|
protected Collection processCollection(Collection collection)
|
||||||
|
{
|
||||||
|
return CollectionUtils.filter(collection, new Filter<NodeRef>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Boolean apply(NodeRef nodeRef)
|
||||||
|
{
|
||||||
|
return processSingleElement(nodeRef) != null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user