Example usage for org.springframework.social.facebook.api PagedList PagedList

List of usage examples for org.springframework.social.facebook.api PagedList PagedList

Introduction

In this page you can find the example usage for org.springframework.social.facebook.api PagedList PagedList.

Prototype

public PagedList(List<T> unpagedList, PagingParameters previousPage, PagingParameters nextPage,
            Integer totalCount) 

Source Link

Usage

From source file:org.springframework.social.facebook.api.impl.FriendTemplate.java

public PagedList<String> getFriendIds(String userId) {
    URI uri = URIBuilder.fromUri(GraphApi.GRAPH_API_URL + userId + "/friends").queryParam("fields", "id")
            .build();/*from  ww w  .j a  va  2  s  .  c  o  m*/
    JsonNode responseNode = restTemplate.getForObject(uri, JsonNode.class);
    ArrayNode dataNode = (ArrayNode) responseNode.get("data");
    List<String> idList = new ArrayList<String>(dataNode.size());
    for (JsonNode entryNode : dataNode) {
        idList.add(entryNode.get("id").textValue());
    }

    Integer totalCount = responseNode.has("summary") && responseNode.get("summary").has("total_count")
            ? responseNode.get("summary").get("total_count").asInt()
            : null;
    return new PagedList<String>(idList, null, null, totalCount);
}