com.micromail
Class MessageWrapper

java.lang.Object
  extended bycom.micromail.MessageWrapper

public class MessageWrapper
extends java.lang.Object

Wraps a Javamail Message object


Nested Class Summary
 class MessageWrapper.AttachmentURL
          Contains an attachment URL and the filename
 
Constructor Summary
MessageWrapper()
          Creates a message wrapper containing no real message.
MessageWrapper(javax.mail.Message message, FolderWrapper folderWrapper, MailManager mailManager)
          Creates a message wrapper
MessageWrapper(java.lang.String to, java.lang.String subject, java.lang.String body)
          Creates a message wrapper containing recipients, subject and message body, but without an underlying Message object
 
Method Summary
 void fetchContent()
          Fetches the content of the message from the mail server.
 java.lang.String getAllAddresses()
          Gets the addresses of the sender and all other recipients, as a formatted string
 java.util.Iterator getAttachmentURLs()
          Gets an Iterator across URLs of attachments selctable for download to the client
 java.lang.String getBody()
          Gets the message content as a string.
 java.lang.String getDate()
          Gets the Sent date as a formatted string
protected  java.util.Date getDateRaw()
          Gets the Sent date as a Date object
 FolderWrapper getFolderWrapper()
          Gets the FolderWrapper of the Folder object containing the message wrapped by this wrapper
 java.lang.String getFrom()
          Gets the sender as a string
 java.util.Iterator getInlineURLs()
          Gets an Iterator across the list of local URLs of attachments to be displayed inline in the message body
 javax.mail.Message getMessage()
          Gets the Message object wrapped by this object
 java.lang.String getMessageNumber()
          Gets the message number of the wrapped Message object
 int getNumAttachmentURLs()
          Gets the number of URLs of attachments selectable for download to the client
 int getNumInlineURLs()
          Gets the number of local URLs of attachments to be displayed inline in the message body
 int getNumOtherRecipients()
          Gets the number of other recipients
 java.lang.String getOtherRecipients()
          Gets the addresses of the other recipients as a formatted string
 java.lang.String getSenderAddress()
          Gets the address of the sender as a string
 int getSortIndex()
          Gets the sort order index
 java.lang.String getSubject()
          Gets the subject string
 java.lang.String getTo()
          Gets the destination address
 boolean hasDate()
          Determines if the message has a Sent date
 boolean hasSender()
          Determines if the message has a Sender
 boolean hasSubject()
          Determines if the messaqge has a subject string
 boolean isFirst()
          Determines if the message is the first in the current display order
 boolean isLast()
          Determines if the message is the last in the current display order
 boolean isNew()
          Determines if a message body has been viewed at least once
 void setBody(java.lang.String body)
          Sets the message body
 void setSortIndex(int sortIndex)
          Sets the sort order index
 void setSubject(java.lang.String subject)
          Sets the subject string
 void setTo(java.lang.String to)
          Sets the destination address
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageWrapper

public MessageWrapper(javax.mail.Message message,
                      FolderWrapper folderWrapper,
                      MailManager mailManager)
               throws javax.mail.MessagingException
Creates a message wrapper

Parameters:
message - the Message object to be wrapped
folderWrapper - the wrapper of the folder containing the message
mailManager - the MailManager

MessageWrapper

public MessageWrapper()
Creates a message wrapper containing no real message. It is required at startup.


MessageWrapper

public MessageWrapper(java.lang.String to,
                      java.lang.String subject,
                      java.lang.String body)
Creates a message wrapper containing recipients, subject and message body, but without an underlying Message object

Method Detail

fetchContent

public void fetchContent()
                  throws java.lang.Exception
Fetches the content of the message from the mail server. Text attachmenmts and image attachments (GIFF, JPEG or TIFF) are included inline with the body text. All others are saved locally

Throws:
java.lang.Exception

isNew

public boolean isNew()
              throws javax.mail.MessagingException
Determines if a message body has been viewed at least once

Returns:
true if body has been viewed
Throws:
javax.mail.MessagingException

setSortIndex

public void setSortIndex(int sortIndex)
Sets the sort order index


getSortIndex

public int getSortIndex()
Gets the sort order index

