Package net.fortuna.mstor.connector.mbox
Class MetaMessage
- java.lang.Object
-
- net.fortuna.mstor.connector.AbstractMessageDelegate
-
- net.fortuna.mstor.connector.mbox.MetaMessage
-
- All Implemented Interfaces:
MessageDelegate
public class MetaMessage extends AbstractMessageDelegate
A JDOM-based implementation of a meta message.
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
ATTRIBUTE_MESSAGE_NUMBER
protected static String
ATTRIBUTE_UID
protected static String
ELEMENT_MESSAGE
-
Constructor Summary
Constructors Constructor Description MetaMessage(int messageNumber, MetaFolder folder, org.jdom.Namespace namespace)
Constructs a new meta message instance based on a new JDOM element with the specified message id.MetaMessage(org.jdom.Element element, MetaFolder folder, org.jdom.Namespace namespace)
Constructs a new meta message instance based on the specified JDOM element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.jdom.Element
getElement()
Returns the underlying JDOM element.javax.mail.Flags
getFlags()
Date
getForwarded()
javax.mail.internet.InternetHeaders
getHeaders()
InputStream
getInputStream()
MessageDelegate
getInReplyTo()
int
getMessageNumber()
Returns the 1-based number of the message the delegate is associated with.Date
getReceived()
List<? extends MessageDelegate>
getReferences()
Date
getReplied()
long
getUid()
Returns the UID associated with the message.boolean
isExpunged()
void
saveChanges()
Persist unsaved changes.void
setExpunged(boolean flag)
void
setFlags(javax.mail.Flags flags)
void
setForwarded(Date date)
void
setHeaders(Enumeration<javax.mail.Header> headers)
void
setReceived(Date date)
void
setReplied(Date date)
void
setUid(long uid)
Sets the UID associated with the message.-
Methods inherited from class net.fortuna.mstor.connector.AbstractMessageDelegate
setHeaders
-
-
-
-
Field Detail
-
ELEMENT_MESSAGE
protected static final String ELEMENT_MESSAGE
- See Also:
- Constant Field Values
-
ATTRIBUTE_MESSAGE_NUMBER
protected static final String ATTRIBUTE_MESSAGE_NUMBER
- See Also:
- Constant Field Values
-
ATTRIBUTE_UID
protected static final String ATTRIBUTE_UID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MetaMessage
public MetaMessage(int messageNumber, MetaFolder folder, org.jdom.Namespace namespace)
Constructs a new meta message instance based on a new JDOM element with the specified message id.- Parameters:
messageId
- the message id of the new meta message
-
MetaMessage
public MetaMessage(org.jdom.Element element, MetaFolder folder, org.jdom.Namespace namespace)
Constructs a new meta message instance based on the specified JDOM element.- Parameters:
element
- a JDOM element for the meta message
-
-
Method Detail
-
getElement
protected final org.jdom.Element getElement()
Returns the underlying JDOM element.- Returns:
- a JDOM element
-
getMessageNumber
public final int getMessageNumber()
Returns the 1-based number of the message the delegate is associated with. If a message number is not set it is assumed the message does not belong to a folder and thus has a message number of zero (0).- Returns:
- the message number associated with this delegate, or zero if no message number is identified
-
getReceived
public final Date getReceived()
- Returns:
- Returns the received.
-
setReceived
public final void setReceived(Date date)
- Parameters:
date
- The received to set.
-
getForwarded
public final Date getForwarded()
- Returns:
- Returns the forwarded.
-
setForwarded
public final void setForwarded(Date date)
- Parameters:
date
- The forwarded to set.
-
getReplied
public final Date getReplied()
- Returns:
- Returns the replied.
-
setReplied
public final void setReplied(Date date)
- Parameters:
date
- The replied to set.
-
isExpunged
public final boolean isExpunged()
- Returns:
- Returns the expunged.
-
setExpunged
public final void setExpunged(boolean flag)
- Parameters:
flag
- The expunged to set.
-
getFlags
public final javax.mail.Flags getFlags()
- Returns:
- Returns the flags.
-
setFlags
public final void setFlags(javax.mail.Flags flags)
- Parameters:
flags
- The flags to set.
-
getHeaders
public final javax.mail.internet.InternetHeaders getHeaders()
- Returns:
- headers saved in delegate
-
setHeaders
public final void setHeaders(Enumeration<javax.mail.Header> headers)
- Parameters:
headers
- an enumeration of headers to attach to the message
-
saveChanges
public void saveChanges() throws DelegateException
Persist unsaved changes.- Throws:
DelegateException
- where an error occurs saving changes in the message
-
getUid
public long getUid()
Returns the UID associated with the message.- Returns:
- a long representation of a UID, or -1 if no UID is assigned
-
setUid
public void setUid(long uid)
Sets the UID associated with the message.- Parameters:
uid
- a UID value to associate with the message
-
getInReplyTo
public MessageDelegate getInReplyTo() throws UnsupportedOperationException
- Returns:
- a message to which this is a reply to
- Throws:
UnsupportedOperationException
- if this method is not supported by the message implementation
-
getReferences
public List<? extends MessageDelegate> getReferences() throws UnsupportedOperationException
- Returns:
- a list of messages related to this one
- Throws:
UnsupportedOperationException
- if this method is not supported by the message implementation
-
getInputStream
public InputStream getInputStream()
- Returns:
- an input stream for message data
-
-