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:
Tuna Aksoy
2015-06-16 20:17:27 +00:00
parent d79c6c2105
commit d8f71fba18
12 changed files with 316 additions and 215 deletions

View File

@@ -22,13 +22,12 @@ import static org.alfresco.model.ContentModel.TYPE_CONTENT;
import static org.codehaus.plexus.util.StringUtils.isNotBlank;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
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.ContentClassificationService;
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.AuthenticationUtil;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
@@ -56,9 +55,6 @@ public class ClassificationMethodInterceptor implements MethodInterceptor, Appli
/** Logger */
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();
/** application context */
@@ -112,14 +108,9 @@ public class ClassificationMethodInterceptor implements MethodInterceptor, Appli
return (DictionaryService)applicationContext.getBean("dictionaryService");
}
/**
* Registers the post method invocation processors
*
* @param object The object to register
*/
public void register(BasePostMethodInvocationProcessor object)
protected PostMethodInvocationProcessorRegistry getPostMethodInvocationProcessorRegistry()
{
processors.put(object.getClassName(), object);
return (PostMethodInvocationProcessorRegistry)applicationContext.getBean("postMethodInvocationProcessorRegistry");
}
/**
@@ -238,7 +229,7 @@ public class ClassificationMethodInterceptor implements MethodInterceptor, Appli
if (isUserValid && postInvocation != null)
{
Class<? extends Object> clazz = postInvocation.getClass();
BasePostMethodInvocationProcessor processor = getProcessor(processors, clazz);
BasePostMethodInvocationProcessor processor = getPostMethodInvocationProcessorRegistry().getProcessor(clazz);
if (processor != null)
{
@@ -252,27 +243,4 @@ public class ClassificationMethodInterceptor implements MethodInterceptor, Appli
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;
}
}

View File

@@ -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;
}
}

View File

@@ -18,10 +18,12 @@
*/
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.NodeRef;
import org.alfresco.util.collections.CollectionUtils;
import org.alfresco.util.collections.Filter;
/**
* AssociationRef Post Method Invocation Processor
@@ -29,27 +31,24 @@ import org.alfresco.service.cmr.repository.NodeRef;
* @author Tuna Aksoy
* @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()
*/
@Override
public Class<AssociationRef> getClassName()
protected Class<AssociationRef> getClassName()
{
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
public <T> T process(T object)
protected <T> T processSingleElement(T object)
{
mandatory("object", object);
checkObjectClass(object);
AssociationRef associationRef = ((AssociationRef) object);
AssociationRef associationRef = (AssociationRef) object;
NodeRef sourceRef = associationRef.getSourceRef();
NodeRef filteredSource = filter(sourceRef);
@@ -59,4 +58,21 @@ public class AssociationRefPostMethodInvocationProcessor extends BasePostMethodI
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;
}
});
}
}

View File

@@ -20,6 +20,8 @@ package org.alfresco.module.org_alfresco_module_rm.classification.interceptor.pr
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.interceptor.ClassificationMethodInterceptor;
import org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.ClassificationPostMethodInvocationException.NotSupportedClassTypeException;
@@ -47,6 +49,9 @@ public abstract class BasePostMethodInvocationProcessor
/** Content classification service */
private ContentClassificationService contentClassificationService;
/** Post method invocation processor registry */
private PostMethodInvocationProcessorRegistry postMethodInvocationProcessorRegistry;
/**
* @return the classificationMethodInterceptor
*/
@@ -79,6 +84,14 @@ public abstract class BasePostMethodInvocationProcessor
return this.contentClassificationService;
}
/**
* @return the postMethodInvocationProcessorRegistry
*/
protected PostMethodInvocationProcessorRegistry getPostMethodInvocationProcessorRegistry()
{
return this.postMethodInvocationProcessorRegistry;
}
/**
* @param classificationMethodInterceptor the classificationMethodInterceptor to set
*/
@@ -111,12 +124,20 @@ public abstract class BasePostMethodInvocationProcessor
this.contentClassificationService = contentClassificationService;
}
/**
* @param postMethodInvocationProcessorRegistry the postMethodInvocationProcessorRegistry to set
*/
public void setPostMethodInvocationProcessorRegistry(PostMethodInvocationProcessorRegistry postMethodInvocationProcessorRegistry)
{
this.postMethodInvocationProcessorRegistry = postMethodInvocationProcessorRegistry;
}
/**
* Gets 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
@@ -131,7 +152,7 @@ public abstract class BasePostMethodInvocationProcessor
*/
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
* content but the logged in user is not cleared to see the it.

