Example usage for org.springframework.social.facebook.api Facebook feedOperations

List of usage examples for org.springframework.social.facebook.api Facebook feedOperations

Introduction

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

Prototype

FeedOperations feedOperations();

Source Link

Document

API for performing operations on feeds.

Usage

From source file:architecture.ee.web.community.spring.controller.FacebookController.java

@RequestMapping(value = "/notes.json", method = RequestMethod.POST)
@ResponseBody//w w w .j ava2  s  .  com
public PagedList<NotePost> getNotes() throws Exception {
    SocialConnect account = getSocialConnect(SecurityHelper.getUser(), Media.FACEBOOK);
    Facebook api = (Facebook) account.getConnection().getApi();
    return api.feedOperations().getNotes();
}

From source file:architecture.ee.web.community.spring.controller.FacebookController.java

@RequestMapping(value = "/homefeed.json", method = RequestMethod.POST)
@ResponseBody/*from  www . j  a  v  a  2 s  . c  o  m*/
public PagedList<Post> getHomeFeed(NativeWebRequest request) throws Exception {
    SocialConnectController.setOutputFormat(request);
    SocialConnect account = getSocialConnect(SecurityHelper.getUser(), Media.FACEBOOK);
    Facebook api = (Facebook) account.getConnection().getApi();
    return api.feedOperations().getHomeFeed();
}

From source file:architecture.ee.web.community.spring.controller.FacebookController.java

@RequestMapping(value = "/feed.json", method = RequestMethod.POST)
@ResponseBody// w  ww.  j a va2s.c om
public List<Post> getFeed(@RequestParam(value = "userId", defaultValue = "", required = false) String userId)
        throws Exception {
    SocialConnect account = getSocialConnect(SecurityHelper.getUser(), Media.FACEBOOK);
    Facebook api = (Facebook) account.getConnection().getApi();
    if (StringUtils.isNotBlank(userId))
        return api.feedOperations().getFeed(userId);
    else
        return api.feedOperations().getFeed();
}

From source file:com.bg.jtown.social.facebook.PostToWallAfterSignInInterceptor.java

public void postConnect(Connection<Facebook> connection, WebRequest request) {
    try {/*from  w w w.j a v a2  s. c om*/
        Facebook facebook = connection.getApi();
        FacebookProfile fp = facebook.userOperations().getUserProfile();

        String username = fp.getEmail();
        Boolean facebookFeed = loginService.selectFacebookFeed(username);
        if (facebookFeed != null && facebookFeed) {
            String message = fp.getName()
                    + "? (Mirros) :: ? ? ? .";
            //      String sex = fp.getGender().equals("male") ? "2" : "1";
            FacebookLink link = new FacebookLink("https://www.mirros.net",
                    " :: ? ? ", "",
                    "?  ? .\n?  ,   ? ?!");
            facebook.feedOperations().postLink(message, link);
        }
    } catch (OperationNotPermittedException e) {
        Facebook facebook = connection.getApi();
        FacebookProfile fp = facebook.userOperations().getUserProfile();
        String username = fp.getEmail();
        JtownUser jtownUser = new JtownUser();
        jtownUser.setUsername(username);
        loginService.updateFacebookFeed(jtownUser);
    } catch (ApiException e) {
        e.printStackTrace();
        logger.debug("PostConnect Catch");
    }
}

From source file:com.bg.jtown.social.facebook.PostToWallAfterConnectInterceptor.java

public void postConnect(Connection<Facebook> connection, WebRequest request) {

    try {/*from w w  w. j a  v  a 2  s  . c om*/
        Facebook facebook = connection.getApi();
        FacebookProfile fp = facebook.userOperations().getUserProfile();

        String username = fp.getEmail();
        Boolean facebookFeed = loginService.selectFacebookFeed(username);
        if (facebookFeed != null && facebookFeed) {
            String message = fp.getName()
                    + "? (Mirros) :: ? ? ? .";
            // String sex = fp.getGender().equals("male") ? "2" : "1";
            FacebookLink link = new FacebookLink("https://www.mirros.net",
                    " :: ? ? ", "",
                    "?  ? .\n?  ,   ? ?!");

            facebook.feedOperations().postLink(message, link);
        }
    } catch (OperationNotPermittedException e) {
        Facebook facebook = connection.getApi();
        FacebookProfile fp = facebook.userOperations().getUserProfile();
        String username = fp.getEmail();
        JtownUser jtownUser = new JtownUser();
        jtownUser.setUsername(username);
        loginService.updateFacebookFeed(jtownUser);
    } catch (ApiException e) {
        logger.debug("PostConnect Catch");
    }
}