com.openexchange.mail
Enum MailField

java.lang.Object
  extended by java.lang.Enum<MailField>
      extended by com.openexchange.mail.MailField
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<MailField>

public enum MailField
extends java.lang.Enum<MailField>

MailField - An enumeration of mail fields to define which fields to prefill.

Author:
Thorben Betten

Enum Constant Summary
ACCOUNT_NAME
          Account name
[low cost]
BCC
          Bcc
[low cost]
BODY
          To peek the mail body (\Seen flag is left unchanged)
[high cost]
CC
          Cc
[low cost]
COLOR_LABEL
          Color Label
[low cost]
CONTENT_TYPE
          The Content-Type; includes whether message contains attachments or not
[low cost]
DISPOSITION_NOTIFICATION_TO
          Email address in Disposition-Notification-To header
[low cost]
FLAGS
          Flags
[low cost]
FOLDER_ID
          The folder ID or fullname
[low cost]
FROM
          From
[low cost]
FULL
          To fully pre-fill mail incl. headers and peeked body (\Seen flag is left unchanged)
[high cost]
HEADERS
          To fetch all message headers
[high cost]
ID
          The implementation-specific unique mail ID
[low cost]
PRIORITY
          Integer value of X-Priority header
[low cost]
RECEIVED_DATE
          Received date represent the internal mail server's timestamp on arrival
[low cost]
SENT_DATE
          Sent date corresponds to Date header
[low cost]
SIZE
          Size
[low cost]
SUBJECT
          Subject
[low cost]
THREAD_LEVEL
          Thread level
[low cost]
TO
          To
[low cost]
 
Field Summary
static MailField[] FIELDS_LOW_COST
          All low cost fields
static MailField[] FIELDS_WO_BODY
          All fields except BODY and FULL
 
Method Summary
static MailField getField(int field)
          Maps specified int value to a mail field.
static MailField[] getFields(int[] fields)
          Creates an array of MailField corresponding to given int values.
 MailListField getListField()
          Gets the corresponding instance of MailListField or null if none exists.
static java.util.Set<MailField> getMailFieldsFromSearchTerm(SearchTerm<?> searchTerm)
          Gets the mail fields addressed by given search term
static MailField toField(MailListField listField)
          Gets the corresponding instance of MailField for specified instance of MailListField.
static MailField[] toFields(MailListField[] listFields)
          Gets the corresponding instances of MailField for specified instances of MailListField.
static MailListField[] toListFields(java.util.Collection<MailField> fields)
          Gets the corresponding instances of MailListField for specified collection of MailField.
static MailListField[] toListFields(MailField[] fields)
          Gets the corresponding instances of MailListField for specified instances of MailField.
static MailField valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static MailField[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ID

public static final MailField ID
The implementation-specific unique mail ID
[low cost]


FOLDER_ID

public static final MailField FOLDER_ID
The folder ID or fullname
[low cost]


CONTENT_TYPE

public static final MailField CONTENT_TYPE
The Content-Type; includes whether message contains attachments or not
[low cost]


FROM

public static final MailField FROM
From
[low cost]


TO

public static final MailField TO
To
[low cost]


CC

public static final MailField CC
Cc
[low cost]


BCC

public static final MailField BCC
Bcc
[low cost]


SUBJECT

public static final MailField SUBJECT
Subject
[low cost]


SIZE

public static final MailField SIZE
Size
[low cost]


SENT_DATE

public static final MailField SENT_DATE
Sent date corresponds to Date header
[low cost]


RECEIVED_DATE

public static final MailField RECEIVED_DATE
Received date represent the internal mail server's timestamp on arrival
[low cost]


FLAGS

public static final MailField FLAGS
Flags
[low cost]


THREAD_LEVEL

public static final MailField THREAD_LEVEL
Thread level
[low cost]


DISPOSITION_NOTIFICATION_TO

public static final MailField DISPOSITION_NOTIFICATION_TO
Email address in Disposition-Notification-To header
[low cost]


PRIORITY

public static final MailField PRIORITY
Integer value of X-Priority header
[low cost]


COLOR_LABEL

public static final MailField COLOR_LABEL
Color Label
[low cost]


ACCOUNT_NAME

public static final MailField ACCOUNT_NAME
Account name
[low cost]


BODY

public static final MailField BODY
To peek the mail body (\Seen flag is left unchanged)
[high cost]


HEADERS

public static final MailField HEADERS
To fetch all message headers
[high cost]


FULL

public static final MailField FULL
To fully pre-fill mail incl. headers and peeked body (\Seen flag is left unchanged)
[high cost]

Field Detail

FIELDS_LOW_COST

public static final MailField[] FIELDS_LOW_COST
All low cost fields


FIELDS_WO_BODY

public static final MailField[] FIELDS_WO_BODY
All fields except BODY and FULL

Method Detail

values

public static final MailField[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(MailField c : MailField.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static MailField valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name

getListField

public MailListField getListField()
Gets the corresponding instance of MailListField or null if none exists.

Returns:
The corresponding instance of MailListField or null if none exists.

toListFields

public static final MailListField[] toListFields(MailField[] fields)
Gets the corresponding instances of MailListField for specified instances of MailField.

Those mail fields which have no corresponding list field are omitted.

Parameters:
fields - The instances of MailField
Returns:
The corresponding instances of MailListField

toListFields

public static final MailListField[] toListFields(java.util.Collection<MailField> fields)
Gets the corresponding instances of MailListField for specified collection of MailField.

Those mail fields which have no corresponding list field are omitted.

Parameters:
fields - The collection of MailField
Returns:
The corresponding instances of MailListField

toFields

public static final MailField[] toFields(MailListField[] listFields)
Gets the corresponding instances of MailField for specified instances of MailListField.

Parameters:
listFields - The instances of MailListField
Returns:
The corresponding instances of MailField

toField

public static final MailField toField(MailListField listField)
Gets the corresponding instance of MailField for specified instance of MailListField.

Parameters:
listField - The instance of MailListField
Returns:
The corresponding instance of MailField

getFields

public static final MailField[] getFields(int[] fields)
Creates an array of MailField corresponding to given int values.

This is just a convenience method that invokes getField(int) for every int value.

Parameters:
fields - The int values
Returns:
The array of MailField corresponding to given int values
See Also:
getField(int)

getField

public static MailField getField(int field)
Maps specified int value to a mail field. A negative int value is mapped to BODY.

Mail fields which do not hold a corresponding list field are not mappable to an int value; in consequence they are ignored

Parameters:
field - The int value
Returns:
The mapped MailField or null if no corresponding mail field could be found

getMailFieldsFromSearchTerm

public static java.util.Set<MailField> getMailFieldsFromSearchTerm(SearchTerm<?> searchTerm)
Gets the mail fields addressed by given search term

Parameters:
searchTerm - The search term
Returns:
The addressed mail fields