com.openexchange.mail.dataobjects.compose
Class ComposedMailMessage

java.lang.Object
  extended by com.openexchange.mail.dataobjects.MailPart
      extended by com.openexchange.mail.dataobjects.MailMessage
          extended by com.openexchange.mail.dataobjects.compose.ComposedMailMessage
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public abstract class ComposedMailMessage
extends MailMessage

ComposedMailMessage - Subclass of MailMessage designed for composing a mail.

Author:
Thorben Betten
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.openexchange.mail.dataobjects.MailMessage
COLOR_LABEL_NONE, COLOR_LABEL_PREFIX, COLOR_LABEL_PREFIX_OLD, FLAG_ANSWERED, FLAG_DELETED, FLAG_DRAFT, FLAG_FLAGGED, FLAG_FORWARDED, FLAG_READ_ACK, FLAG_RECENT, FLAG_SEEN, FLAG_SPAM, FLAG_USER, PRIORITY_HIGH, PRIORITY_HIGHEST, PRIORITY_LOW, PRIORITY_LOWEST, PRIORITY_NORMAL, USER_FORWARDED, USER_READ_ACK
 
Fields inherited from class com.openexchange.mail.dataobjects.MailPart
NO_ENCLOSED_PARTS
 
Method Summary
abstract  void addEnclosedPart(MailPart part)
          Adds an instance of MailPart to enclosed parts
 void addRecipient(javax.mail.internet.InternetAddress recipient)
          Adds a dedicated recipient to this composed mail.
 void addRecipients(javax.mail.internet.InternetAddress[] recipients)
          Adds dedicated recipients to this composed mail.
 void cleanUp()
          Cleans-up this composed mail's referenced uploaded files and frees temporary stored files.
 com.openexchange.groupware.contexts.Context getContext()
          Gets the context
abstract  int getEnclosedCount()
          Gets the number of enclosed mail parts.
abstract  MailPart getEnclosedMailPart(int index)
          Gets this composed mail's part located at given index.
 javax.mail.internet.InternetAddress[] getRecipients()
          Gets the composed mail's dedicated recipients.
 com.openexchange.session.Session getSession()
          Gets the session
 int getUnreadMessages()
          Gets the number of unread messages
 boolean hasRecipients()
          Checks if this composed mail has dedicated recipients.
abstract  MailPart removeEnclosedPart(int index)
          Removes the enclosed part at the specified position.
abstract  void setBodyPart(TextBodyMailPart mailPart)
          Sets this composed message's body part.
 void setFiller(MIMEMessageFiller filler)
          Sets the mail filler
 void setUnreadMessages(int unreadMessages)
          Sets the number of unread messages
 
Methods inherited from class com.openexchange.mail.dataobjects.MailMessage
addBcc, addBcc, addCc, addCc, addFrom, addFrom, addTo, addTo, addUserFlag, addUserFlags, clone, containsAccountId, containsAccountName, containsAppendVCard, containsBcc, containsCc, containsColorLabel, containsDispositionNotification, containsFlags, containsFolder, containsFrom, containsHasAttachment, containsPrevSeen, containsPriority, containsReceivedDate, containsRecentCount, containsSentDate, containsSubject, containsThreadLevel, containsTo, containsUserFlags, getAccountId, getAccountName, getBcc, getCc, getColorLabel, getColorLabelIntValue, getColorLabelStringValue, getDispositionNotification, getFlags, getFolder, getFrom, getMailId, getMailPath, getPriority, getReceivedDate, getReceivedDateDirect, getRecentCount, getSentDate, getSubject, getThreadLevel, getTo, getUserFlags, hasAttachment, isAnswered, isAppendVCard, isColorLabel, isDeleted, isDraft, isFlagged, isForwarded, isPrevSeen, isReadAcknowledgment, isRecent, isSeen, isSpam, isUser, parseColorLabel, removeAccountId, removeAccountName, removeAppendVCard, removeBcc, removeCc, removeColorLabel, removeDispositionNotification, removeFlags, removeFolder, removeFrom, removeHasAttachment, removePrevSeen, removePriority, removeReceivedDate, removeRecentCount, removeSentDate, removeSubject, removeThreadLevel, removeTo, removeUserFlags, setAccountId, setAccountName, setAppendVCard, setColorLabel, setDispositionNotification, setFlag, setFlags, setFolder, setHasAttachment, setMailId, setPrevSeen, setPriority, setReceivedDate, setRecentCount, setSentDate, setSubject, setThreadLevel
 
