org.datamanager.simpleton
Class EmailMessageEntityHelper

java.lang.Object
  |
  +--org.datamanager.simpleton.EmailMessageEntityHelper

public class EmailMessageEntityHelper
extends Object

Provides a convenient way to access the attributes of an email message represented by an Entity.

Version:
$Revision: 1.16 $
Author:
Team Helium

Field Summary
static String EMAIL_ATTRIBUTE_NAME
          Attribute name which, along with EMAIL_ATTRIBUTE_VALUE, we use to identify Entities which are email.
static String EMAIL_ATTRIBUTE_VALUE
          Attribute name which, along with EMAIL_ATTRIBUTE_NAME, we use to identify Entities which are email.
static String MAIL_CC
          String value of the cc mail header.
static String MAIL_CONTENT_TYPE
          String value of the content-type mail header.
static String MAIL_DATE
          String value of the date mail header.
static String MAIL_DATE_OBJECT
          String name of the DateEntityValue associated with this message.
static String MAIL_FROM
          String value of the from mail header.
static String MAIL_HTML_CONTENT_TYPE
           
static String MAIL_IN_REPLY_TO
          String value of the in-reply-to mail header.
static String MAIL_MESSAGE_ID
          String value of the message-id mail header.
static String MAIL_PART_IDENTIFIER
          String name of the Entity that has as its String value the body of this message.
static String MAIL_PREFERRED_CONTENT_TYPE
           
static String MAIL_REPLYTO
          String value of the reply-to mail header.
static String MAIL_SUBJECT
          String value of the subject mail header.
static String MAIL_TO
          String value of the to mail header.
 
Constructor Summary
EmailMessageEntityHelper()
          Creates a new EmailMessageEntityHelper containing a new email message entity with no content.
EmailMessageEntityHelper(Entity message)
          Creates a new EmailMessageEntityHelper to access the data in the given message.
 
Method Summary
 Object get(String key)
          Returns the Object attribute value mapped to the String key passed in.
 String getBody()
          Returns the first chunk of content in this message, regardless of MIME type.
 String getCcAddresses()
          Returns the addresses in the Cc: field of the message.
 String getContentType()
          Returns the lowercased string from the Content-Type: field of the message, or "text/plain" if no Content-Type: header is found.
 Date getDateObject()
          Returns the Date object associated with this message.
 String getDateString()
          Returns the string from the Date: field of the message.
 String getFromAddress()
          Returns the address in the From: field of the message.
 String getInReplyTo()
          Gets the In-Reply-To of the message.
 Entity getMessage()
          Returns the message this EmailMessageEntityHelper is helping with.
 String getMessageId()
          Gets the Message-ID of the message.
 String getReplyToAddress()
          Gets the reply-to address of the message.
 String getSubject()
          Returns the subject of the message.
 String getToAddresses()
          Returns the addresses in the To: field of the message.
 void replaceStringAttribute(String name, String value)
          Replaces the value of the attribute named name with the value value.
 void setBody(String body)
          Sets the first chunk of content in this message (part0) to be the given String.
 void setCcAddresses(String addresses)
          Sets the cc addresses of the message.
 void setContentType(String contentType)
          Sets the content type of the message.
 void setDateObject(Date date)
          Sets the date object of the message.
 void setDateString(String date)
          Sets the date field of the message.
 void setFromAddress(String address)
          Sets the from address of the message.
 void setInReplyTo(String messageId)
          Sets the In-Reply-To of the message.
 void setMessageId(String messageId)
          Sets the Message-ID of the message.
 void setReplyToAddress(String address)
          Sets the reply to field of the message.
 void setSubject(String subject)
          Sets the subject of the message.
 void setToAddresses(String addresses)
          Sets the to addresses of the message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMAIL_ATTRIBUTE_NAME

public static final String EMAIL_ATTRIBUTE_NAME
Attribute name which, along with EMAIL_ATTRIBUTE_VALUE, we use to identify Entities which are email.

See Also:
Constant Field Values

EMAIL_ATTRIBUTE_VALUE

public static final String EMAIL_ATTRIBUTE_VALUE
Attribute name which, along with EMAIL_ATTRIBUTE_NAME, we use to identify Entities which are email.

See Also:
Constant Field Values

MAIL_FROM

public static final String MAIL_FROM
String value of the from mail header.

See Also:
Constant Field Values

MAIL_TO

public static final String MAIL_TO
String value of the to mail header.

See Also:
Constant Field Values

MAIL_CC

public static final String MAIL_CC
String value of the cc mail header.

See Also:
Constant Field Values

MAIL_REPLYTO

public static final String MAIL_REPLYTO
String value of the reply-to mail header.

See Also:
Constant Field Values

MAIL_DATE

public static final String MAIL_DATE
String value of the date mail header.

See Also:
Constant Field Values

MAIL_SUBJECT

public static final String MAIL_SUBJECT
String value of the subject mail header.

See Also:
Constant Field Values

