[
https://issues.apache.org/jira/browse/OLINGO-112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13866422#comment-13866422
]
Michael Bolz commented on OLINGO-112:
-------------------------------------
Hi Gaurav,
I just realised that the posted link to the [OData
documentation|http://www.odata.org/documentation/odata-v2-documentation/atom-format/#23_Representing_Collections_of_Entries]
was broken.
There is a good explanation about the concept of the {{next link}}.
The basic is as application to provide a link which correct set {{$skiptoken}}
to skip all elements which are displayed at the first page. As example if you
want 100 items on first page (with an id from 1 to 100 as key property) the
assumed {{$skiptoken}} would be {{101}}. Then the link with the
{{$skiptoken=101}} would skip all items till the item with the id {{101}} is
reached.
In the above mentioned {{ListProcessor}} the {{getSkipToken}} method is just a
generic to generate the _skip token_ for a generic _entity_ based on its _key
properties_. To compare with the above example (entity with {{id}} as key
property) it would just return the {{id}} of the entity which in this case
would be {{101}}.
{code}
private <T> String getSkipToken(final EdmEntitySet entitySet, final T data)
throws ODataException {
String skipToken = "";
for (final EdmProperty property :
entitySet.getEntityType().getKeyProperties()) {
final EdmSimpleType type = (EdmSimpleType) property.getType();
skipToken =
skipToken.concat(type.valueToString(valueAccess.getPropertyValue(data,
property),
EdmLiteralKind.DEFAULT, property.getFacets()));
}
return skipToken;
}
{code}
> how to do pagination
> --------------------
>
> Key: OLINGO-112
> URL: https://issues.apache.org/jira/browse/OLINGO-112
> Project: Olingo
> Issue Type: Wish
> Reporter: Gaurav Garg
> Assignee: Michael Bolz
>
> I want to implement the pagination in my olingo application in which first
> few records should be available and for next records there should be link
> available.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)