com.openexchange.mail.dataobjects
Class IDMailMessage

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

public final class IDMailMessage
extends MailMessage

IDMailMessage - Supports only getMailId() and MailMessage.getFolder().

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
 
Constructor Summary
IDMailMessage(java.lang.String mailId, java.lang.String folder)
          Initializes a new IDMailMessage
 
Method Summary
 java.lang.Object getContent()
          Returns the part's content as a Java object dependent on underlying implementation.
 javax.activation.DataHandler getDataHandler()
          Returns an appropriate DataHandler for this mail part.
 int getEnclosedCount()
          Gets the number of enclosed mail parts.
 MailPart getEnclosedMailPart(int index)
          Gets the mail part located at given index.
 java.io.InputStream getInputStream()
          Returns an input stream for this part.
 java.lang.String getMailId()
          Gets the implementation-specific unique ID of this mail in its mail folder.
 char getSeparator()
          Gets the separator.
 int getSeqnum()
          Gets the sequence number.
 int getUnreadMessages()
          Gets the number of unread messages
 void loadContent()
          Ensures that the part's content is loaded, thus this part is independent of the original.
 void prepareForCaching()
          Prepares this mail part to be put into cache; meaning to release all kept resources
 void setMailId(java.lang.String id)
          Sets the implementation-specific unique mail ID of this mail in its mail folder.
 void setSeparator(char separator)
          Sets the separator.
 void setSeqnum(int seqnum)
          Sets the sequence number.
 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, 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, 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, getContentDisposition, getContentId, getContentType, getFileName, getFirstHeader, getHeader, getHeader, getHeader, getHeaders, getHeadersIterator, getHeadersSize, getMatchingHeaders, getMsgref, getNonMatchingHeaders, getSequenceId, getSize, getSource, getSourceBytes, hasEnclosedParts, hasHeaders, 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
 

Constructor Detail

IDMailMessage

public IDMailMessage(java.lang.String mailId,
                     java.lang.String folder)
Initializes a new IDMailMessage

Method Detail

getMailId

public java.lang.String getMailId()
Description copied from class: MailMessage
Gets the implementation-specific unique ID of this mail in its mail folder. The ID returned by this method is used in storages to refer to a mail.

Note If ID is numeric, max. 52 bits may be used in returned value which implies a max. allowed value of 4503599627370495.

Specified by:
getMailId in class MailMessage
Returns:
The ID of this mail or null if not available.

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

setMailId

public void setMailId(java.lang.String id)
Description copied from class: MailMessage
Sets the implementation-specific unique mail ID of this mail in its mail folder. The ID returned by this method is used in storages to refer to a mail.

Note If ID is numeric, max. 52 bits may be used in specified value which implies a max. allowed value of 4503599627370495.

Specified by:
setMailId in class MailMessage
Parameters:
id - The mail ID or null to indicate its absence

getSeparator

public char getSeparator()
Gets the separator.

Returns:
The separator

setSeparator

public void setSeparator(char separator)
Sets the separator.

Parameters:
separator - The separator to set

getSeqnum

public int getSeqnum()
Gets the sequence number.

Returns:
The sequence number

setSeqnum

public void setSeqnum(int seqnum)
Sets the sequence number.

Parameters:
seqnum - The sequence number to set

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

getContent

public java.lang.Object getContent()
                            throws MailException
Description copied from class: MailPart
Returns the part's content as a Java object dependent on underlying implementation.
This method is not applicable if part's MIME type is multipart/*

Specified by:
getContent in class MailPart
Returns:
The content as a Java object or null if not applicable
Throws:
MailException - If content cannot be returned as a Java object

getDataHandler

public javax.activation.DataHandler getDataHandler()
                                            throws MailException
Description copied from class: MailPart
Returns an appropriate DataHandler for this mail part.
This method is not applicable if part's MIME type is multipart/*

Specified by:
getDataHandler in class MailPart
Returns:
an appropriate DataHandler or null if not applicable
Throws:
MailException - If an appropriate DataHandler cannot be returned

getEnclosedCount

public int getEnclosedCount()
                     throws MailException
Description copied from class: MailPart
Gets the number of enclosed mail parts.
This method is only applicable if part's MIME type is multipart/*

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 MailPart getEnclosedMailPart(int index)
                             throws MailException
Description copied from class: MailPart
Gets the mail part located at given index.
This method is only applicable if part's MIME type is multipart/*

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

getInputStream

public java.io.InputStream getInputStream()
                                   throws MailException
Description copied from class: MailPart
Returns an input stream for this part.
This method is not applicable if part's MIME type is multipart/*

Specified by:
getInputStream in class MailPart
Returns:
An input stream for this part or null if not applicable
Throws:
MailException - If no input stream could be returned

loadContent

public void loadContent()
                 throws MailException
Description copied from class: MailPart
Ensures that the part's content is loaded, thus this part is independent of the original.

This method is intended for mailing systems that read the contents stepwise on demand. If dealing with such a mail part with its underlying connection closed, the part's content is no more accessible. Otherwise this method may be implemented with an empty body.

Moreover the loaded content is no more discarded when MailPart.prepareForCaching() is invoked.

Specified by:
loadContent in class MailPart
Throws:
MailException - If loading part's content fails

prepareForCaching

public void prepareForCaching()
Description copied from class: MailPart
Prepares this mail part to be put into cache; meaning to release all kept resources

Specified by:
prepareForCaching in class MailPart