com.google.gdata.client.appsforyourdomain.migration
Class MailItemService

java.lang.Object
  extended by com.google.gdata.client.Service
      extended by com.google.gdata.client.GoogleService
          extended by com.google.gdata.client.appsforyourdomain.AppsForYourDomainService
              extended by com.google.gdata.client.appsforyourdomain.migration.MailItemService
All Implemented Interfaces:
AuthTokenFactory.TokenListener

public class MailItemService
extends AppsForYourDomainService

The MailItemService class extends the basic AppsForYourDomainService abstraction to define a service that is preconfigured for access to the MailItem Feed in the Google Apps Migration GData API.


Nested Class Summary
static class MailItemService.Versions
           
 
Nested classes/interfaces inherited from class com.google.gdata.client.GoogleService
GoogleService.AccountDeletedException, GoogleService.AccountDisabledException, GoogleService.CaptchaRequiredException, GoogleService.InvalidCredentialsException, GoogleService.NotVerifiedException, GoogleService.ServiceUnavailableException, GoogleService.SessionExpiredException, GoogleService.TermsNotAgreedException
 
Nested classes/interfaces inherited from class com.google.gdata.client.Service
Service.GDataRequest, Service.GDataRequestFactory
 
Field Summary
static java.lang.String APPS_APIS_DOMAIN
          Domain for sending API requests.
static Version DEFAULT_VERSION
          Version 1 is the current default version for MailItemService.
static java.lang.String URL_PREFIX
          URL prefix for accessing migration feeds.
static java.lang.String URL_SUFFIX
          URL suffix for the mail item batch feed.
 
Fields inherited from class com.google.gdata.client.appsforyourdomain.AppsForYourDomainService
APPS_SERVICE, DOMAIN_NAME, HTTPS_PROTOCOL
 
Fields inherited from class com.google.gdata.client.Service
connectTimeout, extProfile, requestFactory
 
Constructor Summary
MailItemService(java.lang.String applicationName)
          Constructs a MailItemService instance for an application with the name applicationName.
MailItemService(java.lang.String applicationName, java.lang.String protocol, java.lang.String domainName)
          Constructs a MailItemService instance connecting to the service with name serviceName for an application with the name applicationName.
 
Method Summary
 MailItemFeed batch(java.lang.String domain, java.lang.String userName, MailItemFeed feed)
          Inserts one or more MailItem entries in a single batch operation.
 
Methods inherited from class com.google.gdata.client.appsforyourdomain.AppsForYourDomainService
delete, getEntry, getEntry, getFeed, getFeed, insert, query, update
 
Methods inherited from class com.google.gdata.client.GoogleService
addCookie, createRequest, createRequest, delete, getAuthToken, getAuthTokenFactory, getCookieManager, getCookies, getEntry, getFeed, getFeed, getFeed, handleRedirectException, handlesCookies, handleSessionExpiredException, makePostRequest, setAuthSubToken, setAuthSubToken, setAuthTokenFactory, setCookieManager, setHandlesCookies, setOAuthCredentials, setUserCredentials, setUserCredentials, setUserToken, tokenChanged
 
Methods inherited from class com.google.gdata.client.Service
batch, closeSource, createBatchRequest, createDeleteRequest, createEntryRequest, createFeedRequest, createFeedRequest, createInsertRequest, createUpdateRequest, delete, delete, endVersionScope, getContentType, getExtensionProfile, getFeed, getProtocolVersion, getRequestFactory, getServiceVersion, getStreamFromLink, getVersion, initServiceVersion, introspect, parseEntry, query, query, setAcceptLanguage, setConnectTimeout, setContentType, setExtensionProfile, setProtocolVersion, setReadTimeout, setRequestFactory, setTimeouts, startVersionScope, update, useSsl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_VERSION

public static final Version DEFAULT_VERSION
Version 1 is the current default version for MailItemService.


APPS_APIS_DOMAIN

public static final java.lang.String APPS_APIS_DOMAIN
Domain for sending API requests.

See Also:
Constant Field Values

URL_PREFIX

public static final java.lang.String URL_PREFIX
URL prefix for accessing migration feeds.

See Also:
Constant Field Values

URL_SUFFIX

public static final java.lang.String URL_SUFFIX
URL suffix for the mail item batch feed.

See Also:
Constant Field Values
Constructor Detail

MailItemService

public MailItemService(java.lang.String applicationName)
Constructs a MailItemService instance for an application with the name applicationName.

Parameters:
applicationName - the name of the client application accessing the service. Application names should preferably have the format [company-id]-[app-name]-[app-version]. The name will be used by the Google servers to monitor the source of authentication.

MailItemService

public MailItemService(java.lang.String applicationName,
                       java.lang.String protocol,
                       java.lang.String domainName)
Constructs a MailItemService instance connecting to the service with name serviceName for an application with the name applicationName. The service will authenticate at the provided domainName.

Parameters:
applicationName - the name of the client application accessing the service. Application names should preferably have the format [company-id]-[app-name]-[app-version]. The name will be used by the Google servers to monitor the source of authentication.
protocol - name of protocol to use for authentication ("http"/"https")
domainName - the name of the domain hosting the login handler
Method Detail

batch

public MailItemFeed batch(java.lang.String domain,
                          java.lang.String userName,
                          MailItemFeed feed)
                   throws BatchInterruptedException,
                          java.io.IOException,
                          java.net.MalformedURLException,
                          ServiceException
Inserts one or more MailItem entries in a single batch operation. Using batch instead of repeated calls to insert is helpful in reducing HTTP overhead.

Parameters:
domain - the domain into which mail is being migrated
feed - a feed containing one or more MailItemEntry objects, each of which has been tagged with BatchUtils#setBatchId(com.google.gdata.data.BaseEntry, String). The batch operation type of each entry must be BatchOperationType.INSERT; however, there should be no need to call BatchUtils.setBatchOperationType on each entry, as this operation is already the default.
Returns:
a feed with the result of each operation in a separate MailItemEntry object.
Throws:
java.io.IOException - if an error occurs while communicating with the GData service.
java.net.MalformedURLException - if the batch feed URL cannot be constructed.
ServiceException - if the insert request failed due to system error.
BatchInterruptedException - if an irrecoverable error was detected by the server while parsing the request, like invalid XML data. Some operations might have succeeded when this exception is thrown. Check BatchInterruptedException.getFeed().