public class MailItemService extends MediaService
MediaService
that can upload mail to
the Google Apps Email Migration API.
The recommended way to perform mail migration is to issue multipart POST requests, where the first part contains an Atom entry specifying the message properties and labels, and the second part contains the complete RFC822 message as UTF-8 text.
Modifier and Type | Class and Description |
---|---|
static class |
MailItemService.Versions |
GoogleService.AccountDeletedException, GoogleService.AccountDisabledException, GoogleService.CaptchaRequiredException, GoogleService.InvalidCredentialsException, GoogleService.NotVerifiedException, GoogleService.ServiceUnavailableException, GoogleService.SessionExpiredException, GoogleService.TermsNotAgreedException
Service.ClientOutputProperties, Service.GDataRequest, Service.GDataRequestFactory
Modifier and Type | Field and Description |
---|---|
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.
|
DEFAULT_CHUNKED_BUFFER_SIZE, NO_CHUNKED_MEDIA_REQUEST
Constructor and Description |
---|
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 . |
Modifier and Type | Method and Description |
---|---|
MailItemFeed |
batch(java.lang.String domain,
java.lang.String userName,
MailItemFeed feed)
Inserts one or more MailItem entries in a single batch operation.
|
getDefaultAltRegistry, getMedia, getMedia, insert, insert, setChunkedMediaUpload, update, updateMedia, updateMedia
addCookie, batch, createRequest, delete, delete, getAuthToken, getAuthTokenFactory, getCookieManager, getCookies, getEntry, getEntry, getFeed, getFeed, getFeed, getFeed, handlesCookies, makePostRequest, setAuthSubToken, setAuthSubToken, setAuthTokenFactory, setCookieManager, setHandlesCookies, setOAuthCredentials, setUserCredentials, setUserCredentials, setUserCredentials, setUserCredentials, setUserToken, tokenChanged
createBatchRequest, createDeleteRequest, createEntryRequest, createFeedRequest, createFeedRequest, createInsertRequest, createLinkQueryRequest, createPatchRequest, createUpdateRequest, delete, delete, getAltRegistry, getContentType, getEntry, getExtensionProfile, getFeed, getFeed, getMetadataRegistry, getProtocolVersion, getRequestFactory, getSchema, getServiceVersion, getStreamFromLink, getStrictValidation, getVersion, introspect, parseResponseData, patch, patch, query, query, query, setAcceptLanguage, setAltRegistry, setConnectTimeout, setContentType, setExtensionProfile, setHeader, setOAuthProxyHeaders, setPrivateHeader, setProtocolVersion, setReadTimeout, setRequestFactory, setStrictValidation, setTimeouts, update, useSsl, writeRequestData
public static final Version DEFAULT_VERSION
public static final java.lang.String APPS_APIS_DOMAIN
public static final java.lang.String URL_PREFIX
public static final java.lang.String URL_SUFFIX
public MailItemService(java.lang.String applicationName)
MailItemService
instance for an application with the
name applicationName
.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.public MailItemService(java.lang.String applicationName, java.lang.String protocol, java.lang.String domainName)
MailItemService
instance connecting to the service
with name serviceName
for an application with the name
applicationName
. The service will authenticate at the provided
domainName
.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 handlerpublic MailItemFeed batch(java.lang.String domain, java.lang.String userName, MailItemFeed feed) throws BatchInterruptedException, java.io.IOException, java.net.MalformedURLException, ServiceException
batch
instead of repeated calls to insert
is helpful in
reducing HTTP overhead.domain
- the domain into which mail is being migratedfeed
- 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.MailItemEntry
object.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()
.