Jwma

dtw.webmail.model
Class JwmaComposeMessage

java.lang.Object
  |
  +--dtw.webmail.model.JwmaComposeMessage
All Implemented Interfaces:
JwmaMessage

public class JwmaComposeMessage
extends java.lang.Object
implements JwmaMessage

Class implementing the JwmaComposeMessage model. *

* This implementation is specialized to wrap a * javax.mail.Message for composing. * * @author Dieter Wimberger * @version 0.9.7 07/02/2003


Field Summary
static java.lang.String X_MAILER_STRING
          Defines the X-MAILER set by jwma.
 
Method Summary
 void addAttachments(javax.mail.internet.MimeMultipart mmp)
          Adds attachments to this JwmaComposeMessage.
 void appendBody(java.lang.String str)
          Appends to the body of the message.
 void closeDraft(JwmaStoreImpl store)
           
static JwmaComposeMessage createDraft(javax.mail.Message msg)
           
static JwmaComposeMessage createForward(javax.mail.Session ses, JwmaDisplayMessage msg, java.lang.String to, JwmaPreferences prefs, boolean togglequote, boolean attfwd)
          Creates a JwmaComposeMessage instance.
static JwmaComposeMessage createJwmaComposeMessage(javax.mail.Session ses)
          Creates a JwmaComposeMessage instance.
static JwmaComposeMessage createReply(JwmaDisplayMessage msg, boolean toall, JwmaPreferences prefs, boolean togglequote)
          Creates a JwmaComposeMessage instance.
 java.lang.String getBCCTo()
          Returns a String representing the blind carbon copy receivers(s) of the message.
 java.lang.String getBody()
          Returns a String representing the body of the message.
 java.lang.String getCCTo()
          Returns a String representing the carbon copy receivers(s) of the message.
 java.util.Date getDate()
          Convenience method that returns a Date representing the received or sent date of the message.
 java.lang.String getFrom()
          Returns a String representing the sender(s) of the message.
 java.lang.String getFullHeader()
          Returns the full message header as String.
 javax.mail.Message getMessage()
          Returns the Message instance associated * with this JwmaComposeMessage.
 int getMessageNumber()
          Returns an int representing the number of this message.
 JwmaMessagePart[] getMessageParts()
          Returns an array of JwmaMessagePart objects.
 java.util.Date getReceivedDate()
          Returns a Date representing the date when the message was received.
 java.lang.String getReplyTo()
          Returns a String representing the Reply-To address(es) of the message.
 java.util.Date getSentDate()
          Returns a Date representing the date when the message was sent.
 java.lang.String getSubject()
          Returns a String representing the subject of the message.
 java.lang.String getTo()
          Returns a String representing the receivers(s) of the message.
 boolean isDraft()
           
 boolean isInvisibleToList()
           
 boolean isMultipart()
          Tests if the message is multipart.
 boolean isReceived()
          Tests if the message was received.
 boolean isReply()
          Tests if the message is a reply.
 boolean isSent()
          Tests if the message was sent.
 boolean isSinglepart()
          Tests if the message is singlepart.
 void openDraft(JwmaStoreImpl store)
           
 void send(JwmaSession ses)
          Sends this instance via the standard convenience Transport.send().
 void setBCCTo(java.lang.String bccto)
          Sets the blind carbon copy receiver's address(es) of the message.
 void setBody(java.lang.String body)
          Sets the body of the message.
 void setCCTo(java.lang.String ccto)
          Sets the carbon copy receiver's address(es) of the message.
 void setFrom(java.lang.String from)
          Set the sender(s) address of the message.
 void setInvisibleToList(boolean invisibleToList)
           
 void setReplyTo(java.lang.String from)
          Set the Reply-To address(es) of the message.
 void setSubject(java.lang.String subject)
          Sets the subject of the message.
 void setTo(java.lang.String to)
          Sets the receiver's address(es) of the message as * String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

X_MAILER_STRING

public static final java.lang.String X_MAILER_STRING
Defines the X-MAILER set by jwma. * This can probably help one day to recognize special mailer features.

See Also:
Constant Field Values
Method Detail

getFullHeader

public java.lang.String getFullHeader()
Description copied from interface: JwmaMessage
Returns the full message header as String.

Specified by:
getFullHeader in interface JwmaMessage
Returns:
the full message header as String.

getMessageNumber

public int getMessageNumber()
Description copied from interface: JwmaMessage
Returns an int representing the number of this message.

This number is the unique identifier for a message within a folder, or -1 in case of a message created for being composed.

Specified by:
getMessageNumber in interface JwmaMessage
Returns:
the number of this message, or -1 if newly created for composing.

getReceivedDate

