Example usage for com.google.gwt.gdata.client.maps MapEntry getSelfLink

List of usage examples for com.google.gwt.gdata.client.maps MapEntry getSelfLink

Introduction

In this page you can find the example usage for com.google.gwt.gdata.client.maps MapEntry getSelfLink.

Prototype

public final native com.google.gwt.gdata.client.Link getSelfLink() ;

Source Link

Document

Returns the link that provides the URI of the feed or entry.

Usage

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

License:Apache License

/**
 * Retrieve the maps feed using the Maps service and
 * the maps feed uri. In GData all get, insert, update
 * and delete methods always receive a callback defining
 * success and failure handlers./*from  w  w  w.j a va 2  s. c o  m*/
 * Here, the failure handler displays an error message while the
 * success handler obtains the first map entry with a title
 * starting with "GWT-Maps-Client" and calls deleteMap to
 * delete the map.
 * If no map is found, a message is displayed.
 * 
 * @param mapsFeedUri The uri of the map feed
 */
private void getMaps(String mapsFeedUri) {
    showStatus("Loading maps feed...", false);
    service.getMapFeed(mapsFeedUri, new MapFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the maps feed: " + caught.getMessage(), true);
        }

        public void onSuccess(MapFeed result) {
            MapEntry[] entries = result.getEntries();
            MapEntry targetMap = null;
            for (MapEntry entry : entries) {
                if (entry.getTitle().getText().startsWith("GWT-Maps-Client")) {
                    targetMap = entry;
                    break;
                }
            }
            if (targetMap == null) {
                showStatus("No map found that contains 'GWT-Maps-Client' in the title.", false);
            } else {
                String mapEntryUri = targetMap.getSelfLink().getHref();
                deleteMap(mapEntryUri);
            }
        }
    });
}