Example usage for org.springframework.social.facebook.api FqlResult getString

List of usage examples for org.springframework.social.facebook.api FqlResult getString

Introduction

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

Prototype

public String getString(String fieldName) 

Source Link

Document

Returns the value of the identified field as a String.

Usage

From source file:com.seajas.search.codex.service.social.SocialProfileServiceTest.java

@Test
@Ignore("resolves internet content")
public void shouldGetFacebookPage() throws Exception {

    Facebook f = new FacebookTemplate(
            "AAAGsPMuLCa0BAAN2TxBMTWDaLFBMY8UJfLqY5R9qycuFcGzTpSD7HBKgaqzfKBxtudxpEeKXXLpypwSBwxD0gZC2gHk6yLXndRGbXJwZDZD");

    FqlResultMapper<FacebookProfile> objectFqlResultMapper = new FqlResultMapper<FacebookProfile>() {
        @Override/*from   w  w w .j a  v  a2  s  .com*/
        public FacebookProfile mapObject(FqlResult objectValues) {
            String id = objectValues.getString("page_id");
            String username = objectValues.getString("username");
            String name = objectValues.getString("name");
            String firstName = objectValues.getString("first_name");
            String lastName = objectValues.getString("last_name");
            String gender = null;
            System.out.println(objectValues.getString("about"));

            return new FacebookProfile(id, username, name, firstName, lastName, gender, null);
        }
    };
    List<FacebookProfile> query = f.fqlOperations().query(
            "SELECT page_id, name, pic_small, pic_big, pic_square, pic, username, location, about FROM page where page_id in ('144938055520551', '132168606820734')",
            objectFqlResultMapper);

    for (FacebookProfile facebookProfile : query) {
        SocialProfileDto translate = SocialProfileDto.translate(facebookProfile);

        System.out.println("translate = " + translate);

    }
}