net.fortuna.mstor.data
Class MetaMessageImpl

java.lang.Object
  extended by net.fortuna.mstor.data.MetaMessageImpl
All Implemented Interfaces:
Serializable, MetaMessage

public class MetaMessageImpl
extends Object
implements MetaMessage

A JDOM-based implementation of a meta message.

Author:
benfortuna
See Also:
Serialized Form

Field Summary
protected static String ATTRIBUTE_MESSAGE_NUMBER
           
protected static String ELEMENT_MESSAGE
           
 
Constructor Summary
MetaMessageImpl(Element element, MetaFolder folder)
          Constructs a new meta message instance based on the specified JDOM element.
MetaMessageImpl(int messageNumber, MetaFolder folder)
          Constructs a new meta message instance based on a new JDOM element with the specified message id.
 
Method Summary
protected  Element getElement()
          Returns the underlying JDOM element.
 Flags getFlags()
           
 MetaFolder getFolder()
          Returns the meta folder this message belongs to.
 Date getForwarded()
           
 InternetHeaders getHeaders()
           
 int getMessageNumber()
          Returns the 1-based number of the message the metadata is associated with.
 Date getReceived()
           
 Date getReplied()
           
 boolean isExpunged()
           
 void setExpunged(boolean flag)
           
 void setFlags(Flags flags)
           
 void setForwarded(Date date)
           
 void setHeaders(Enumeration headers)
           
 void setHeaders(InternetHeaders headers)
          Saves headers to metadata.
 void setReceived(Date date)
           
 void setReplied(Date date)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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
Constructor Detail

MetaMessageImpl

public MetaMessageImpl(int messageNumber,
                       MetaFolder folder)
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

MetaMessageImpl

public MetaMessageImpl(Element element,
                       MetaFolder folder)
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 Element getElement()
Returns the underlying JDOM element.

Returns:
a JDOM element

getMessageNumber

public final int getMessageNumber()
Description copied from interface: MetaMessage
Returns the 1-based number of the message the metadata 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).

Specified by:
getMessageNumber in interface MetaMessage
Returns:
the message number associated with this metadata, or zero if no message number is identified

getReceived

public final Date getReceived()
Specified by:
getReceived in interface MetaMessage
Returns:
Returns the received.

setReceived

public final void setReceived(Date date)
Specified by:
setReceived in interface MetaMessage
Parameters:
date - The received to set.

getForwarded

public final Date getForwarded()
Specified by:
getForwarded in interface MetaMessage
Returns:
Returns the forwarded.

setForwarded

public final void setForwarded(Date date)
Specified by:
setForwarded in interface MetaMessage
Parameters:
date - The forwarded to set.

getReplied

public final Date getReplied()
Specified by:
getReplied in interface MetaMessage
Returns:
Returns the replied.

setReplied

public final void setReplied(Date date)
Specified by:
setReplied in interface MetaMessage
Parameters:
date - The replied to set.

isExpunged

public final boolean isExpunged()
Specified by:
isExpunged in interface MetaMessage
Returns:
Returns the expunged.

setExpunged

public final void setExpunged(boolean flag)
Specified by:
setExpunged in interface MetaMessage
Parameters:
flag - The expunged to set.

getFlags

public final Flags getFlags()
Specified by:
getFlags in interface MetaMessage
Returns:
Returns the flags.

setFlags

public final void setFlags(Flags flags)
Specified by:
setFlags in interface MetaMessage
Parameters:
flags - The flags to set.

getHeaders

public final InternetHeaders getHeaders()
Specified by:
getHeaders in interface MetaMessage
Returns:
headers saved in metadata

setHeaders

public final void setHeaders(InternetHeaders headers)
Description copied from interface: MetaMessage
Saves headers to metadata. Implementations may choose to only save a subset of the specified headers.

Specified by:
setHeaders in interface MetaMessage
Parameters:
headers - headers to save to metadata

setHeaders

public final void setHeaders(Enumeration headers)
Specified by:
setHeaders in interface MetaMessage

getFolder

public final MetaFolder getFolder()
Description copied from interface: MetaMessage
Returns the meta folder this message belongs to.

Specified by:
getFolder in interface MetaMessage
Returns:
a meta folder