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