Example usage for com.google.gwt.gdata.client.sidewiki SidewikiEntryQuery newInstance

List of usage examples for com.google.gwt.gdata.client.sidewiki SidewikiEntryQuery newInstance

Introduction

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

Prototype

public static native SidewikiEntryQuery newInstance(String feedUri) ;

Source Link

Document

Constructs a SidewikiEntryQuery.

Usage

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

License:Apache License

/**
 * Retrieves a Sidewiki entry feed using a Query object.
 * In GData, feed URIs can contain query string parameters. The
 * GData query objects aid in building parameterized feed URIs.
 * Upon successfully receiving the entries feed, we obtain the
 * first author of the first entry and query for Sidewiki entries
 * by that author.//from  ww  w  .j  a v a 2 s  . c om
 * 
 * @param entriesFeedUri The items feed uri.
 */
private void queryEntries(String entriesFeedUri) {
    showStatus("Loading entries feed...", false);
    SidewikiEntryQuery query = SidewikiEntryQuery.newInstance(entriesFeedUri);
    query.setMaxResults(25);
    service.getSidewikiEntryFeed(query, new SidewikiEntryFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the entries feed: " + caught.getMessage(), true);
        }

        public void onSuccess(SidewikiEntryFeed result) {
            SidewikiEntry[] entries = result.getEntries();
            if (entries.length == 0) {
                showStatus("No entries matched the search criteria.", false);
            } else {
                SidewikiAuthor author = (SidewikiAuthor) entries[0].getAuthors()[0];
                queryEntriesByAuthor(author.getResourceId().getValue());
            }
        }
    });
}

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

License:Apache License

/**
 * Retrieves a Sidewiki entry feed using a Query object.
 * In GData, feed URIs can contain query string parameters. The
 * GData query objects aid in building parameterized feed URIs.
 * Upon successfully receiving the entries feed, the entries 
 * are displayed to the user via the showData method.
 * //w ww.  j a  v a  2  s.  co m
 * @param entriesFeedUri The items feed uri.
 */
private void queryEntriesByAuthor(String authorId) {
    showStatus("Querying entries by author...", false);
    String feedUri = "http://www.google.com/sidewiki/feeds/entries/author/" + authorId + "/full";
    SidewikiEntryQuery query = SidewikiEntryQuery.newInstance(feedUri);
    query.setMaxResults(25);
    service.getSidewikiEntryFeed(query, new SidewikiEntryFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the entries feed: " + caught.getMessage(), true);
        }

        public void onSuccess(SidewikiEntryFeed result) {
            SidewikiEntry[] entries = result.getEntries();
            if (entries.length == 0) {
                showStatus("No entries matched the search criteria.", false);
            } else {
                showData(entries);
            }
        }
    });
}

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

License:Apache License

/**
 * Retrieves a Sidewiki entry feed using a Query object.
 * In GData, feed URIs can contain query string parameters. The
 * GData query objects aid in building parameterized feed URIs.
 * Upon successfully receiving the entries feed, the entries 
 * are displayed to the user via the showData method.
 * /*  ww  w. jav a 2  s .co m*/
 * @param entriesFeedUri The items feed uri.
 */
private void queryEntries(String entriesFeedUri) {
    showStatus("Loading entries feed...", false);
    SidewikiEntryQuery query = SidewikiEntryQuery.newInstance(entriesFeedUri);
    query.setMaxResults(25);
    service.getSidewikiEntryFeed(query, new SidewikiEntryFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the entries feed: " + caught.getMessage(), true);
        }

        public void onSuccess(SidewikiEntryFeed result) {
            SidewikiEntry[] entries = result.getEntries();
            if (entries.length == 0) {
                showStatus("No entries matched the search criteria.", false);
            } else {
                showData(entries);
            }
        }
    });
}

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

License:Apache License

/**
 * Retrieves a Sidewiki entry feed using a Query object.
 * In GData, feed URIs can contain query string parameters. The
 * GData query objects aid in building parameterized feed URIs.
 * Upon successfully receiving the entries feed, the entries 
 * are displayed to the user via the showData method.
 * /*w w  w .j a va 2s  .c o m*/
 * @param entriesFeedUri The items feed uri.
 */
private void queryEntries(String entriesFeedUri) {
    showStatus("Loading entries feed...", false);
    SidewikiEntryQuery query = SidewikiEntryQuery.newInstance(entriesFeedUri);
    query.setMaxResults(25);
    service.getSidewikiEntryFeed(query, new SidewikiEntryFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the entries feed: " + caught.getMessage(), true);
        }

        public void onSuccess(SidewikiEntryFeed result) {
            SidewikiEntry[] entries = result.getEntries();
            if (entries.length == 0) {
                showStatus("You have no Sidewiki entries.", false);
            } else {
                showData(entries);
            }
        }
    });
}