mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Follow on to r28317 - further tweaks for the extra json fields for new-style generic paging
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28318 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -39,9 +39,11 @@ public class ModelUtil
|
|||||||
private static final String SHARE = "Share";
|
private static final String SHARE = "Share";
|
||||||
private static final String TEAM = "Team";
|
private static final String TEAM = "Team";
|
||||||
|
|
||||||
public static final String PAGING_TOTAL_ITEMS = "totalItems";
|
|
||||||
public static final String PAGING_MAX_ITEMS = "maxItems";
|
public static final String PAGING_MAX_ITEMS = "maxItems";
|
||||||
public static final String PAGING_SKIP_COUNT = "skipCount";
|
public static final String PAGING_SKIP_COUNT = "skipCount";
|
||||||
|
public static final String PAGING_TOTAL_ITEMS = "totalItems";
|
||||||
|
public static final String PAGING_TOTAL_ITEMS_RANGE_END = "totalItemsRangeEnd";
|
||||||
|
public static final String PAGING_CONFIDENCE = "confidence";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the product currently running, determined
|
* Returns the name of the product currently running, determined
|
||||||
@@ -67,6 +69,34 @@ public class ModelUtil
|
|||||||
return productName;
|
return productName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns representation of paging object
|
||||||
|
*
|
||||||
|
* @param totalItems all count of object
|
||||||
|
* @param maxItems max count of object that should be returned
|
||||||
|
* @param skipCount count of skipped objects
|
||||||
|
* @param confidence the confidence in the total, default is exact
|
||||||
|
* @param totalItemsRangeEnd if the total is a range, what is the upper end of it
|
||||||
|
* @return A model map of the details
|
||||||
|
*/
|
||||||
|
public static Map<String, Object> buildPaging(int totalItems, int maxItems, int skipCount,
|
||||||
|
ScriptPagingDetails.ItemsSizeConfidence confidence, int totalItemsRangeEnd)
|
||||||
|
{
|
||||||
|
HashMap<String, Object> model = new HashMap<String, Object>();
|
||||||
|
if(confidence == null)
|
||||||
|
{
|
||||||
|
confidence = ScriptPagingDetails.ItemsSizeConfidence.EXACT;
|
||||||
|
}
|
||||||
|
|
||||||
|
model.put(PAGING_MAX_ITEMS, maxItems);
|
||||||
|
model.put(PAGING_SKIP_COUNT, skipCount);
|
||||||
|
model.put(PAGING_TOTAL_ITEMS, totalItems);
|
||||||
|
model.put(PAGING_TOTAL_ITEMS_RANGE_END, totalItemsRangeEnd);
|
||||||
|
model.put(PAGING_CONFIDENCE, confidence);
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns representation of paging object
|
* Returns representation of paging object
|
||||||
*
|
*
|
||||||
@@ -77,13 +107,7 @@ public class ModelUtil
|
|||||||
*/
|
*/
|
||||||
public static Map<String, Object> buildPaging(int totalItems, int maxItems, int skipCount)
|
public static Map<String, Object> buildPaging(int totalItems, int maxItems, int skipCount)
|
||||||
{
|
{
|
||||||
HashMap<String, Object> model = new HashMap<String, Object>();
|
return buildPaging(totalItems, maxItems, skipCount, null, -1);
|
||||||
|
|
||||||
model.put(PAGING_TOTAL_ITEMS, totalItems);
|
|
||||||
model.put(PAGING_MAX_ITEMS, maxItems);
|
|
||||||
model.put(PAGING_SKIP_COUNT, skipCount);
|
|
||||||
|
|
||||||
return model;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,7 +120,9 @@ public class ModelUtil
|
|||||||
return buildPaging(
|
return buildPaging(
|
||||||
paging.getTotalItems(),
|
paging.getTotalItems(),
|
||||||
paging.getMaxItems(),
|
paging.getMaxItems(),
|
||||||
paging.getSkipCount()
|
paging.getSkipCount(),
|
||||||
|
paging.getConfidence(),
|
||||||
|
paging.getTotalItemsRangeMax()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user