Exemplo 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"));
   }
 }
Exemplo n.º 2
0
 @Override
 public OkProfile extractUserProfile(String body) throws HttpAction {
   final OkProfile profile = newProfile();
   JsonNode userNode = JsonHelper.getFirstNode(body);
   if (userNode != null) {
     profile.setId(JsonHelper.getElement(userNode, OkProfileDefinition.UID));
     for (final String attribute : getPrimaryAttributes()) {
       convertAndAdd(profile, attribute, JsonHelper.getElement(userNode, attribute));
     }
   }
   return profile;
 }
Exemplo n.º 3
0
 @Override
 protected OkProfile extractUserProfile(String body) {
   final OkProfile profile = new OkProfile();
   JsonNode userNode = JsonHelper.getFirstNode(body);
   if (userNode != null) {
     profile.setId(JsonHelper.getElement(userNode, OkAttributesDefinition.UID));
     for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) {
       profile.addAttribute(attribute, JsonHelper.getElement(userNode, attribute));
     }
   }
   return profile;
 }
Exemplo n.º 4
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;
 }