Methods inherited from class com.openexchange.mail.dataobjects.MailPart
addHeader, addHeaders, containsContentDisposition, containsContentId, containsContentType, containsFileName, containsHeader, containsHeaders, containsMsgref, containsSequenceId, containsSize, getContent, getContentDisposition, getContentId, getContentType, getDataHandler, getFileName, getFirstHeader, getHeader, getHeader, getHeader, getHeaders, getHeadersIterator, getHeadersSize, getInputStream, getMatchingHeaders, getMsgref, getNonMatchingHeaders, getSequenceId, getSize, getSource, getSourceBytes, hasEnclosedParts, hasHeaders, loadContent, prepareForCaching, removeContentDisposition, removeContentId, removeContentType, removeFileName, removeHeader, removeHeaders, removeMsgref, removeSequenceId, removeSize, setContentDisposition, setContentDisposition, setContentId, setContentType, setContentType, setFileName, setMsgref, setSequenceId, setSize, writeTo
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hasRecipients

public boolean hasRecipients()
Checks if this composed mail has dedicated recipients.

Returns:
true if this composed mail has dedicated recipients; otherwise false

getRecipients

public javax.mail.internet.InternetAddress[] getRecipients()
Gets the composed mail's dedicated recipients.

Returns:
The dedicated recipients

addRecipient

public void addRecipient(javax.mail.internet.InternetAddress recipient)
Adds a dedicated recipient to this composed mail.

Parameters:
recipient - The recipient to add

addRecipients

public void addRecipients(javax.mail.internet.InternetAddress[] recipients)
Adds dedicated recipients to this composed mail.

Parameters:
recipients - The recipients to add

getSession

public com.openexchange.session.Session getSession()
Gets the session

Returns:
the session

getContext

public com.openexchange.groupware.contexts.Context getContext()
Gets the context

Returns:
the context

setFiller

public void setFiller(MIMEMessageFiller filler)
Sets the mail filler

Parameters:
filler - The mail filler

cleanUp

public void cleanUp()
Cleans-up this composed mail's referenced uploaded files and frees temporary stored files.


getUnreadMessages

public int getUnreadMessages()
Description copied from class: MailMessage
Gets the number of unread messages

Specified by:
getUnreadMessages in class MailMessage
Returns:
The number of unread messages

setUnreadMessages

public void setUnreadMessages(int unreadMessages)
Description copied from class: MailMessage
Sets the number of unread messages

Specified by:
setUnreadMessages in class MailMessage
Parameters:
unreadMessages - The number of unread messages

getEnclosedCount

public abstract int getEnclosedCount()
                              throws MailException
Gets the number of enclosed mail parts.

Note: The returned number does not include the text body part applied with setBodyPart(TextBodyMailPart). To check for contained parts:

 composedMail.getEnclosedCount() > 0
 

Specified by:
getEnclosedCount in class MailPart
Returns:
The number of enclosed mail parts or MailPart.NO_ENCLOSED_PARTS if not applicable
Throws:
MailException
See Also:
MailPart.NO_ENCLOSED_PARTS

getEnclosedMailPart

public abstract MailPart getEnclosedMailPart(int index)
                                      throws MailException
Gets this composed mail's part located at given index.

Note: This method does not include the text body part applied with setBodyPart(TextBodyMailPart).

Specified by:
getEnclosedMailPart in class MailPart
Parameters:
index - The index of desired mail part or null if not applicable
Returns:
The mail part
Throws:
MailException

setBodyPart

public abstract void setBodyPart(TextBodyMailPart mailPart)
Sets this composed message's body part.

The body part's content is supposed to be HTML content which is ought to be converted to appropriate MIME type on transport.

Parameters:
mailPart - The body part

removeEnclosedPart

public abstract MailPart removeEnclosedPart(int index)
Removes the enclosed part at the specified position. Shifts any subsequent parts to the left (subtracts one from their indices). Returns the part that was removed.

Parameters:
index - The index position
Returns:
The removed part

addEnclosedPart

public abstract void addEnclosedPart(MailPart part)
Adds an instance of MailPart to enclosed parts

Parameters:
part - The instance of MailPart to add