OpenCMIS Server: fixed getChildren paging

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29200 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Florian Mü
2011-07-19 16:17:43 +00:00
parent ca67fe0aff
commit eb819e72a4

View File

@@ -587,30 +587,20 @@ public class AlfrescoCmisService extends AbstractCmisService
}
}
PagingRequest pageRequest = new PagingRequest(skipCount.intValue(), maxItems.intValue(), null);
pageRequest.setRequestTotalCountMax(skipCount.intValue() + 1000); // TODO
// make
// this
PagingRequest pageRequest = new PagingRequest(skip, max, null);
pageRequest.setRequestTotalCountMax(skip + 10000); // TODO make this
// optional/configurable
// -
// affects
// whether
// numItems
// may
// be
// - affects whether
// numItems may be
// returned
PagingResults<FileInfo> pageOfNodeInfos = connector.getFileFolderService().list(folderNodeRef, true, true,
null, sortProps, pageRequest);
List<FileInfo> childrenList = pageOfNodeInfos.getPage();
if (max > 0)
{
int lastIndex = (max + skip > childrenList.size() ? childrenList.size() : max + skip) - 1;
for (int i = skip; i <= lastIndex; i++)
for (FileInfo child : pageOfNodeInfos.getPage())
{
FileInfo child = childrenList.get(i);
try
{
// create a child CMIS object
@@ -633,7 +623,6 @@ public class AlfrescoCmisService extends AbstractCmisService
// add it
list.add(childData);
} catch (InvalidNodeRefException e)
{
// ignore invalid children
@@ -658,8 +647,7 @@ public class AlfrescoCmisService extends AbstractCmisService
if (logger.isDebugEnabled())
{
logger.debug("getChildren: " + childrenList.size() + " in " + (System.currentTimeMillis() - start)
+ " msecs");
logger.debug("getChildren: " + list.size() + " in " + (System.currentTimeMillis() - start) + " msecs");
}
return result;