Package com.restfb.types

Examples of com.restfb.types.Post


    expect(
        mockFbClient.publishObject(connection, FacebookType.class,
            arrayParams)).andReturn(mockFbType);
    expect(mockFbType.getId()).andReturn(POST_FBID);

    Post expectedPost = loadObjectFromJSON("/examples/post.json",
        Post.class);
    expect(mockFbClient.getFacebookObjectByID(POST_FBID, Post.class))
        .andReturn(expectedPost);
    // post comments
    expect(
View Full Code Here


  }

  public void testGetContent() throws IOException {
    String contentUrl = "facebook/accessTokenKey/fbid/post";

    Post expectedPost = loadObjectFromJSON("/examples/post.json",
        Post.class);

    // expected behavior
    // expect(mockFactory.createFacebookAPIClient(EasyMock.anyObject(String.class))).andReturn(mockFbClient);
    expect(mockFbClient.getFacebookObjectByID("fbid", Post.class))
View Full Code Here

        // Check if the post (to which the notification refers to) is
        // mine
        String[] linkPathSplitted = notif.getLink().split("/");
        String postId = notif.getTo().getId() + "_"
            + linkPathSplitted[linkPathSplitted.length - 1];
        Post p = facebookClient.fetchObject(postId, Post.class);
        if (p == null) {
          // If the post is not mine then 'p' is null and we jump to
          // the next notification
          continue;
        }
        // Get comment id
        String comment_id = getCommentId(p, notif);
        /*
         * We don't handle when comment_id is null, that would mean one
         * of two: a) the information of the notification is wrong. b)
         * we are retrieving wrongly the post id from the notification
         * information.
         */
        // Get replier's screen name
        String replierScreenName = facebookClient.fetchObject(
            notif.getFrom().getId(), User.class).getUsername();
        // Construct facebook post object and return
        FacebookMention fbp = new FacebookMention(comment_id.toString(),
            notif.getMessage(), replierScreenName, notif
                .getCreatedTime().getTime(), p.getId());
        postReplies.add(fbp);
        Boolean publishMessageResponse = facebookClient.publish(
            notif.getId(), Boolean.class,
            Parameter.with("unread", "0"));
        if (publishMessageResponse == false) {
View Full Code Here

  @Override
  public Long getTime(String mentionId) {
    LOG.info("Start getTime");
    Long time = null;
    if (mentionId != null) {
      Post p = facebookClient.fetchObject(mentionId, Post.class);
      if (p == null) {
        Comment c = facebookClient
            .fetchObject(mentionId, Comment.class);
        if (c == null) {
          LOG.info("Facebook object [" + mentionId
              + "] is not a valid post/comment");
        } else {
          LOG.info("Facebook object [" + mentionId + "] is comment");
          time = c.getCreatedTime() == null ? null : c
              .getCreatedTime().getTime() / 1000L;
        }
      } else {
        LOG.info("Facebook object [" + mentionId + "] is post");
        time = p.getCreatedTime() == null ? null : p.getCreatedTime()
            .getTime() / 1000L;
      }
    }
    LOG.info("End getTime");
    return time;
View Full Code Here

TOP

Related Classes of com.restfb.types.Post

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.