diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/interceptor/processor/AbstractPostMethodInvocationProcessor.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/interceptor/processor/AbstractPostMethodInvocationProcessor.java index 2269dedac1..894e6e0216 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/interceptor/processor/AbstractPostMethodInvocationProcessor.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/interceptor/processor/AbstractPostMethodInvocationProcessor.java @@ -18,10 +18,6 @@ */ package org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor; -import java.util.Collection; - -import org.alfresco.util.collections.CollectionUtils; -import org.alfresco.util.collections.Filter; /** * Abstract Post Method Invocation Processor @@ -39,29 +35,9 @@ public abstract class AbstractPostMethodInvocationProcessor extends BasePostMeth */ protected abstract T processSingleElement(T object); - /** - * Processes a collection - * - * @param collection The collection to process - * @return Processed collection - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - protected Collection processCollection(Collection collection) - { - return CollectionUtils.filter(collection, new Filter() - { - @Override - public Boolean apply(Object element) - { - return processSingleElement(element) != null; - } - }); - } - /** * @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#process(java.lang.Object) */ - @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public T process(T object) { @@ -69,18 +45,7 @@ public abstract class AbstractPostMethodInvocationProcessor extends BasePostMeth if (result != null) { - if (isCollection(result)) - { - Collection collection = ((Collection) result); - if (!collection.isEmpty()) - { - result = (T) processCollection(collection); - } - } - else - { - result = processSingleElement(result); - } + result = processSingleElement(result); } return result; diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/interceptor/processor/BasePostMethodInvocationProcessor.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/interceptor/processor/BasePostMethodInvocationProcessor.java index c9fe37f231..9e8a9ff221 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/interceptor/processor/BasePostMethodInvocationProcessor.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/interceptor/processor/BasePostMethodInvocationProcessor.java @@ -20,8 +20,6 @@ package org.alfresco.module.org_alfresco_module_rm.classification.interceptor.pr import static org.alfresco.model.ContentModel.TYPE_CONTENT; -import java.util.Collection; - import javax.annotation.PostConstruct; import org.alfresco.module.org_alfresco_module_rm.classification.ContentClassificationService; @@ -185,17 +183,6 @@ public abstract class BasePostMethodInvocationProcessor getPostMethodInvocationProcessor().register(this); } - /** - * Checks if the given object is a collection - * - * @param object Object to check - * @return true if the code is a collection, false otherwise - */ - protected 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. diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/interceptor/processor/CollectionPostMethodInvocationProcessor.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/interceptor/processor/CollectionPostMethodInvocationProcessor.java index 6e87a8d5ed..8548035977 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/interceptor/processor/CollectionPostMethodInvocationProcessor.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/interceptor/processor/CollectionPostMethodInvocationProcessor.java @@ -20,7 +20,6 @@ package org.alfresco.module.org_alfresco_module_rm.classification.interceptor.pr import java.util.Collection; import java.util.Iterator; -import java.util.List; import org.springframework.stereotype.Component; @@ -39,8 +38,7 @@ public class CollectionPostMethodInvocationProcessor extends BasePostMethodInvoc @Override protected Class getClassName() { - // FIXME!!! - return List.class; + return Collection.class; } /** @@ -58,12 +56,23 @@ public class CollectionPostMethodInvocationProcessor extends BasePostMethodInvoc if (!collection.isEmpty()) { Iterator iterator = collection.iterator(); - if (iterator.hasNext()) + while (iterator.hasNext()) { - BasePostMethodInvocationProcessor processor = getPostMethodInvocationProcessor().getProcessor(iterator.next()); + Object next = iterator.next(); + // TODO: Can we guarantee that all the elements of a collection can be processed by the same processor? + BasePostMethodInvocationProcessor processor = getPostMethodInvocationProcessor().getProcessor(next); if (processor != null) { - result = processor.process(object); + Object processed = processor.process(next); + if (processed == null) + { + iterator.remove(); + } + else if (!processed.equals(next)) + { + // TODO Support this, as it will be hit by e.g. collections of collections. + throw new IllegalStateException("Modifying members of a collection is not yet supported."); + } } } }