From 703fcbef775bee388711406bdbcaeccee3a545f0 Mon Sep 17 00:00:00 2001 From: Tom Page Date: Fri, 17 Jul 2015 09:01:00 +0000 Subject: [PATCH] RM-2466 Pass through total results count as if nothing is filtered. Change PagingResultsPostMethodInvocationProcessor to always return the total results count as if nothing is filtered. This should fix the case where nothing is filtered, and is a concession to the fact that we cannot know how many total results there will be from a single page. We will fix this later by filtering the results before we get to this processor, but the processor is a good backup filter. Change the rm-automation tests not to use the pagination details at the bottom of the browse list pages, as these will often now be incorrect. In making this change I also looked at using the getTotalResultCount() interface with a range as the interface supports returning a minimum and maximum on the total number of results. This would be very useful here, as it should allow us to say that we don't know how many results there will be. However most of the webscripts don't support a range, and so this leads to some odd results in Share (e.g. 'Showing results 1 to 50 of -1'). git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@108482 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- ...gResultsPostMethodInvocationProcessor.java | 51 +++++++++---------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/interceptor/processor/PagingResultsPostMethodInvocationProcessor.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/interceptor/processor/PagingResultsPostMethodInvocationProcessor.java index 0027a44c05..407042c326 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/interceptor/processor/PagingResultsPostMethodInvocationProcessor.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/interceptor/processor/PagingResultsPostMethodInvocationProcessor.java @@ -18,8 +18,6 @@ */ package org.alfresco.module.org_alfresco_module_rm.classification.interceptor.processor; -import static org.apache.commons.collections.ListUtils.isEqualList; - import java.util.List; import org.alfresco.query.PagingResults; @@ -60,34 +58,31 @@ public class PagingResultsPostMethodInvocationProcessor extends BasePostMethodIn List page = pagingResults.getPage(); final List processedPage = getPostMethodInvocationProcessor().process(page); - if (!isEqualList(page, processedPage)) + result = (T) new PagingResults() { - result = (T) new PagingResults() + @Override + public String getQueryExecutionId() { - @Override - public String getQueryExecutionId() - { - return pagingResults.getQueryExecutionId(); - } - @Override - public List getPage() - { - return processedPage; - } - @Override - public boolean hasMoreItems() - { - // hasMoreItems might not be correct. Cannot determine the correct value as request details are needed. - return pagingResults.hasMoreItems(); - } - @Override - public Pair getTotalResultCount() - { - int size = processedPage.size(); - return new Pair(size, size); - } - }; - } + return pagingResults.getQueryExecutionId(); + } + @Override + public List getPage() + { + return processedPage; + } + @Override + public boolean hasMoreItems() + { + // hasMoreItems might not be correct. Cannot determine the correct value as request details are needed. + return pagingResults.hasMoreItems(); + } + @Override + public Pair getTotalResultCount() + { + // getTotalResultCount may not be correct. We haven't checked how many other results will be filtered. + return pagingResults.getTotalResultCount(); + } + }; } return result;