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

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

Introduction

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

Prototype

public final native void setPublishedMax(DateTime publishedMax) ;

Source Link

Document

Sets the maximum published date.

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 w w w . ja  va 2 s.com
 * @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());
        }
    });
}