com.google.gwt.gdata.client.contacts.ContactsService.java Source code

Java tutorial

Introduction

Here is the source code for com.google.gwt.gdata.client.contacts.ContactsService.java

Source

/*
 * Copyright 2009 Google Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package com.google.gwt.gdata.client.contacts;

import com.google.gwt.gdata.client.GDataRequestParameters;
import com.google.gwt.gdata.client.GoogleService;

/**
 * Google Contacts service.
 */
public class ContactsService extends GoogleService {

    /**
     * Google Contacts service name.
     */
    public static final String SERVICE_NAME = getConstant("SERVICE_NAME");

    /**
     * Constructs a ContactsService object.
     * 
     * @param applicationName Name of application (used for tracking).
     * @return A ContactsService object.
     */
    public static native ContactsService newInstance(String applicationName) /*-{
                                                                             return new $wnd.google.gdata.contacts.ContactsService(applicationName);
                                                                             }-*/;

    private static native String getConstant(String name) /*-{
                                                          return $wnd.google.gdata.contacts.ContactsService[name];
                                                          }-*/;

    protected ContactsService() {
    }

    /**
     * Retrieves a contact entry.
     * 
     * @param uri URI of entry.
     * @param callback Callback defining success and failure handlers for this
     * command.
     */
    public final void getContactEntry(String uri, ContactEntryCallback callback) {
        this.getContactEntry(uri, callback, null);
    }

    /**
     * Retrieves a contact entry.
     * 
     * @param uri URI of entry.
     * @param callback Callback defining success and failure handlers for this
     * command.
     * @param parameters The request parameters.
     */
    public final native void getContactEntry(String uri, ContactEntryCallback callback,
            GDataRequestParameters parameters) /*-{
                                               this.getContactEntry(
                                               uri,
                                               function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.entry : result); },
                                               function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); },
                                               parameters
                                               );
                                               }-*/;

    /**
     * Retrieves the feed of contacts.
     * 
     * @param query URI of feed or query.
     * @param callback Callback defining success and failure handlers for this
     * command.
     */
    public final void getContactFeed(ContactQuery query, ContactFeedCallback callback) {
        this.getContactFeed(query, callback, null);
    }

    /**
     * Retrieves the feed of contacts.
     * 
     * @param query URI of feed or query.
     * @param callback Callback defining success and failure handlers for this
     * command.
     * @param parameters The request parameters.
     */
    public final native void getContactFeed(ContactQuery query, ContactFeedCallback callback,
            GDataRequestParameters parameters) /*-{
                                               this.getContactFeed(
                                               query,
                                               function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.feed : result); },
                                               function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); },
                                               parameters
                                               );
                                               }-*/;

    /**
     * Retrieves the feed of contacts.
     * 
     * @param uri URI of feed or query.
     * @param callback Callback defining success and failure handlers for this
     * command.
     */
    public final void getContactFeed(String uri, ContactFeedCallback callback) {
        this.getContactFeed(uri, callback, null);
    }

    /**
     * Retrieves the feed of contacts.
     * 
     * @param uri URI of feed or query.
     * @param callback Callback defining success and failure handlers for this
     * command.
     * @param parameters The request parameters.
     */
    public final native void getContactFeed(String uri, ContactFeedCallback callback,
            GDataRequestParameters parameters) /*-{
                                               this.getContactFeed(
                                               uri,
                                               function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.feed : result); },
                                               function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); },
                                               parameters
                                               );
                                               }-*/;

    /**
     * Retrieves a contact group entry.
     * 
     * @param uri URI of entry.
     * @param callback Callback defining success and failure handlers for this
     * command.
     */
    public final void getContactGroupEntry(String uri, ContactGroupEntryCallback callback) {
        this.getContactGroupEntry(uri, callback, null);
    }

    /**
     * Retrieves a contact group entry.
     * 
     * @param uri URI of entry.
     * @param callback Callback defining success and failure handlers for this
     * command.
     * @param parameters The request parameters.
     */
    public final native void getContactGroupEntry(String uri, ContactGroupEntryCallback callback,
            GDataRequestParameters parameters) /*-{
                                               this.getContactGroupEntry(
                                               uri,
                                               function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.entry : result); },
                                               function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); },
                                               parameters
                                               );
                                               }-*/;

