// 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) {