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@106104 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2015-06-14 22:32:59 +00:00
parent b83bc89275
commit f7ab449f79
3 changed files with 63 additions and 9 deletions

View File

@@ -137,7 +137,7 @@ public abstract class CollectionPostMethodInvocationProcessor extends BasePostMe
@SuppressWarnings({ "rawtypes", "unchecked" })
private Collection processNodeRef(Collection collection, Iterator iterator)
{
CollectionUtils.filter(collection, new Filter<NodeRef>()
return CollectionUtils.filter(collection, new Filter<NodeRef>()
{
@Override
public Boolean apply(NodeRef nodeRef)
@@ -145,8 +145,6 @@ public abstract class CollectionPostMethodInvocationProcessor extends BasePostMe
return getNodeRefPostMethodInvocationProcessor().process(nodeRef) != null;
}
});
return collection;
}
/**
@@ -158,7 +156,7 @@ public abstract class CollectionPostMethodInvocationProcessor extends BasePostMe
@SuppressWarnings({ "rawtypes", "unchecked" })
private Collection processAssociationRef(Collection collection, Iterator iterator)
{
CollectionUtils.filter(collection, new Filter<AssociationRef>()
return CollectionUtils.filter(collection, new Filter<AssociationRef>()
{
@Override
public Boolean apply(AssociationRef associationRef)
@@ -166,8 +164,6 @@ public abstract class CollectionPostMethodInvocationProcessor extends BasePostMe
return getAssociationRefPostMethodInvocationProcessor().process(associationRef) != null;
}
});
return collection;
}
/**
@@ -179,7 +175,7 @@ public abstract class CollectionPostMethodInvocationProcessor extends BasePostMe
@SuppressWarnings({ "rawtypes", "unchecked" })
private Collection processChildAssociationRef(Collection collection, Iterator iterator)
{
CollectionUtils.filter(collection, new Filter<ChildAssociationRef>()
return CollectionUtils.filter(collection, new Filter<ChildAssociationRef>()
{
@Override
public Boolean apply(ChildAssociationRef childAssociationRef)
@@ -187,7 +183,5 @@ public abstract class CollectionPostMethodInvocationProcessor extends BasePostMe
return getChildAssociationRefPostMethodInvocationProcessor().process(childAssociationRef) != null;
}
});
return collection;
}
}

View File

@@ -0,0 +1,55 @@
/*
* 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 org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef;
/**
* StoreRef Post Method Invocation Processor
*
* @author Tuna Aksoy
* @since 3.0
*/
public class StoreRefPostMethodInvocationProcessor extends BasePostMethodInvocationProcessor
{
/**
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#getClassName()
*/
@Override
public Class<StoreRef> getClassName()
{
return StoreRef.class;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#process(java.lang.Object)
*/
@Override
public <T> T process(T object)
{
mandatory("object", object);
NodeRef nodeRef = getNodeService().getRootNode((StoreRef) object);
return filter(nodeRef) == null ? null : object;
}
}