    /**
     * Retrieves the feed of contact groups.
     * 
     * @param query URI of feed or query.
     * @param callback Callback defining success and failure handlers for this
     * command.
     */
    public final void getContactGroupFeed(ContactQuery query, ContactGroupFeedCallback callback) {
        this.getContactGroupFeed(query, callback, null);
    }

    /**
     * Retrieves the feed of contact groups.
     * 
     * @param query URI of feed or query.
     * @param callback Callback defining success and failure handlers for this
     * command.
     * @param parameters The request parameters.
     */
    public final native void getContactGroupFeed(ContactQuery query, ContactGroupFeedCallback callback,
            GDataRequestParameters parameters) /*-{
                                               this.getContactGroupFeed(
                                               query,
                                               function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.feed : result); },
                                               function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); },
                                               parameters
                                               );
                                               }-*/;

    /**
     * Retrieves the feed of contact groups.
     * 
     * @param uri URI of feed or query.
     * @param callback Callback defining success and failure handlers for this
     * command.
     */
    public final void getContactGroupFeed(String uri, ContactGroupFeedCallback callback) {
        this.getContactGroupFeed(uri, callback, null);
    }

    /**
     * Retrieves the feed of contact groups.
     * 
     * @param uri URI of feed or query.
     * @param callback Callback defining success and failure handlers for this
     * command.
     * @param parameters The request parameters.
     */
    public final native void getContactGroupFeed(String uri, ContactGroupFeedCallback callback,
            GDataRequestParameters parameters) /*-{
                                               this.getContactGroupFeed(
                                               uri,
                                               function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.feed : result); },
                                               function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); },
                                               parameters
                                               );
                                               }-*/;

    /**
     * Retrieves a profile entry.
     * 
     * @param uri URI of entry.
     * @param callback Callback defining success and failure handlers for this
     * command.
     */
    public final void getProfileEntry(String uri, ProfileEntryCallback callback) {
        this.getProfileEntry(uri, callback, null);
    }

    /**
     * Retrieves a profile entry.
     * 
     * @param uri URI of entry.
     * @param callback Callback defining success and failure handlers for this
     * command.
     * @param parameters The request parameters.
     */
    public final native void getProfileEntry(String uri, ProfileEntryCallback callback,
            GDataRequestParameters parameters) /*-{
                                               this.getProfileEntry(
                                               uri,
                                               function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.entry : result); },
                                               function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); },
                                               parameters
                                               );
                                               }-*/;

    /**
     * Retrieves the feed of profiles.
     * 
     * @param query URI of feed or query.
     * @param callback Callback defining success and failure handlers for this
     * command.
     */
    public final void getProfileFeed(ProfileQuery query, ProfileFeedCallback callback) {
        this.getProfileFeed(query, callback, null);
    }

    /**
     * Retrieves the feed of profiles.
     * 
     * @param query URI of feed or query.
     * @param callback Callback defining success and failure handlers for this
     * command.
     * @param parameters The request parameters.
     */
    public final native void getProfileFeed(ProfileQuery query, ProfileFeedCallback callback,
            GDataRequestParameters parameters) /*-{
                                               this.getProfileFeed(
                                               query,
                                               function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.feed : result); },
                                               function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); },
                                               parameters
                                               );
                                               }-*/;

    /**
     * Retrieves the feed of profiles.
     * 
     * @param uri URI of feed or query.
     * @param callback Callback defining success and failure handlers for this
     * command.
     */
    public final void getProfileFeed(String uri, ProfileFeedCallback callback) {
        this.getProfileFeed(uri, callback, null);
    }

    /**
     * Retrieves the feed of profiles.
     * 
     * @param uri URI of feed or query.
     * @param callback Callback defining success and failure handlers for this
     * command.
     * @param parameters The request parameters.
     */
    public final native void getProfileFeed(String uri, ProfileFeedCallback callback,
            GDataRequestParameters parameters) /*-{
                                               this.getProfileFeed(
                                               uri,
                                               function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.feed : result); },
                                               function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); },
                                               parameters
                                               );
                                               }-*/;

}