List of usage examples for com.google.gwt.gdata.client.blogger PostEntry getRepliesLink
public final native BloggerLink getRepliesLink() ;
From source file:com.google.gwt.gdata.sample.hellogdata.client.BloggerCreateBlogPostCommentDemo.java
License:Apache License
/** * Retrieve the Blogger posts feed using the Blogger service and * the posts feed uri for a given blog./* www. j a v a 2 s . com*/ * On success, identify the first post entry that is available * for commenting, this will be the post entry that we'll * reply to. * If no posts are available for commenting, display a message. * Otherwise extract the blog and post ID and call insertComment * to add a comment. * If the regular expression parsing of the blog and post IDs * fails, display a message. * * @param postsFeedUri The posts feed uri for a given blog */ private void getPosts(String postsFeedUri) { showStatus("Loading posts feed...", false); service.getBlogPostFeed(postsFeedUri, new BlogPostFeedCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while retrieving the Blogger Posts " + "feed: " + caught.getMessage(), true); } public void onSuccess(BlogPostFeed result) { PostEntry targetPost = null; // get the first public post for (PostEntry post : result.getEntries()) { if (post.getRepliesLink() != null) { targetPost = post; break; } } if (targetPost == null) { showStatus("The target blog contains no public posts.", false); } else { String postEntryId = targetPost.getId().getValue(); JsArrayString match = regExpMatch("blog-(\\d+)\\.post-(\\d+)", postEntryId); if (match.length() > 1) { insertComment(match.get(1), match.get(2)); } else { showStatus("Error parsing the blog post id.", true); } } } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.BloggerDeleteBlogPostCommentDemo.java
License:Apache License
/** * Retrieve the Blogger posts feed using the Blogger service and * the posts feed uri for a given blog./*from w ww . j a va2 s. c om*/ * On success, identify the first post entry that is available * for commenting, this will be the post entry for which a comment * will be deleted. * If no posts are available for commenting, display a message. * Otherwise call getComments to retrieve the comments feed * for the target post. * * @param postsFeedUri The posts feed uri for a given blog */ private void getPosts(String postsFeedUri) { showStatus("Loading posts feed...", false); service.getBlogPostFeed(postsFeedUri, new BlogPostFeedCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while retrieving the Blogger Posts " + "feed: " + caught.getMessage(), true); } public void onSuccess(BlogPostFeed result) { PostEntry targetPost = null; // get the first public post for (PostEntry post : result.getEntries()) { if (post.getRepliesLink() != null) { targetPost = post; break; } } if (targetPost == null) { showStatus("The target blog contains no public posts.", false); } else { String commentsFeedUri = targetPost.getRepliesLink().getHref(); getComments(commentsFeedUri); } } }); }