Example usage for com.google.gwt.gdata.client.blogger BlogPostQuery newInstance

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

Introduction

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

Prototype

public static native BlogPostQuery newInstance(String feedUri) ;

Source Link

Document

Constructs a blog post query.

Usage

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

License:Apache License

/**
 * Retrieves a posts feed for a blog using a Query object.
 * In GData, feed URIs can contain querystring parameters. The
 * GData query objects aid in building parameterized feed URIs.
 * Upon successfully receiving the posts feed, the post entries 
 * are displayed to the user via the showData method.
 * The PublishedMin and PublishedMax parameters are used to
 * limit the range of posts to a given publishing period.
 * //from  ww  w.j  a v a2 s. c  o  m
 * @param postsFeedUri The posts feed uri for a given blog.
 */
@SuppressWarnings("deprecation")
private void queryPosts(String postsFeedUri) {
    final BlogPostQuery query = BlogPostQuery.newInstance(postsFeedUri);
    Date minDate = new Date();
    minDate.setMonth(minDate.getMonth() - 1);
    query.setPublishedMin(DateTime.newInstance(minDate));
    query.setPublishedMax(DateTime.newInstance(new Date()));
    showStatus("Querying Blogger for posts...", false);
    service.getBlogPostFeed(query, new BlogPostFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while querying Blogger for Posts: " + caught.getMessage(), true);
        }

        public void onSuccess(BlogPostFeed result) {
            showData(result.getEntries());
        }
    });
}