public java.util.Date getReceivedDate()
Description copied from interface: JwmaMessage
Returns a Date representing the date when the message was received.

Specified by:
getReceivedDate in interface JwmaMessage
Returns:
the received date of the message.

getSentDate

public java.util.Date getSentDate()
Description copied from interface: JwmaMessage
Returns a Date representing the date when the message was sent.

Specified by:
getSentDate in interface JwmaMessage
Returns:
the sent date of the message.

getDate

public java.util.Date getDate()
Description copied from interface: JwmaMessage
Convenience method that returns a Date representing the received or sent date of the message. (Depending on whether it was sent or received).

Specified by:
getDate in interface JwmaMessage
Returns:
the received or sent date of the message.

isSent

public boolean isSent()
Description copied from interface: JwmaMessage
Tests if the message was sent.

Note that this method will always return the opposite of isReceived() (i.e. represents !getReceived()).

Specified by:
isSent in interface JwmaMessage
Returns:
true if the message was sent, false otherwise.

isReceived

public boolean isReceived()
Description copied from interface: JwmaMessage
Tests if the message was received.

Specified by:
isReceived in interface JwmaMessage
Returns:
true if the message was received, false otherwise.

isReply

public boolean isReply()
Tests if the message is a reply. * * @return true if the message is a reply, * false otherwise.


isDraft

public boolean isDraft()

getFrom

public java.lang.String getFrom()
Description copied from interface: JwmaMessage
Returns a String representing the sender(s) of the message.

Specified by:
getFrom in interface JwmaMessage
Returns:
the sender(s) of the message as String.

setFrom

public void setFrom(java.lang.String from)
Set the sender(s) address of the message. * * @param from the sender(s) address of the message * as String.


getReplyTo

public java.lang.String getReplyTo()
Description copied from interface: JwmaMessage
Returns a String representing the Reply-To address(es) of the message.

Specified by:
getReplyTo in interface JwmaMessage
Returns:
the Reply-To address(es) of the message as String.

setReplyTo

public void setReplyTo(java.lang.String from)
Set the Reply-To address(es) of the message. * * @param from the Reply-To address(es) of the message * as String.


getTo

public java.lang.String getTo()
Description copied from interface: JwmaMessage
Returns a String representing the receivers(s) of the message.

Specified by:
getTo in interface JwmaMessage
Returns:
the receiver(s) of the message as String.

setTo

public void setTo(java.lang.String to)
           throws javax.mail.MessagingException
Sets the receiver's address(es) of the message as * String. * * @param to the receiver(s) address(es) of the message as String. * * @throws MessagingException if the receiver's address(es) is (are) malformed.

javax.mail.MessagingException

isInvisibleToList

public boolean isInvisibleToList()

setInvisibleToList

public void setInvisibleToList(boolean invisibleToList)

getCCTo

public java.lang.String getCCTo()
Description copied from interface: JwmaMessage
Returns a String representing the carbon copy receivers(s) of the message.

Specified by:
getCCTo in interface JwmaMessage
Returns:
the carbon copy receiver(s) of the message as String.

setCCTo

public void setCCTo(java.lang.String ccto)
             throws javax.mail.MessagingException
Sets the carbon copy receiver's address(es) of the message. * * @param to the carbon copy receiver(s) address(es) of the * message as String. * * @throws MessagingException if the carbon copy receiver's address(es) * is (are) malformed.

javax.mail.MessagingException

getBCCTo

public java.lang.String getBCCTo()
Description copied from interface: JwmaMessage
Returns a String representing the blind carbon copy receivers(s) of the message.

Specified by:
getBCCTo in interface JwmaMessage
Returns:
the blind carbon copy receiver(s) of the message as String.

setBCCTo

public void setBCCTo(java.lang.String bccto)
              throws javax.mail.MessagingException
Sets the blind carbon copy receiver's address(es) of the message. * * @param to the blind carbon copy receiver(s) address(es) of the * message as String. * * @throws MessagingException if the blind carbon copy receiver's address(es) * is (are) malformed.

javax.mail.MessagingException

getSubject

public java.lang.String getSubject()
Description copied from interface: JwmaMessage
Returns a String representing the subject of the message.

Specified by:
getSubject in interface JwmaMessage
Returns:
the subject of the message as String.

setSubject

public void setSubject(java.lang.String subject)
                throws JwmaException
Sets the subject of the message. * * @param subject the subject of the message as String. * * @throws JwmaException if the string is malformed (encoding, null).

JwmaException

getBody

public java.lang.String getBody()
Description copied from interface: JwmaMessage
Returns a String representing the body of the message.

Note that the body will be the (plain text) content of a singlepart message. The method will return an empty String for a multipart message.

