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@107363 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -66,8 +66,6 @@
|
|||||||
<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="basePostMethodInvocationProcessorCache" class="org.alfresco.repo.cache.DefaultSimpleCache" />
|
|
||||||
|
|
||||||
<!-- Classification service DAO -->
|
<!-- Classification service DAO -->
|
||||||
|
|
||||||
<bean id="classificationServiceDAO" class="org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceDAO">
|
<bean id="classificationServiceDAO" class="org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceDAO">
|
||||||
|
@@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#process(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public <T> T process(T object)
|
|
||||||
{
|
|
||||||
T result = object;
|
|
||||||
|
|
||||||
if (result != null)
|
|
||||||
{
|
|
||||||
result = processSingleElement(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -19,7 +19,6 @@
|
|||||||
package org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor;
|
package org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor;
|
||||||
|
|
||||||
import static java.lang.reflect.Array.newInstance;
|
import static java.lang.reflect.Array.newInstance;
|
||||||
import static org.alfresco.util.ParameterCheck.mandatory;
|
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -52,39 +51,40 @@ public class ArrayPostMethodInvocationProcessor extends BasePostMethodInvocation
|
|||||||
@Override
|
@Override
|
||||||
public <T> T process(T object)
|
public <T> T process(T object)
|
||||||
{
|
{
|
||||||
mandatory("object", object);
|
|
||||||
|
|
||||||
T result = object;
|
T result = object;
|
||||||
T[] objects = (T[]) result;
|
|
||||||
T obj = objects[0];
|
|
||||||
|
|
||||||
BasePostMethodInvocationProcessor processor = getPostMethodInvocationProcessor().getProcessor(obj);
|
if (result != null)
|
||||||
if (processor != null)
|
|
||||||
{
|
{
|
||||||
int length = objects.length;
|
T[] objects = (T[]) result;
|
||||||
List processedObjects = new ArrayList();
|
T obj = objects[0];
|
||||||
|
|
||||||
for (int i = 0; i < length; i++)
|
BasePostMethodInvocationProcessor processor = getPostMethodInvocationProcessor().getProcessor(obj);
|
||||||
|
if (processor != null)
|
||||||
{
|
{
|
||||||
Object processedObject = processor.process(objects[i]);
|
int length = objects.length;
|
||||||
if (processedObject != null)
|
List processedObjects = new ArrayList();
|
||||||
|
|
||||||
|
for (int i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
processedObjects.add(processedObject);
|
Object processedObject = processor.process(objects[i]);
|
||||||
|
if (processedObject != null)
|
||||||
|
{
|
||||||
|
processedObjects.add(processedObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int size = processedObjects.size();
|
||||||
|
T[] objs = (T[]) newInstance(obj.getClass(), size);
|
||||||
|
|
||||||
|
for (int i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
objs[i] = (T) processedObjects.get(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
result = (T) objs;
|
||||||
}
|
}
|
||||||
|
|
||||||
int size = processedObjects.size();
|
|
||||||
T[] objs = (T[]) newInstance(obj.getClass(), size);
|
|
||||||
|
|
||||||
for (int i = 0; i < size; i++)
|
|
||||||
{
|
|
||||||
objs[i] = (T) processedObjects.get(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
result = (T) objs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,7 @@ import org.springframework.stereotype.Component;
|
|||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class AssociationRefPostMethodInvocationProcessor extends AbstractPostMethodInvocationProcessor
|
public class AssociationRefPostMethodInvocationProcessor extends BasePostMethodInvocationProcessor
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @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()
|
||||||
@@ -41,19 +41,29 @@ public class AssociationRefPostMethodInvocationProcessor extends AbstractPostMet
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.AbstractPostMethodInvocationProcessor#processSingleElement(java.lang.Object)
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#process(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected <T> T processSingleElement(T object)
|
public <T> T process(T object)
|
||||||
{
|
{
|
||||||
AssociationRef associationRef = getClassName().cast(object);
|
T result = object;
|
||||||
|
|
||||||
NodeRef sourceRef = associationRef.getSourceRef();
|
if (result != null)
|
||||||
NodeRef filteredSource = filter(sourceRef);
|
{
|
||||||
|
AssociationRef associationRef = getClassName().cast(result);
|
||||||
|
|
||||||
NodeRef targetRef = associationRef.getTargetRef();
|
NodeRef sourceRef = associationRef.getSourceRef();
|
||||||
NodeRef filteredTarget = filter(targetRef);
|
NodeRef filteredSource = filter(sourceRef);
|
||||||
|
|
||||||
return (filteredSource == null || filteredTarget == null) ? null : object;
|
NodeRef targetRef = associationRef.getTargetRef();
|
||||||
|
NodeRef filteredTarget = filter(targetRef);
|
||||||
|
|
||||||
|
if (filteredSource == null || filteredTarget == null)
|
||||||
|
{
|
||||||
|
result = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,11 +24,9 @@ import javax.annotation.PostConstruct;
|
|||||||
|
|
||||||
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.SecurityClearanceService;
|
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.dictionary.DictionaryService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.util.Pair;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,10 +57,6 @@ public abstract class BasePostMethodInvocationProcessor
|
|||||||
@Autowired
|
@Autowired
|
||||||
private PostMethodInvocationProcessor postMethodInvocationProcessor;
|
private PostMethodInvocationProcessor postMethodInvocationProcessor;
|
||||||
|
|
||||||
/** Cache to hold the filtered node information */
|
|
||||||
@Autowired
|
|
||||||
private SimpleCache<Pair<String, NodeRef>, Pair<Boolean, NodeRef>> basePostMethodInvocationProcessorCache;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the nodeService
|
* @return the nodeService
|
||||||
*/
|
*/
|
||||||
@@ -103,14 +97,6 @@ public abstract class BasePostMethodInvocationProcessor
|
|||||||
return this.postMethodInvocationProcessor;
|
return this.postMethodInvocationProcessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the cache
|
|
||||||
*/
|
|
||||||
protected SimpleCache<Pair<String, NodeRef>, Pair<Boolean, NodeRef>> getCache()
|
|
||||||
{
|
|
||||||
return this.basePostMethodInvocationProcessorCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param nodeService the nodeService to set
|
* @param nodeService the nodeService to set
|
||||||
*/
|
*/
|
||||||
@@ -152,11 +138,12 @@ public abstract class BasePostMethodInvocationProcessor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param cache the cache to set
|
* Registers the post method invocation processors
|
||||||
*/
|
*/
|
||||||
public void setCache(SimpleCache<Pair<String, NodeRef>, Pair<Boolean, NodeRef>> cache)
|
@PostConstruct
|
||||||
|
public void register()
|
||||||
{
|
{
|
||||||
this.basePostMethodInvocationProcessorCache = cache;
|
getPostMethodInvocationProcessor().register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -172,16 +159,7 @@ public abstract class BasePostMethodInvocationProcessor
|
|||||||
* @param object The object to check
|
* @param object The object to check
|
||||||
* @return The given object
|
* @return The given object
|
||||||
*/
|
*/
|
||||||
public abstract <T extends Object> T process(T object);
|
protected abstract <T extends Object> T process(T object);
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers the post method invocation processors
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
|
||||||
public void register()
|
|
||||||
{
|
|
||||||
getPostMethodInvocationProcessor().register(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
@@ -202,29 +180,6 @@ public abstract class BasePostMethodInvocationProcessor
|
|||||||
filter = null;
|
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;
|
return filter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,7 @@ import org.springframework.stereotype.Component;
|
|||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class ChildAssociationRefPostMethodInvocationProcessor extends AbstractPostMethodInvocationProcessor
|
public class ChildAssociationRefPostMethodInvocationProcessor extends BasePostMethodInvocationProcessor
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @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()
|
||||||
@@ -41,28 +41,34 @@ public class ChildAssociationRefPostMethodInvocationProcessor extends AbstractPo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.AbstractPostMethodInvocationProcessor#processSingleElement(java.lang.Object)
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#process(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected <T> T processSingleElement(T object)
|
public <T> T process(T object)
|
||||||
{
|
{
|
||||||
T result;
|
T result = object;
|
||||||
|
|
||||||
ChildAssociationRef childAssociationRef = getClassName().cast(object);
|
if (result != null)
|
||||||
|
|
||||||
NodeRef childRef = childAssociationRef.getChildRef();
|
|
||||||
NodeRef filteredChildRef = filter(childRef);
|
|
||||||
|
|
||||||
NodeRef parentRef = childAssociationRef.getParentRef();
|
|
||||||
NodeRef filteredParentRef;
|
|
||||||
if (parentRef == null)
|
|
||||||
{
|
{
|
||||||
result = filteredChildRef == null ? null : object;
|
ChildAssociationRef childAssociationRef = getClassName().cast(result);
|
||||||
}
|
|
||||||
else
|
NodeRef childRef = childAssociationRef.getChildRef();
|
||||||
{
|
NodeRef filteredChildRef = filter(childRef);
|
||||||
filteredParentRef = filter(parentRef);
|
|
||||||
result = (filteredChildRef == null || filteredParentRef == null) ? null : object;
|
NodeRef parentRef = childAssociationRef.getParentRef();
|
||||||
|
NodeRef filteredParentRef;
|
||||||
|
if (parentRef == null && filteredChildRef == null)
|
||||||
|
{
|
||||||
|
result = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
filteredParentRef = filter(parentRef);
|
||||||
|
if (filteredChildRef == null || filteredParentRef == null)
|
||||||
|
{
|
||||||
|
result = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -28,7 +28,7 @@ import org.springframework.stereotype.Component;
|
|||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class NodeRefPostMethodInvocationProcessor extends AbstractPostMethodInvocationProcessor
|
public class NodeRefPostMethodInvocationProcessor extends BasePostMethodInvocationProcessor
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @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()
|
||||||
@@ -40,12 +40,22 @@ public class NodeRefPostMethodInvocationProcessor extends AbstractPostMethodInvo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.AbstractPostMethodInvocationProcessor#processSingleElement(java.lang.Object)
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#process(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected <T> T processSingleElement(T object)
|
public <T> T process(T object)
|
||||||
{
|
{
|
||||||
NodeRef nodeRef = getClassName().cast(object);
|
T result = object;
|
||||||
return filter(nodeRef) == null ? null : object;
|
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
NodeRef nodeRef = getClassName().cast(result);
|
||||||
|
if (filter(nodeRef) == null)
|
||||||
|
{
|
||||||
|
result = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -50,34 +50,41 @@ public class PagingResultsPostMethodInvocationProcessor extends BasePostMethodIn
|
|||||||
@Override
|
@Override
|
||||||
public <T> T process(T object)
|
public <T> T process(T object)
|
||||||
{
|
{
|
||||||
final PagingResults pagingResults = getClassName().cast(object);
|
T result = object;
|
||||||
List page = pagingResults.getPage();
|
|
||||||
final List processedPage = getPostMethodInvocationProcessor().process(page);
|
|
||||||
|
|
||||||
return (T) new PagingResults<T>()
|
if (result != null)
|
||||||
{
|
{
|
||||||
@Override
|
final PagingResults pagingResults = getClassName().cast(result);
|
||||||
public String getQueryExecutionId()
|
List page = pagingResults.getPage();
|
||||||
|
final List processedPage = getPostMethodInvocationProcessor().process(page);
|
||||||
|
|
||||||
|
result = (T) new PagingResults<T>()
|
||||||
{
|
{
|
||||||
return pagingResults.getQueryExecutionId();
|
@Override
|
||||||
}
|
public String getQueryExecutionId()
|
||||||
@Override
|
{
|
||||||
public List<T> getPage()
|
return pagingResults.getQueryExecutionId();
|
||||||
{
|
}
|
||||||
return processedPage;
|
@Override
|
||||||
}
|
public List<T> getPage()
|
||||||
@Override
|
{
|
||||||
public boolean hasMoreItems()
|
return processedPage;
|
||||||
{
|
}
|
||||||
// FIXME: hasMoreItems might not be correct
|
@Override
|
||||||
return pagingResults.hasMoreItems();
|
public boolean hasMoreItems()
|
||||||
}
|
{
|
||||||
@Override
|
// hasMoreItems might not be correct. Cannot determine the correct value as request details are needed.
|
||||||
public Pair<Integer, Integer> getTotalResultCount()
|
return pagingResults.hasMoreItems();
|
||||||
{
|
}
|
||||||
int size = processedPage.size();
|
@Override
|
||||||
return new Pair<Integer, Integer>(size, size);
|
public Pair<Integer, Integer> getTotalResultCount()
|
||||||
}
|
{
|
||||||
};
|
int size = processedPage.size();
|
||||||
|
return new Pair<Integer, Integer>(size, size);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,7 @@ import org.springframework.stereotype.Component;
|
|||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class PermissionCheckValuePostMethodInvocationProcessor extends AbstractPostMethodInvocationProcessor
|
public class PermissionCheckValuePostMethodInvocationProcessor extends BasePostMethodInvocationProcessor
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @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()
|
||||||
@@ -41,13 +41,23 @@ public class PermissionCheckValuePostMethodInvocationProcessor extends AbstractP
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.AbstractPostMethodInvocationProcessor#processSingleElement(java.lang.Object)
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.BasePostMethodInvocationProcessor#process(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected <T> T processSingleElement(T object)
|
public <T> T process(T object)
|
||||||
{
|
{
|
||||||
PermissionCheckValue permissionCheckValue = getClassName().cast(object);
|
T result = object;
|
||||||
NodeRef nodeRef = permissionCheckValue.getNodeRef();
|
|
||||||
return filter(nodeRef) == null ? null : object;
|
if (result != null)
|
||||||
|
{
|
||||||
|
PermissionCheckValue permissionCheckValue = getClassName().cast(result);
|
||||||
|
NodeRef nodeRef = permissionCheckValue.getNodeRef();
|
||||||
|
if (filter(nodeRef) == null)
|
||||||
|
{
|
||||||
|
result = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -52,26 +52,33 @@ public class QueryEngineResultsPostMethodInvocationProcessor extends BasePostMet
|
|||||||
@Override
|
@Override
|
||||||
public <T> T process(T object)
|
public <T> T process(T object)
|
||||||
{
|
{
|
||||||
QueryEngineResults queryEngineResults = getClassName().cast(object);
|
T result = object;
|
||||||
Map<Set<String>, ResultSet> resultsMap = queryEngineResults.getResults();
|
|
||||||
Map<Set<String>, ResultSet> returnMap = new HashMap<>();
|
|
||||||
BasePostMethodInvocationProcessor processor = null;
|
|
||||||
|
|
||||||
for (Entry<Set<String>, ResultSet> entry : resultsMap.entrySet())
|
if (result != null)
|
||||||
{
|
{
|
||||||
ResultSet value = entry.getValue();
|
QueryEngineResults queryEngineResults = getClassName().cast(result);
|
||||||
if (processor == null)
|
Map<Set<String>, ResultSet> resultsMap = queryEngineResults.getResults();
|
||||||
|
Map<Set<String>, ResultSet> returnMap = new HashMap<>();
|
||||||
|
BasePostMethodInvocationProcessor processor = null;
|
||||||
|
|
||||||
|
for (Entry<Set<String>, ResultSet> entry : resultsMap.entrySet())
|
||||||
{
|
{
|
||||||
processor = getPostMethodInvocationProcessor().getProcessor(value);
|
ResultSet value = entry.getValue();
|
||||||
|
if (processor == null)
|
||||||
|
{
|
||||||
|
processor = getPostMethodInvocationProcessor().getProcessor(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
ResultSet newResultSet = processor.process(value);
|
||||||
|
if (newResultSet != null)
|
||||||
|
{
|
||||||
|
returnMap.put(entry.getKey(), newResultSet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultSet newResultSet = processor.process(value);
|
result = (T) new QueryEngineResults(returnMap);
|
||||||
if (newResultSet != null)
|
|
||||||
{
|
|
||||||
returnMap.put(entry.getKey(), newResultSet);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (T) new QueryEngineResults(returnMap);
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,7 @@ public class ResultSetPostMethodInvocationProcessor extends BasePostMethodInvoca
|
|||||||
|
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
ResultSet returnedObject = getClassName().cast(object);
|
ResultSet returnedObject = getClassName().cast(result);
|
||||||
|
|
||||||
BitSet inclusionMask = new BitSet(returnedObject.length());
|
BitSet inclusionMask = new BitSet(returnedObject.length());
|
||||||
FilteringResultSet filteringResultSet = new FilteringResultSet(returnedObject, inclusionMask);
|
FilteringResultSet filteringResultSet = new FilteringResultSet(returnedObject, inclusionMask);
|
||||||
|
@@ -29,7 +29,7 @@ import org.springframework.stereotype.Component;
|
|||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class StoreRefPostMethodInvocationProcessor extends AbstractPostMethodInvocationProcessor
|
public class StoreRefPostMethodInvocationProcessor extends BasePostMethodInvocationProcessor
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @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()
|
||||||
@@ -44,10 +44,20 @@ public class StoreRefPostMethodInvocationProcessor extends AbstractPostMethodInv
|
|||||||
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.AbstractPostMethodInvocationProcessor#processSingleElement(java.lang.Object)
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor.AbstractPostMethodInvocationProcessor#processSingleElement(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected <T> T processSingleElement(T object)
|
public <T> T process(T object)
|
||||||
{
|
{
|
||||||
StoreRef storeRef = getClassName().cast(object);
|
T result = object;
|
||||||
NodeRef nodeRef = getNodeService().getRootNode(storeRef);
|
|
||||||
return filter(nodeRef) == null ? null : object;
|
if (result != null)
|
||||||
|
{
|
||||||
|
StoreRef storeRef = getClassName().cast(result);
|
||||||
|
NodeRef nodeRef = getNodeService().getRootNode(storeRef);
|
||||||
|
if (filter(nodeRef) == null)
|
||||||
|
{
|
||||||
|
result = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user