Ejemplo n.º 1
0
 protected void extractData(
     final FacebookProfile profile, final JsonNode json, final String name) {
   final JsonNode data = (JsonNode) JsonHelper.getElement(json, name);
   if (data != null) {
     profile.addAttribute(name, JsonHelper.getElement(data, "data"));
   }
 }
Ejemplo n.º 2
0
 @Override
 protected FacebookProfile extractUserProfile(final String body) {
   final FacebookProfile profile = new FacebookProfile();
   final JsonNode json = JsonHelper.getFirstNode(body);
   if (json != null) {
     profile.setId(JsonHelper.getElement(json, "id"));
     for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) {
       profile.addAttribute(attribute, JsonHelper.getElement(json, attribute));
     }
     extractData(profile, json, FacebookAttributesDefinition.FRIENDS);
     extractData(profile, json, FacebookAttributesDefinition.MOVIES);
     extractData(profile, json, FacebookAttributesDefinition.MUSIC);
     extractData(profile, json, FacebookAttributesDefinition.BOOKS);
     extractData(profile, json, FacebookAttributesDefinition.LIKES);
     extractData(profile, json, FacebookAttributesDefinition.ALBUMS);
     extractData(profile, json, FacebookAttributesDefinition.EVENTS);
     extractData(profile, json, FacebookAttributesDefinition.GROUPS);
     extractData(profile, json, FacebookAttributesDefinition.MUSIC_LISTENS);
     extractData(profile, json, FacebookAttributesDefinition.PICTURE);
   }
   return profile;
 }