Example usage for org.springframework.social.facebook.api Reference getName

List of usage examples for org.springframework.social.facebook.api Reference getName

Introduction

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

Prototype

public String getName() 

Source Link

Usage

From source file:org.easit.core.controllers.facebook.FacebookFriendsController.java

@RequestMapping(value = "/facebook/addFriend/{userId}", method = RequestMethod.POST)
public String addFriend(@PathVariable("userId") String userId, HttpSession session) {
    String web_name = session.getAttribute("web_name").toString();
    String listId = null;// w w  w.j  ava  2  s . c om
    List<Reference> fl = facebook.friendOperations().getFriendLists();
    for (Reference fl_exists : fl) {
        if (fl_exists.getName().equals(web_name)) {
            listId = fl_exists.getId();
            break;
        }
    }
    if (listId == null) {
        listId = facebook.friendOperations().createFriendList(web_name);
    }
    facebook.friendOperations().addToFriendList(listId, userId);
    return "redirect:/facebook/friends";
}