[ 
https://issues.apache.org/jira/browse/OLINGO-112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13865463#comment-13865463
 ] 

Michael Bolz edited comment on OLINGO-112 at 1/9/14 7:40 AM:
-------------------------------------------------------------

Hi Gaurav,

I think you mean the support of next link (as described in the [OData 
documentation|http://www.odata.org/documentation/odata-v2-documentation/atom-format/#23_Representing_Collections_of_Entries]).

An example how to implement this feature can be found in the 
{{readEntitySet(...)}} method of the 
{{com.sap.core.odata.ref.processor.ListsProcessor}} in the reference scenario.

The main point for an implementation are: 
# check if PAGING_SIZE is reached
# Create the next link which contains {{$skiptoken}} and {{$inlinecount}}
# Set the created next link at the {{EntityProviderProperties}}

{code}
    String nextLink = null;
    // PAGING_SIZE is reached 
    if (data.size() > SERVER_PAGING_SIZE
        ....) {

      final EdmEntityContainer entityContainer = entitySet.getEntityContainer();
      // create next link
      nextLink = (entityContainer.isDefaultEntityContainer() ? "" : 
entityContainer.getName() + Edm.DELIMITER)
          + entitySet.getName()
          + "?$skiptoken=" + getSkipToken(entitySet, 
data.get(SERVER_PAGING_SIZE))
          + (inlineCountType == null ? "" : "&$inlinecount=" + 
inlineCountType.toString().toLowerCase(Locale.ROOT));
      ....
    }

    .....

    // create properties with next link
    final EntityProviderProperties feedProperties = EntityProviderProperties
        .serviceRoot(context.getPathInfo().getServiceRoot())
        .inlineCountType(inlineCountType)
        .inlineCount(count)
        .nextLink(nextLink)
        .build();
{code}

I hope this helps you otherwise feel free to ask again.

Kind regards,
Michael


was (Author: mirbo):
Hi Gaurav,

I think you mean the support of next link (as described in the [[OData 
documentationhttp://www.odata.org/documentation/odata-v2-documentation/atom-format/#23_Representing_Collections_of_Entries]]).

An example how to implement this feature can be found in the 
{{readEntitySet(...)}} method of the 
{{com.sap.core.odata.ref.processor.ListsProcessor}} in the reference scenario.

The main point for an implementation are: 
# check if PAGING_SIZE is reached
# Create the next link which contains {{$skiptoken}} and {{$inlinecount}}
# Set the created next link at the {{EntityProviderProperties}}

{code}
    String nextLink = null;
    // PAGING_SIZE is reached 
    if (data.size() > SERVER_PAGING_SIZE
        ....) {

      final EdmEntityContainer entityContainer = entitySet.getEntityContainer();
      // create next link
      nextLink = (entityContainer.isDefaultEntityContainer() ? "" : 
entityContainer.getName() + Edm.DELIMITER)
          + entitySet.getName()
          + "?$skiptoken=" + getSkipToken(entitySet, 
data.get(SERVER_PAGING_SIZE))
          + (inlineCountType == null ? "" : "&$inlinecount=" + 
inlineCountType.toString().toLowerCase(Locale.ROOT));
      ....
    }

    .....

    // create properties with next link
    final EntityProviderProperties feedProperties = EntityProviderProperties
        .serviceRoot(context.getPathInfo().getServiceRoot())
        .inlineCountType(inlineCountType)
        .inlineCount(count)
        .nextLink(nextLink)
        .build();
{code}

I hope this helps you otherwise feel free to ask again.

Kind regards,
Michael

> 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)

Reply via email to