MAIL_MESSAGE_ID

public static final String MAIL_MESSAGE_ID
String value of the message-id mail header.

See Also:
Constant Field Values

MAIL_IN_REPLY_TO

public static final String MAIL_IN_REPLY_TO
String value of the in-reply-to mail header.

See Also:
Constant Field Values

MAIL_CONTENT_TYPE

public static final String MAIL_CONTENT_TYPE
String value of the content-type mail header.

See Also:
Constant Field Values

MAIL_DATE_OBJECT

public static final String MAIL_DATE_OBJECT
String name of the DateEntityValue associated with this message.

See Also:
Constant Field Values

MAIL_PART_IDENTIFIER

public static final String MAIL_PART_IDENTIFIER
String name of the Entity that has as its String value the body of this message.

See Also:
Constant Field Values

MAIL_PREFERRED_CONTENT_TYPE

public static final String MAIL_PREFERRED_CONTENT_TYPE
See Also:
Constant Field Values

MAIL_HTML_CONTENT_TYPE

public static final String MAIL_HTML_CONTENT_TYPE
See Also:
Constant Field Values
Constructor Detail

EmailMessageEntityHelper

public EmailMessageEntityHelper(Entity message)
                         throws DataManagerException
Creates a new EmailMessageEntityHelper to access the data in the given message.


EmailMessageEntityHelper

public EmailMessageEntityHelper()
                         throws DataManagerException
Creates a new EmailMessageEntityHelper containing a new email message entity with no content.

Method Detail

get

public Object get(String key)
Returns the Object attribute value mapped to the String key passed in.


replaceStringAttribute

public void replaceStringAttribute(String name,
                                   String value)
                            throws DataManagerException
Replaces the value of the attribute named name with the value value. If no such attribute yet exists, creates one.

DataManagerException

getFromAddress

public String getFromAddress()
                      throws DataManagerException
Returns the address in the From: field of the message.

DataManagerException

setFromAddress

public void setFromAddress(String address)
                    throws DataManagerException
Sets the from address of the message.

DataManagerException

getToAddresses

public String getToAddresses()
                      throws DataManagerException
Returns the addresses in the To: field of the message. FIXME: This should probably return a List of addresses instead of just a string.

DataManagerException

setToAddresses

public void setToAddresses(String addresses)
                    throws DataManagerException
Sets the to addresses of the message.

DataManagerException

getCcAddresses

public String getCcAddresses()
                      throws DataManagerException
Returns the addresses in the Cc: field of the message. FIXME: This should probably return a List of addresses instead of just a string.

DataManagerException

setCcAddresses

public void setCcAddresses(String addresses)
                    throws DataManagerException
Sets the cc addresses of the message.

DataManagerException

getReplyToAddress

public String getReplyToAddress()
                         throws DataManagerException
Gets the reply-to address of the message.

DataManagerException

setReplyToAddress

public void setReplyToAddress(String address)
                       throws DataManagerException
Sets the reply to field of the message.

DataManagerException

getDateString

public String getDateString()
                     throws DataManagerException
Returns the string from the Date: field of the message.

DataManagerException

setDateString

public void setDateString(String date)
                   throws DataManagerException
Sets the date field of the message.

DataManagerException

getDateObject

public Date getDateObject()
Returns the Date object associated with this message.


setDateObject

public void setDateObject(Date date)
                   throws DataManagerException
Sets the date object of the message.

DataManagerException

getSubject

public String getSubject()
                  throws DataManagerException
Returns the subject of the message.

DataManagerException

setSubject

public void setSubject(String subject)
                throws DataManagerException
Sets the subject of the message.

DataManagerException

getMessageId

public String getMessageId()
                    throws DataManagerException
Gets the Message-ID of the message.

DataManagerException

setMessageId

public void setMessageId(String messageId)
                  throws DataManagerException
Sets the Message-ID of the message.

DataManagerException

getInReplyTo

public String getInReplyTo()
                    throws DataManagerException
Gets the In-Reply-To of the message.

DataManagerException

setInReplyTo

public void setInReplyTo(String messageId)
                  throws DataManagerException
Sets the In-Reply-To of the message.

DataManagerException

getContentType

public String getContentType()
                      throws DataManagerException
Returns the lowercased string from the Content-Type: field of the message, or "text/plain" if no Content-Type: header is found. Anything following the initial content type declaration (e.g. '; charset="iso-8859-1"'), and all leading and trailing whitespace is stripped.

DataManagerException

setContentType

public void setContentType(String contentType)
                    throws DataManagerException
Sets the content type of the message.

DataManagerException

getBody

public String getBody()
               throws DataManagerException
Returns the first chunk of content in this message, regardless of MIME type.

DataManagerException

setBody

public void setBody(String body)
             throws DataManagerException
Sets the first chunk of content in this message (part0) to be the given String.

DataManagerException

getMessage

public Entity getMessage()
Returns the message this EmailMessageEntityHelper is helping with.



See the Helium Website