cancel
Showing results for 
Search instead for 
Did you mean: 

limit the number of children in the folder.getChildren call

jeffreydare
Champ in-the-making
Champ in-the-making
Hey!

I have a need in my project, where I just need a limited number of children to be returned when the getChildren() is called.

I was directly using CMIS api before, where in the navigationService.getChildren provided an option to limit the number of children fetched.

Now we moved to the openCMIS, where I'm using folder.getChildren() API. But this does not provide an option to limit the number of results. (I tried setting the maxitemsPerPage on operationContext. It just sets the number of items fetched per page. Does not help)

Can anyone plz help me, if its possible to limit the number of results?

Thanks!
Jeff
3 REPLIES 3

janv
Employee
Employee
Are you trying to get a single set of results with an upper limit on the number of results (ie. you're not interested in paging through) ?

If so then you should be able to treat that call as a single "page", ie. set skipCount to 0 and maxItemsPerPage as the upper limit …

Regards,
Jan

jeffreydare
Champ in-the-making
Champ in-the-making
Thanks for your reply. But, I tried another way, this also worked.

    

       ItemIterable<CmisObject> children = folder.getChildren();
       children = children.getPage(50);


Now, the children just returns 50 objects.

Can you please confirm, if this is a Ok??

Thanks!
Jeff

janv
Employee
Employee
FYI, see also:

http://chemistry.apache.org/java/examples/example-list-folder.html

with:

int maxItemsPerPage = 50;
int skipCount = 0;

Regards,
Jan