From 04cedeb68c5dcceab9073cad8058670988456952 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Thu, 9 Jun 2011 14:51:24 +0000 Subject: [PATCH] Update the generic paging json ready for integration with PagingResults (when merged) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28311 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/util/ScriptPagingDetails.java | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/source/java/org/alfresco/util/ScriptPagingDetails.java b/source/java/org/alfresco/util/ScriptPagingDetails.java index 88a8be36b4..8b87cb2ed5 100644 --- a/source/java/org/alfresco/util/ScriptPagingDetails.java +++ b/source/java/org/alfresco/util/ScriptPagingDetails.java @@ -12,10 +12,20 @@ package org.alfresco.util; */ public class ScriptPagingDetails { - private int totalItems = -1; - private int maxItems = -1; // TODO To PagingRequest + public enum ItemsSizeConfidence { + EXACT, + RANGE, + AT_LEAST, + UNKNOWN + }; + private int skipCount = -1; // TODO To PagingRequest private String queryExecutionId = null; // TODO To PagingRequest + private int maxItems = -1; // TODO To PagingRequest + + private int totalItems = -1; + private int totalItemsRangeMax = -1; + private ItemsSizeConfidence confidence = ItemsSizeConfidence.UNKNOWN; public ScriptPagingDetails() {} public ScriptPagingDetails(int maxItems, int skipCount) @@ -29,6 +39,15 @@ public class ScriptPagingDetails this.queryExecutionId = queryExecutionId; } + public ItemsSizeConfidence getConfidence() + { + return confidence; + } + + /** + * Get the total number of items. See {@link #getConfidence()} for an idea + * of the accuracy/confidence on this value. + */ public int getTotalItems() { return totalItems; @@ -36,6 +55,24 @@ public class ScriptPagingDetails public void setTotalItems(int totalItems) { this.totalItems = totalItems; + + if(totalItems >= 0) + { + this.confidence = ItemsSizeConfidence.EXACT; + } + else + { + this.confidence = ItemsSizeConfidence.UNKNOWN; + } + } + + /** + * Where the confidence is {@link ItemsSizeConfidence#RANGE}, returns + * the upper bound of the range. + */ + public int getTotalItemsRangeMax() + { + return totalItemsRangeMax; } public int getMaxItems()