net.fortuna.mstor.connector.mbox
Class MetaMessage

java.lang.Object
  extended by net.fortuna.mstor.connector.AbstractMessageDelegate
      extended by net.fortuna.mstor.connector.mbox.MetaMessage
All Implemented Interfaces:
MessageDelegate

public class MetaMessage
extends AbstractMessageDelegate

A JDOM-based implementation of a meta message.

Author:
benfortuna
 $Id$

 Created: 18/08/2004
 

Field Summary
protected static java.lang.String ATTRIBUTE_MESSAGE_NUMBER
           
protected static java.lang.String ATTRIBUTE_UID
           
protected static java.lang.String ELEMENT_MESSAGE
           
 
Constructor Summary
MetaMessage(org.jdom.Element element, MetaFolder folder, org.jdom.Namespace namespace)
          Constructs a new meta message instance based on the specified JDOM element.
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.
 
Method Summary
protected  org.jdom.Element getElement()
          Returns the underlying JDOM element.
 javax.mail.Flags getFlags()
          
 java.util.Date getForwarded()
          
 javax.mail.internet.InternetHeaders getHeaders()
          
 java.io.InputStream getInputStream()
          
 MessageDelegate getInReplyTo()
          
 int getMessageNumber()
          Returns the 1-based number of the message the delegate is associated with.
 java.util.Date getReceived()
          
 java.util.List<? extends MessageDelegate> getReferences()
          
 java.util.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(java.util.Date date)
          
 void setHeaders(java.util.Enumeration<javax.mail.Header> headers)
          
 void setReceived(java.util.Date date)
          
 void setReplied(java.util.Date date)
          
 void setUid(long uid)
          Sets the UID associated with the message.
 
Methods inherited from class net.fortuna.mstor.connector.AbstractMessageDelegate
setHeaders
 
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 java.lang.String ELEMENT_MESSAGE
See Also:
Constant Field Values

ATTRIBUTE_MESSAGE_NUMBER

protected static final java.lang.String ATTRIBUTE_MESSAGE_NUMBER
See Also:
Constant Field Values

ATTRIBUTE_UID

protected static final java.lang.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 java.util.Date getReceived()

Returns:
Returns the received.

setReceived

public final void setReceived(java.util.Date date)

Parameters:
date - The received to set.

getForwarded

public final java.util.Date getForwarded()

Returns:
Returns the forwarded.

setForwarded

public final void setForwarded(java.util.Date date)

Parameters:
date - The forwarded to set.

getReplied

public final java.util.Date getReplied()

Returns:
Returns the replied.

setReplied

public final void setReplied(java.util.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(java.util.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 java.lang.UnsupportedOperationException

Returns:
a message to which this is a reply to
Throws:
java.lang.UnsupportedOperationException - if this method is not supported by the message implementation

getReferences

public java.util.List<? extends MessageDelegate> getReferences()
                                                        throws java.lang.UnsupportedOperationException

Returns:
a list of messages related to this one
Throws:
java.lang.UnsupportedOperationException - if this method is not supported by the message implementation

getInputStream

public java.io.InputStream getInputStream()

Returns:
an input stream for message data


Copyright © 2004-2011 Micronode. All Rights Reserved.