Returns:
the sort order index

getMessage

public javax.mail.Message getMessage()
Gets the Message object wrapped by this object

Returns:
the wrapped Message

getFolderWrapper

public FolderWrapper getFolderWrapper()
Gets the FolderWrapper of the Folder object containing the message wrapped by this wrapper

Returns:
the folder wrapper

hasSubject

public boolean hasSubject()
                   throws javax.mail.MessagingException
Determines if the messaqge has a subject string

Returns:
true if the message has a subject string
Throws:
javax.mail.MessagingException

getSubject

public java.lang.String getSubject()
                            throws javax.mail.MessagingException
Gets the subject string

Returns:
the subject string
Throws:
javax.mail.MessagingException

setSubject

public void setSubject(java.lang.String subject)
Sets the subject string

Parameters:
subject - the subject

hasDate

public boolean hasDate()
                throws javax.mail.MessagingException
Determines if the message has a Sent date

Returns:
true if the message has a Sent date
Throws:
javax.mail.MessagingException

getDate

public java.lang.String getDate()
                         throws javax.mail.MessagingException
Gets the Sent date as a formatted string

Returns:
the date string
Throws:
javax.mail.MessagingException

getDateRaw

protected java.util.Date getDateRaw()
                             throws javax.mail.MessagingException
Gets the Sent date as a Date object

Returns:
the Sen date
Throws:
javax.mail.MessagingException

getMessageNumber

public java.lang.String getMessageNumber()
Gets the message number of the wrapped Message object

Returns:
the

getFrom

public java.lang.String getFrom()
                         throws javax.mail.MessagingException
Gets the sender as a string

Returns:
the sender string
Throws:
javax.mail.MessagingException

hasSender

public boolean hasSender()
                  throws javax.mail.MessagingException
Determines if the message has a Sender

Returns:
true if message has a Sender
Throws:
javax.mail.MessagingException

getSenderAddress

public java.lang.String getSenderAddress()
                                  throws javax.mail.MessagingException
Gets the address of the sender as a string

Returns:
the sender address
Throws:
javax.mail.MessagingException

getAllAddresses

public java.lang.String getAllAddresses()
                                 throws javax.mail.MessagingException
Gets the addresses of the sender and all other recipients, as a formatted string

Returns:
the address string
Throws:
javax.mail.MessagingException

setTo

public void setTo(java.lang.String to)
Sets the destination address


getTo

public java.lang.String getTo()
                       throws javax.mail.MessagingException
Gets the destination address

Returns:
the destination address
Throws:
javax.mail.MessagingException

getOtherRecipients

public java.lang.String getOtherRecipients()
                                    throws javax.mail.MessagingException
Gets the addresses of the other recipients as a formatted string

Returns:
the otther recipient addresses
Throws:
javax.mail.MessagingException

getNumOtherRecipients

public int getNumOtherRecipients()
                          throws javax.mail.MessagingException
Gets the number of other recipients

Returns:
the number of other recipients
Throws:
javax.mail.MessagingException

getBody

public java.lang.String getBody()
Gets the message content as a string. For a multipart message, the MIME types TEXT/PLAIN and TEXT/HTML will be embedded directly in the content defined in the suportedInline array will be embedded in the content regardless of their Content-Disposition value

Returns:
the message content

setBody

public void setBody(java.lang.String body)
Sets the message body


getNumInlineURLs

public int getNumInlineURLs()
Gets the number of local URLs of attachments to be displayed inline in the message body

Returns:
the number of inline URLs

getInlineURLs

public java.util.Iterator getInlineURLs()
Gets an Iterator across the list of local URLs of attachments to be displayed inline in the message body

Returns:
the Iterator

getNumAttachmentURLs

public int getNumAttachmentURLs()
Gets the number of URLs of attachments selectable for download to the client

Returns:
the number of URLs

getAttachmentURLs

public java.util.Iterator getAttachmentURLs()
Gets an Iterator across URLs of attachments selctable for download to the client

Returns:
the Iterator

isLast

public boolean isLast()
Determines if the message is the last in the current display order

Returns:
true if i is the last

isFirst

public boolean isFirst()
Determines if the message is the first in the current display order

Returns:
true if it is the first