diff --git a/source/java/org/alfresco/repo/node/getchildren/GetChildrenCannedQuery.java b/source/java/org/alfresco/repo/node/getchildren/GetChildrenCannedQuery.java index 8472f5bb87..6c7104c7d5 100644 --- a/source/java/org/alfresco/repo/node/getchildren/GetChildrenCannedQuery.java +++ b/source/java/org/alfresco/repo/node/getchildren/GetChildrenCannedQuery.java @@ -35,7 +35,6 @@ import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.model.ContentModel; import org.alfresco.query.CannedQueryParameters; import org.alfresco.query.CannedQuerySortDetails; -import org.alfresco.query.PagingResults; import org.alfresco.query.CannedQuerySortDetails.SortOrder; import org.alfresco.repo.domain.node.AuditablePropertiesEntity; import org.alfresco.repo.domain.node.Node; @@ -482,7 +481,7 @@ public class GetChildrenCannedQuery extends AbstractCannedQueryPermissions applyPostQueryPermissions(List results, String authenticationToken, int requestedCount) + protected List applyPostQueryPermissions(List results, String authenticationToken, int requestedCount) { Long start = (logger.isDebugEnabled() ? System.currentTimeMillis() : null); @@ -495,11 +494,11 @@ public class GetChildrenCannedQuery extends AbstractCannedQueryPermissions ret = super.applyPostQueryPermissions(results, authenticationToken, requestedCount); + List ret = super.applyPostQueryPermissions(results, authenticationToken, requestedCount); if (start != null) { - logger.debug("Post-query perms: "+ret.getPage().size()+" in "+(System.currentTimeMillis()-start)+" msecs"); + logger.debug("Post-query perms: "+ret.size()+" in "+(System.currentTimeMillis()-start)+" msecs"); } return ret; @@ -699,9 +698,9 @@ public class GetChildrenCannedQuery extends AbstractCannedQueryPermissions results = applyPermissions(nodeRefs, authenticationToken, nodeRefs.size()); + List results = applyPermissions(nodeRefs, authenticationToken, nodeRefs.size()); - for (NodeRef nodeRef : results.getPage()) + for (NodeRef nodeRef : results) { // Call back boolean more = resultsCallback.handle(nodeRef); diff --git a/source/java/org/alfresco/repo/security/authority/GetAuthoritiesCannedQueryFactory.java b/source/java/org/alfresco/repo/security/authority/GetAuthoritiesCannedQueryFactory.java index 25a81a2cf2..674cb97716 100644 --- a/source/java/org/alfresco/repo/security/authority/GetAuthoritiesCannedQueryFactory.java +++ b/source/java/org/alfresco/repo/security/authority/GetAuthoritiesCannedQueryFactory.java @@ -18,7 +18,6 @@ */ package org.alfresco.repo.security.authority; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; diff --git a/source/java/org/alfresco/repo/security/permissions/impl/acegi/AbstractCannedQueryPermissions.java b/source/java/org/alfresco/repo/security/permissions/impl/acegi/AbstractCannedQueryPermissions.java index 7bbdec5ddc..f6e5303071 100644 --- a/source/java/org/alfresco/repo/security/permissions/impl/acegi/AbstractCannedQueryPermissions.java +++ b/source/java/org/alfresco/repo/security/permissions/impl/acegi/AbstractCannedQueryPermissions.java @@ -76,7 +76,7 @@ public abstract class AbstractCannedQueryPermissions extends AbstractCannedQu this.method = method; } - protected PagingResults applyPostQueryPermissions(List results, String authenticationToken, int requestedCount) + protected List applyPostQueryPermissions(List results, String authenticationToken, int requestedCount) { int requestTotalCountMax = getParameters().requestTotalResultCountMax(); int maxChecks = (((requestTotalCountMax > 0) && (requestTotalCountMax > requestedCount)) ? requestTotalCountMax : requestedCount); @@ -85,43 +85,10 @@ public abstract class AbstractCannedQueryPermissions extends AbstractCannedQu } @SuppressWarnings("unchecked") - protected PagingResults applyPermissions(List results, String authenticationToken, int maxChecks) + protected List applyPermissions(List results, String authenticationToken, int maxChecks) { long start = System.currentTimeMillis(); - // empty result - PagingResults ret = new PagingResults() - { - @Override - public String getQueryExecutionId() - { - return null; - } - - @Override - public Pair getTotalResultCount() - { - return new Pair(0, 0); - } - - @Override - public List getPage() - { - return new ArrayList(0); - } - - @Override - public boolean hasMoreItems() - { - return false; - } - - public boolean permissionsApplied() - { - return false; - } - }; - Context context = ContextHolder.getContext(); if ((context == null) || (! (context instanceof AlfrescoSecureContext))) { @@ -129,54 +96,18 @@ public abstract class AbstractCannedQueryPermissions extends AbstractCannedQu { logger.debug("Unexpected context: "+(context == null ? "null" : context.getClass())+" - "+Thread.currentThread().getId()); } - System.out.println("Unexpected context: "+(context == null ? "null" : context.getClass())+" - "+Thread.currentThread().getId()); - return ret; // empty result + return new WrappedList(new ArrayList(0), true, false); // empty result } Authentication authentication = (((SecureContext) context).getAuthentication()); ConfigAttributeDefinition cad = methodSecurityInterceptor.getObjectDefinitionSource().getAttributes(new InternalMethodInvocation(method)); - final WrappedList wl = (WrappedList)methodSecurityInterceptor.getAfterInvocationManager().decide(authentication, null, cad, new WrappedList(results, maxChecks)); - - // final result - ret = new PagingResults() - { - @Override - public String getQueryExecutionId() - { - return null; - } - - @Override - public Pair getTotalResultCount() - { - int count = wl.size(); - return new Pair(count, ((! wl.hasMoreItems()) ? count : null)); - } - - @Override - public List getPage() - { - return wl; - } - - @Override - public boolean hasMoreItems() - { - return wl.hasMoreItems(); // if hasMoreItems then implies cutoff - } - - @Override - public boolean permissionsApplied() - { - return wl.permissionsApplied(); - } - }; + List ret = (WrappedList)methodSecurityInterceptor.getAfterInvocationManager().decide(authentication, null, cad, new WrappedList(results, maxChecks)); if (logger.isTraceEnabled()) { - logger.trace("applyPermissions: "+wl.size()+" items in "+(System.currentTimeMillis()-start)+" msecs"); + logger.trace("applyPermissions: "+ret.size()+" items in "+(System.currentTimeMillis()-start)+" msecs"); } return ret;