Example usage for com.google.gwt.gdata.client.blogger BlogCommentFeedCallback BlogCommentFeedCallback

List of usage examples for com.google.gwt.gdata.client.blogger BlogCommentFeedCallback BlogCommentFeedCallback

Introduction

In this page you can find the example usage for com.google.gwt.gdata.client.blogger BlogCommentFeedCallback BlogCommentFeedCallback.

Prototype

BlogCommentFeedCallback

Source Link

Usage

From source file:com.google.gwt.gdata.sample.hellogdata.client.BloggerDeleteBlogPostCommentDemo.java

License:Apache License

/**
 * Retrieve the Blogger comments feed using the Blogger service and
 * the comments feed uri for a given post.
 * On success, identify the first comment entry with a title starting
 * with "GWT-Blogger-Client", this will be the comment that will be deleted.
 * If no comment is found, display a message.
 * Otherwise call deleteComment to delete the comment. Alternatively
 * we could also have used targetComment.deleteEntry to
 * delete the comment, but the effect is the same.
 * /*www. j  a va  2  s. com*/
 * @param commentsFeedUri The comments feed uri for a given post
 */
private void getComments(String commentsFeedUri) {
    showStatus("Loading Blogger post comments feed...", false);
    service.getBlogCommentFeed(commentsFeedUri, new BlogCommentFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus(
                    "An error occurred while retrieving the Blogger Comments " + "feed: " + caught.getMessage(),
                    true);
        }

        public void onSuccess(BlogCommentFeed result) {
            if (result.getEntries().length == 0) {
                showStatus("The target blog post has no comments.", false);
            } else {
                // get the first comment that matches
                CommentEntry targetComment = null;
                for (CommentEntry comment : result.getEntries()) {
                    String title = comment.getTitle().getText();
                    if (title.startsWith("GWT-Blogger-Client")) {
                        targetComment = comment;
                        break;
                    }
                }
                if (targetComment == null) {
                    showStatus("Did not find a comment entry whose title starts "
                            + "with the prefix 'GWT-Blogger-Client'.", false);
                } else {
                    deleteComment(targetComment.getSelfLink().getHref());
                }
            }
        }
    });
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.BloggerRetrieveBlogPostCommentsDemo.java

License:Apache License

/**
 * Retrieve the Blogger comments feed using the Blogger service and
 * the comments feed uri for a given post.
 * On success, call showData to display the comments to the user.
 * If no comments are available, display a message.
 * //from   w w  w .  j av  a  2  s.  c  o m
 * @param commentsFeedUri The comments feed uri for a given post
 */
private void getComments(String commentsFeedUri) {
    showStatus("Loading comments feed...", false);
    service.getBlogCommentFeed(commentsFeedUri, new BlogCommentFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus(
                    "An error occurred while retrieving the Blogger " + "Comments feed: " + caught.getMessage(),
                    true);
        }

        public void onSuccess(BlogCommentFeed result) {
            if (result.getEntries().length == 0) {
                showStatus("The target blog post has no comments.", false);
            } else {
                showData(result.getEntries());
            }
        }
    });
}