Working with Lists, Paging and Skipping

Iterating over a List

The following code snippets iterate over the complete list. Please note, that OpenCMIS and PortCMIS may make multiple calls to the repository.

OpenCMIS (Java)

ItemIterable<Something> somethingList = ...

for (Something something : somethingList) {
    ...
}

PortCMIS (C#)

IItemEnumerable<Something> somethingList = ...

foreach (Something something in somethingList) {
    ...
}

Paging and Skipping

Clients can request only an excerpt of a list by defining an offset and/or a page size.

Note

For the best performance adjust the list batch size with an Operation Context.

OpenCMIS (Java)

ItemIterable<Something> somethingList = ...

// get a page of 5 items
ItemIterable<Something> firstFive = somethingList.getPage(5);

// get a list starting with the 10th item
ItemIterable<Something> skipTen = somethingList.skipTo(10);

// get a page of 20 items starting at the 100th item of the orignal list
ItemIterable<Something> skipAndPage = somethingList.skipTo(100).getPage(20);

PortCMIS (C#)

IItemEnumerable<Something> somethingList = ...

// get a page of 5 items
IItemEnumerable<Something> firstFive = somethingList.GetPage(5);

// get a list starting with the 10th item
IItemEnumerable<Something> skipTen = somethingList.SkipTo(10);

// get a page of 20 items starting at the 100th item of the orignal list
IItemEnumerable<Something> skipAndPage = somethingList.SkipTo(100).GetPage(20);