mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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
This commit is contained in:
@@ -12,10 +12,20 @@ package org.alfresco.util;
|
|||||||
*/
|
*/
|
||||||
public class ScriptPagingDetails
|
public class ScriptPagingDetails
|
||||||
{
|
{
|
||||||
private int totalItems = -1;
|
public enum ItemsSizeConfidence {
|
||||||
private int maxItems = -1; // TODO To PagingRequest
|
EXACT,
|
||||||
|
RANGE,
|
||||||
|
AT_LEAST,
|
||||||
|
UNKNOWN
|
||||||
|
};
|
||||||
|
|
||||||
private int skipCount = -1; // TODO To PagingRequest
|
private int skipCount = -1; // TODO To PagingRequest
|
||||||
private String queryExecutionId = null; // 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() {}
|
||||||
public ScriptPagingDetails(int maxItems, int skipCount)
|
public ScriptPagingDetails(int maxItems, int skipCount)
|
||||||
@@ -29,6 +39,15 @@ public class ScriptPagingDetails
|
|||||||
this.queryExecutionId = queryExecutionId;
|
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()
|
public int getTotalItems()
|
||||||
{
|
{
|
||||||
return totalItems;
|
return totalItems;
|
||||||
@@ -36,6 +55,24 @@ public class ScriptPagingDetails
|
|||||||
public void setTotalItems(int totalItems)
|
public void setTotalItems(int totalItems)
|
||||||
{
|
{
|
||||||
this.totalItems = 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()
|
public int getMaxItems()
|
||||||
|
Reference in New Issue
Block a user