View File

@@ -18,10 +18,12 @@
*/
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.NodeRef;
import org.alfresco.util.collections.CollectionUtils;
import org.alfresco.util.collections.Filter;
/**
* ChildAssociationRef Post Method Invocation Processor
@@ -29,26 +31,23 @@ import org.alfresco.service.cmr.repository.NodeRef;
* @author Tuna Aksoy
* @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()
*/
@Override
public Class<ChildAssociationRef> getClassName()
protected Class<ChildAssociationRef> getClassName()
{
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
public <T> T process(T object)
protected <T> T processSingleElement(T object)
{
mandatory("object", object);
checkObjectClass(object);
ChildAssociationRef childAssociationRef = ((ChildAssociationRef) object);
NodeRef childRef = childAssociationRef.getChildRef();
@@ -59,4 +58,21 @@ public class ChildAssociationRefPostMethodInvocationProcessor extends BasePostMe
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;
}
});
}
}

View File

@@ -23,12 +23,6 @@ import static org.alfresco.util.ParameterCheck.mandatory;
import java.util.Collection;
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
*
@@ -37,63 +31,6 @@ import org.alfresco.util.collections.Filter;
*/
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)
*/
@@ -102,91 +39,24 @@ public abstract class CollectionPostMethodInvocationProcessor extends BasePostMe
public <T> T process(T object)
{
mandatory("object", object);
checkObjectClass(object);
Object result = object;
Collection collection = ((Collection) object);
if (!collection.isEmpty())
{
Iterator iterator = collection.iterator();
if (iterator.hasNext())
{
Class<? extends Object> clazz = iterator.next().getClass();
if (NodeRef.class.isAssignableFrom(clazz))
BasePostMethodInvocationProcessor processor = getPostMethodInvocationProcessorRegistry().getProcessor(clazz);
if (processor != null)
{
result = processNodeRef(collection);
}
if (AssociationRef.class.isAssignableFrom(clazz))
{
result = processAssociationRef(collection);
}
if (ChildAssociationRef.class.isAssignableFrom(clazz))
{
result = processChildAssociationRef(collection);
result = processor.process(object);
}
}
}
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;
}
});
}
}

View File

@@ -33,7 +33,7 @@ public class ListPostMethodInvocationProcessor extends CollectionPostMethodInvoc
*/
@SuppressWarnings("rawtypes")
@Override
public Class<List> getClassName()
protected Class<List> getClassName()
{
return List.class;
}

View File

@@ -18,9 +18,11 @@
*/
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.util.collections.CollectionUtils;
import org.alfresco.util.collections.Filter;
/**
* NodeRef Post Method Invocation Processor
@@ -28,26 +30,41 @@ import org.alfresco.service.cmr.repository.NodeRef;
* @author Tuna Aksoy
* @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()
*/
@Override
public Class<NodeRef> getClassName()
protected Class<NodeRef> getClassName()
{
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
public <T> T process(T object)
protected <T> T processSingleElement(T object)
{
mandatory("object", object);
checkObjectClass(object);
NodeRef nodeRef = (NodeRef) 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;
}
});
}
}

View File

@@ -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;
}
}

View File

@@ -33,7 +33,7 @@ public class SetPostMethodInvocationProcessor extends CollectionPostMethodInvoca
*/
@SuppressWarnings("rawtypes")
@Override
public Class<Set> getClassName()
protected Class<Set> getClassName()
{
return Set.class;
}

View File

@@ -18,10 +18,12 @@
*/
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.StoreRef;
import org.alfresco.util.collections.CollectionUtils;
import org.alfresco.util.collections.Filter;
/**
* StoreRef Post Method Invocation Processor
@@ -29,28 +31,41 @@ import org.alfresco.service.cmr.repository.StoreRef;
* @author Tuna Aksoy
* @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()
*/
@Override
public Class<StoreRef> getClassName()
protected Class<StoreRef> getClassName()
{
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
public <T> T process(T object)
protected <T> T processSingleElement(T object)
{
mandatory("object", object);
checkObjectClass(object);
NodeRef nodeRef = getNodeService().getRootNode((StoreRef) 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;
}
});
}
}