org.apache.myfaces.trinidaddemo.email
Class MessageData

java.lang.Object
  extended by org.apache.myfaces.trinidaddemo.email.MessageData

public class MessageData
extends Object

MessageData contains all the information needed to display a UI for a javax.mail.Message object. There are methods to get the sender, the subject, the size, the date, the to list, the cc list, the content type, the content itself, and the line count of the message.

Version:
1.0

Constructor Summary
MessageData(javax.mail.Message message)
          Create a new MessageData object given the message object.
 
Method Summary
 List<javax.mail.BodyPart> getAttachments()
          Get the list of attachments.
 javax.mail.Address[] getCcs()
          Get an array of Address objects that correspond to the list of addresses the message was cc'd to.
 Object getContent()
          Get an object representing the content type of the message.
 String getContentType()
          Get a string representing the content type of the message.
 int getLineCount()
          Get the number of lines in the message.
 javax.mail.Message getMessage()
          Get the underlying Message Object.
 int getMessageNumber()
          Get the number of the message in its containing folder.
 javax.mail.Address getSender()
          Get the Address object that corresponds to the sender
 Date getSentDate()
          Get the sent date of the message.
 int getSize()
          Get the size of the message in kilobytes.
 String getSubject()
          Get the subject of the message.
 javax.mail.Address[] getTos()
          Get an array of Address objects that correspond to the list of addresses the message was sent to.
 boolean isAttachmentPresent()
          Returns true if any attachments are available.
 boolean isDeleted()
          Return true if the message has been deleted.
 boolean isRead()
          Return true if the message has been read yet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageData

public MessageData(javax.mail.Message message)
            throws javax.mail.MessagingException
Create a new MessageData object given the message object.

Throws:
javax.mail.MessagingException
Method Detail

getMessageNumber

public int getMessageNumber()
Get the number of the message in its containing folder.

Returns:
the message number. this index is based at 1

getSender

public javax.mail.Address getSender()
                             throws javax.mail.MessagingException
Get the Address object that corresponds to the sender

Throws:
javax.mail.MessagingException

getSubject

public String getSubject()
                  throws javax.mail.MessagingException
Get the subject of the message. If the subject is empty or null we return a string to indicate the subject did not contain anything.

Throws:
javax.mail.MessagingException

getSize

public int getSize()
Get the size of the message in kilobytes.

Returns:
size in kilo bytes

getSentDate

public Date getSentDate()
                 throws javax.mail.MessagingException
Get the sent date of the message.

Throws:
javax.mail.MessagingException

getTos

public javax.mail.Address[] getTos()
                            throws javax.mail.MessagingException
Get an array of Address objects that correspond to the list of addresses the message was sent to.

Throws:
javax.mail.MessagingException

getCcs

public javax.mail.Address[] getCcs()
                            throws javax.mail.MessagingException
Get an array of Address objects that correspond to the list of addresses the message was cc'd to.

Throws:
javax.mail.MessagingException

getContentType

public String getContentType()
                      throws javax.mail.MessagingException
Get a string representing the content type of the message. The string returned is truncated to just show the initial part of the type like text/plain. Also if the original message is a more complex type like multipart, this method will actually search through all the parts and try and find a text/plain or text/html to make the UI easier to handle.

Throws:
javax.mail.MessagingException

getContent

public Object getContent()
                  throws javax.mail.MessagingException,
                         IOException
Get an object representing the content type of the message. If the original message is a more complex type like multipart, this method will actually search through all the parts and try and find a text/plain or text/html to make the UI easier to handle.

Throws:
javax.mail.MessagingException
IOException

getLineCount

public int getLineCount()
                 throws javax.mail.MessagingException
Get the number of lines in the message. If the original message is a more complex type like multipart, this method will actually search through all the parts and try and find a text/plain or text/html and getLineCount() will return the number of messages in that part.

Throws:
javax.mail.MessagingException

isRead

public boolean isRead()
Return true if the message has been read yet.


isDeleted

public boolean isDeleted()
Return true if the message has been deleted.


getMessage

public javax.mail.Message getMessage()
Get the underlying Message Object.


getAttachments

public List<javax.mail.BodyPart> getAttachments()
Get the list of attachments.


isAttachmentPresent

public boolean isAttachmentPresent()
Returns true if any attachments are available.



Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.