Example usage for com.google.gwt.gdata.client.contacts ContactGroupEntry getEditLink

List of usage examples for com.google.gwt.gdata.client.contacts ContactGroupEntry getEditLink

Introduction

In this page you can find the example usage for com.google.gwt.gdata.client.contacts ContactGroupEntry getEditLink.

Prototype

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

Source Link

Document

Returns the link that provides the URI that can be used to edit the entry.

Usage

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

License:Apache License

/**
 * Retrieve the contact groups feed using the Contacts service and
 * the contact groupd feed uri./*from   w  w  w  .j  a  v a  2 s. c o m*/
 * On success, identify the first group entry with a title starting
 * with "GWT-Contacts-Client", this is the group that will be deleted.
 * If no contact group is found, display a message.
 * Otherwise call deleteContactGroup to delete the group entry.
 * Alternatively we could also have used deleteContactGroup.deleteEntry to
 * delete the contact group, but the effect is the same.
 * 
 * @param contactGroupsFeedUri The contact groups feed uri
 */
private void getContactGroups(String contactGroupsFeedUri) {
    showStatus("Loading contact groups feed...", false);
    service.getContactGroupFeed(contactGroupsFeedUri, new ContactGroupFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus(
                    "An error occurred while retrieving the contact groups " + "feed: " + caught.getMessage(),
                    true);
        }

        public void onSuccess(ContactGroupFeed result) {
            ContactGroupEntry[] entries = result.getEntries();
            ContactGroupEntry targetGroup = null;
            for (ContactGroupEntry group : entries) {
                String title = group.getTitle().getText();
                if (title.startsWith("GWT-Contacts-Client")) {
                    targetGroup = group;
                    break;
                }
            }
            if (targetGroup == null) {
                showStatus("No contacts were found with a title starting with " + "'GWT-Contacts-Client'.",
                        false);
            } else {
                String contactGroupEntryUri = targetGroup.getEditLink().getHref();
                deleteContactGroup(contactGroupEntryUri, targetGroup.getEtag());
            }
        }
    });
}