A view programmer should base display decisions on the isSinglepart() (or isMultipart() method.

Specified by:
getBody in interface JwmaMessage
Returns:
the content of the message as String.
See Also:
JwmaMessage.isSinglepart(), JwmaMessage.isMultipart()

setBody

public void setBody(java.lang.String body)
Sets the body of the message. *

* Note that the body will be the text/plain content of * a singlepart message, and attached as text/plain part to * a multipart message. * * @param body the text/plain content of the message as * String.


appendBody

public void appendBody(java.lang.String str)
Appends to the body of the message. * * @param str more text/plain content for the * message as String.


addAttachments

public void addAttachments(javax.mail.internet.MimeMultipart mmp)
Adds attachments to this JwmaComposeMessage. * * @param mmp the MimeMultipart that represents the * attachments.


isSinglepart

public boolean isSinglepart()
Description copied from interface: JwmaMessage
Tests if the message is singlepart.

A singlepart message does not have any attachments.

Specified by:
isSinglepart in interface JwmaMessage
Returns:
true if the message is singlepart, false otherwise.

isMultipart

public boolean isMultipart()
Description copied from interface: JwmaMessage
Tests if the message is multipart.

A multipart message has attachments or is composed out of different parts. Note that this method will always return the opposite of isSinglepart() (i.e. represents !isSinglepart()).

Specified by:
isMultipart in interface JwmaMessage
Returns:
true if the message is multipart, false otherwise.

getMessageParts

public JwmaMessagePart[] getMessageParts()
Description copied from interface: JwmaMessage
Returns an array of JwmaMessagePart objects.

If this message does not contain any parts, then this method returns an empty array. Otherwise it contains one JwmaMessagePart object for each part of this message representing information about the part.

A view programmer should base display decisions on the isSinglepart() (or isMultipart() method.

Specified by:
getMessageParts in interface JwmaMessage
Returns:
an array of JwmaMessagePart objects each representing information about a part of this message. The array will be empty if this message has no parts.
See Also:
JwmaMessagePart, JwmaMessage.isSinglepart(), JwmaMessage.isMultipart()

getMessage

public javax.mail.Message getMessage()
Returns the Message instance associated * with this JwmaComposeMessage. * * @return associated Message instance.


send

public void send(JwmaSession ses)
          throws JwmaException
Sends this instance via the standard convenience Transport.send(). *

* Asserts that a sender is set, and creates either a multipart * or a singlepart Message from the data stored * in this instance. * * @throws JwmaException If there is no sender, or if sending fails.

JwmaException

openDraft

public void openDraft(JwmaStoreImpl store)
               throws JwmaException
JwmaException

closeDraft

public void closeDraft(JwmaStoreImpl store)
                throws JwmaException
JwmaException

createJwmaComposeMessage

public static JwmaComposeMessage createJwmaComposeMessage(javax.mail.Session ses)
Creates a JwmaComposeMessage instance. *

This factory method should be used to create new instances * of JwmaComposeMessage, which are not a reply to * an already existing message. * * @param ses the mail Session the message is created within. * @return the newly created instance.


createReply

public static JwmaComposeMessage createReply(JwmaDisplayMessage msg,
                                             boolean toall,
                                             JwmaPreferences prefs,
                                             boolean togglequote)
                                      throws JwmaException
Creates a JwmaComposeMessage instance. *

This factory method should be used to create new instances * of JwmaComposeMessage, which are a reply to * an already existing message. *

The reply will address the sender, and if flagged, also all * recipients of the original Message. * * * @param msg the Message to be replied. * @param toall a flag determining wheter the reply should address also all * recipients of the original Message. * @return the newly created instance. * @throws JwmaException if it fails to create the new instance.

JwmaException

createForward

public static JwmaComposeMessage createForward(javax.mail.Session ses,
                                               JwmaDisplayMessage msg,
                                               java.lang.String to,
                                               JwmaPreferences prefs,
                                               boolean togglequote,
                                               boolean attfwd)
                                        throws JwmaException
Creates a JwmaComposeMessage instance. *

This factory method should be used to create new instances * of JwmaComposeMessage, which are a reply to * an already existing message. *

The reply will address the sender, and if flagged, also all * recipients of the original Message. * * * @param msg the Message to be replied. * @param toall a flag determining wheter the reply should address also all * recipients of the original Message. * @return the newly created instance. * @throws JwmaException if it fails to create the new instance.

JwmaException

createDraft

public static JwmaComposeMessage createDraft(javax.mail.Message msg)
                                      throws JwmaException
JwmaException

Jwma

Copyright © 2000-2003 jwma team (All Rights Reserved.)