com.openexchange.mail.mime.utils
Class MIMEStorageUtility

java.lang.Object
  extended by com.openexchange.mail.mime.utils.MIMEStorageUtility

public final class MIMEStorageUtility
extends java.lang.Object

MIMEStorageUtility - Provides MIME-specific storage utility methods

Author:
Thorben Betten

Method Summary
static javax.mail.FetchProfile cloneFetchProfile(javax.mail.FetchProfile toClone)
          Clones specified fetch profile:
static java.util.Collection<MailField> fetchProfile2MailListFields(javax.mail.FetchProfile fetchProfile)
          Creates an appropriate collection of MailField enumeration constants from given fetch profile
static javax.mail.FetchProfile getCacheFetchProfile()
          Messages which are pre-filled with the fetch profile returned by this method are completely pre-filles with all data that can occur in a listing.
static java.util.Collection<MailField> getCacheFields()
          The corresponding fields to fetch profile obtained by getCacheFetchProfile()
static MailField[] getCacheFieldsArray()
          The corresponding fields to fetch profile obtained by getCacheFetchProfile()
static javax.mail.FetchProfile getFetchProfile(MailField[] fields, boolean preferEnvelope)
          Gets the appropriate fetch profile.
static javax.mail.FetchProfile getFetchProfile(MailField[] fields, MailField[] searchFields, MailField sortField, boolean preferEnvelope)
          Gets the appropriate fetch profile Note that MailField.BODY and MailField.FULL are discarded since no corresponding fetch profile item exists and therefore should be handled separately.
static javax.mail.FetchProfile getFetchProfile(MailField[] fields, MailField sortField, boolean preferEnvelope)
          Gets the appropriate fetch profile Note that MailField.BODY and MailField.FULL are discarded since no corresponding fetch profile item exists and therefore should be handled separately.
static javax.mail.FetchProfile getFetchProfile(MailField[] fields, java.lang.String[] headerNames, MailField[] searchFields, MailField sortField, boolean preferEnvelope)
          Gets the appropriate fetch profile Note that MailField.BODY and MailField.FULL are discarded since no corresponding fetch profile item exists and therefore should be handled separately.
static javax.mail.FetchProfile getFlagsFetchProfile()
           
static javax.mail.FetchProfile getUIDFetchProfile()
           
static com.sun.mail.imap.protocol.UIDSet[] toUIDSet(long[] uids)
          Turns given array of long into an array of com.sun.mail.imap.protocol.UIDSet which in turn can be used for a varieties of IMAPProtocol methods.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

cloneFetchProfile

public static javax.mail.FetchProfile cloneFetchProfile(javax.mail.FetchProfile toClone)
Clones specified fetch profile:

Parameters:
toClone - The fetch profile to clone
Returns:
The clone fetch profile

getCacheFields

public static java.util.Collection<MailField> getCacheFields()
The corresponding fields to fetch profile obtained by getCacheFetchProfile()

Returns:
The corresponding fields to the fetch profile obtained by getCacheFetchProfile()

getCacheFieldsArray

public static MailField[] getCacheFieldsArray()
The corresponding fields to fetch profile obtained by getCacheFetchProfile()

Returns:
The corresponding fields to the fetch profile obtained by getCacheFetchProfile()

getCacheFetchProfile

public static javax.mail.FetchProfile getCacheFetchProfile()
Messages which are pre-filled with the fetch profile returned by this method are completely pre-filles with all data that can occur in a listing. Thus these messages can be put into cache for future list requests

Returns:
An appropriate instance of FetchProfile to pre-fill messages ready for being put into cache

getUIDFetchProfile

public static javax.mail.FetchProfile getUIDFetchProfile()
Returns:
A new instance of FetchProfile which only prefills messages with their UIDs

getFlagsFetchProfile

public static javax.mail.FetchProfile getFlagsFetchProfile()
Returns:
A new instance of FetchProfile which only prefills messages with their flags

fetchProfile2MailListFields

public static java.util.Collection<MailField> fetchProfile2MailListFields(javax.mail.FetchProfile fetchProfile)
Creates an appropriate collection of MailField enumeration constants from given fetch profile

Parameters:
fetchProfile - The fetch profile
Returns:
An appropriate collection of MailField enumeration constants

toUIDSet

public static com.sun.mail.imap.protocol.UIDSet[] toUIDSet(long[] uids)
Turns given array of long into an array of com.sun.mail.imap.protocol.UIDSet which in turn can be used for a varieties of IMAPProtocol methods.

Parameters:
uids - - the UIDs
Returns:
an array of com.sun.mail.imap.protocol.UIDSet

getFetchProfile

public static javax.mail.FetchProfile getFetchProfile(MailField[] fields,
                                                      boolean preferEnvelope)
Gets the appropriate fetch profile.

Note that MailField.BODY and MailField.FULL are discarded since no corresponding fetch profile item exists and therefore should be handled separately.

Parameters:
fields - The fields
preferEnvelope - true to prefer ENVELOPE instead of single fetch items; otherwise false
Returns:
The appropriate IMAP fetch profile

getFetchProfile

public static javax.mail.FetchProfile getFetchProfile(MailField[] fields,
                                                      MailField sortField,
                                                      boolean preferEnvelope)
Gets the appropriate fetch profile

Note that MailField.BODY and MailField.FULL are discarded since no corresponding fetch profile item exists and therefore should be handled separately.

Parameters:
fields - The fields
sortField - The sort field
preferEnvelope - true to prefer ENVELOPE instead of single fetch items; otherwise false
Returns:
The appropriate IMAP fetch profile

getFetchProfile

public static javax.mail.FetchProfile getFetchProfile(MailField[] fields,
                                                      MailField[] searchFields,
                                                      MailField sortField,
                                                      boolean preferEnvelope)
Gets the appropriate fetch profile

Note that MailField.BODY and MailField.FULL are discarded since no corresponding fetch profile item exists and therefore should be handled separately.

Parameters:
fields - The fields
searchFields - The search fields
sortField - The sort field
preferEnvelope - true to prefer ENVELOPE instead of single fetch items; otherwise false
Returns:
The appropriate IMAP fetch profile

getFetchProfile

public static javax.mail.FetchProfile getFetchProfile(MailField[] fields,
                                                      java.lang.String[] headerNames,
                                                      MailField[] searchFields,
                                                      MailField sortField,
                                                      boolean preferEnvelope)
Gets the appropriate fetch profile

Note that MailField.BODY and MailField.FULL are discarded since no corresponding fetch profile item exists and therefore should be handled separately.

Parameters:
fields - The fields
headerNames - The header names
searchFields - The search fields
sortField - The sort field
preferEnvelope - true to prefer ENVELOPE instead of single fetch items; otherwise false
Returns:
The appropriate IMAP fetch profile