net.sourceforge.mflow.impl
Class MsgImpl

java.lang.Object
  extended bynet.sourceforge.mflow.impl.MsgImpl
All Implemented Interfaces:
Msg

public class MsgImpl
extends java.lang.Object
implements Msg

This class models a generic message. Msg contains a set of attributes and a "content".

Version:
$Revision: 1.4 $
Author:
David Carr

Constructor Summary
MsgImpl()
          No-arg version of the constructor, makes a blank Msg
MsgImpl(Msg m)
          Copy constructor, fills a new Msg with the values of an existing Msg
 
Method Summary
 void addContentHandler(ContentHandler ch)
          Adds a new ContentHandler
 void addRecipient(ContactMethod cm)
          Add this recipient ContactMethod to the existing ones.
 void addRecipients(ContactMethod[] cms)
          Add these recipient ContactMethods to the existing ones.
 void addReplyTo(ContactMethod cm)
          Add this ContactMethod to be replied to
 ContentHandler[] getContentHandlers()
          Return the ContentHandlers for the content
 Contact[] getFrom()
          Get the sender(s).
 java.util.Date getReceivedDate()
          Get the Date this Msg was received.
 ContactMethod[] getRecipients()
          Get all the recipient ContactMethods for the Msg.
 ContactMethod[] getReplyTo()
          Get the ContactMethods to which replies should be directed.
 java.util.Date getSentDate()
          Get the Date this Msg was sent.
 java.lang.String getSubject()
          Get the subject of this Msg
 java.lang.String getText()
          Convenience method to get the content of the Msg as a String
 boolean isNew()
          Accessor for the "new" state
 boolean isUnread()
          Accessor for the unread state
 Msg reply(boolean replyToAll)
          Get a new Msg suitable for a reply to this message.
 void setContentHandler(ContentHandler ch)
          Sets a new ContentHandler
 void setContentHandlers(ContentHandler[] chs)
          Sets the content of the Msg
 void setFrom(Contact c)
          Set the "from" Contact for this Msg.
 void setFrom(Contact[] cs)
          Set the "from" Contact(s) for this Msg.
 void setNew(boolean isNew)
          Mutator for the "new" state
 void setReceivedDate(java.util.Date d)
          Set the received Date
 void setRecipient(ContactMethod cm)
          Set the recipient ContactMethod.
 void setRecipients(ContactMethod[] cms)
          Set these recipient ContactMethods.
 void setReplyTo(ContactMethod cm)
          Set the address to which replies should be directed.
 void setReplyTo(ContactMethod[] cms)
          Set the addresses to which replies should be directed.
 void setSentDate(java.util.Date d)
          Set the sent Date
 void setSubject(java.lang.String s)
          Set the subject
 void setText(java.lang.String body)
          Convenience method to set the content of the Msg to a String
 void setUnread(boolean isUnread)
          Mutator for the unread state
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MsgImpl

public MsgImpl()
No-arg version of the constructor, makes a blank Msg


MsgImpl

public MsgImpl(Msg m)
Copy constructor, fills a new Msg with the values of an existing Msg

Parameters:
m - the Msg to copy attributes from
Method Detail

addRecipient

public void addRecipient(ContactMethod cm)
Add this recipient ContactMethod to the existing ones.

Specified by:
addRecipient in interface Msg
Parameters:
cm - the recipient

addRecipients

public void addRecipients(ContactMethod[] cms)
Add these recipient ContactMethods to the existing ones.

Specified by:
addRecipients in interface Msg
Parameters:
cms - the recipients

addReplyTo

public void addReplyTo(ContactMethod cm)
Add this ContactMethod to be replied to

Specified by:
addReplyTo in interface Msg
Parameters:
cm - the reply ContactMethod

getRecipients

public ContactMethod[] getRecipients()
Get all the recipient ContactMethods for the Msg.

Specified by:
getRecipients in interface Msg
Returns:
an array of the recipients for this Msg

getContentHandlers

public ContentHandler[] getContentHandlers()
Return the ContentHandlers for the content

Specified by:
getContentHandlers in interface Msg
Returns:
the ContentHandlers for the content

getFrom

public Contact[] getFrom()
Get the sender(s).

Specified by:
getFrom in interface Msg
Returns:
the sender(s) of this Msg.

getReceivedDate

public java.util.Date getReceivedDate()
Get the Date this Msg was received.

Specified by:
getReceivedDate in interface Msg
Returns:
the Date this Msg was received, or null if it wasn't received

getReplyTo

public ContactMethod[] getReplyTo()
Get the ContactMethods to which replies should be directed. This will usually be the sender of the message, but some messages may direct replies to a different ContactMethod.

Specified by:
getReplyTo in interface Msg
Returns:
an array of the ContactMethods to which replies to this Msg should be directed

getSentDate

public java.util.Date getSentDate()
Get the Date this Msg was sent.

Specified by:
getSentDate in interface Msg
Returns:
the Date this Msg was sent, or null if it wasn't sent

getSubject

public java.lang.String getSubject()
Get the subject of this Msg

Specified by:
getSubject in interface Msg
Returns:
the subject of this Msg

reply

public Msg reply(boolean replyToAll)
Get a new Msg suitable for a reply to this message. The new Msg will have its attributes set up appropriately. Note that this new Msg object will be empty, that is, it will not have a "content". These will have to be suitably filled in by the client. If replyToAll is set, the new Msg will be addressed to all recipients of this message. Otherwise, the reply will be addressed to only the sender of this message (using the value of the getReplyTo method). The "Subject" field is filled in with the original subject prefixed with "Re: " (unless it already starts with "Re:" (case insensitive)).

Specified by:
reply in interface Msg
Parameters:
replyToAll - whether to reply to all recipients of the original message, or just the reply-to ContactMethods
Returns:
a message to use for the reply

addContentHandler

public void addContentHandler(ContentHandler ch)
Adds a new ContentHandler

Specified by:
addContentHandler in interface Msg
Parameters:
ch - the new ContentHandler

setContentHandler

public void setContentHandler(ContentHandler ch)
Sets a new ContentHandler

Specified by:
setContentHandler in interface Msg
Parameters:
ch - the new ContentHandler

setContentHandlers

public void setContentHandlers(ContentHandler[] chs)
Sets the content of the Msg

Specified by:
setContentHandlers in interface Msg
Parameters:
chs - the new ContentHandlers

setFrom

public void setFrom(Contact c)
Set the "from" Contact for this Msg.

Specified by:
setFrom in interface Msg
Parameters:
c - the Contact for the sender

setFrom

public void setFrom(Contact[] cs)
Set the "from" Contact(s) for this Msg.

Specified by:
setFrom in interface Msg
Parameters:
cs - the new sender Contact(s)

setReceivedDate

public void setReceivedDate(java.util.Date d)
Set the received Date

Specified by:
setReceivedDate in interface Msg
Parameters:
d - the Date the Msg was received

setRecipient

public void setRecipient(ContactMethod cm)
Set the recipient ContactMethod. All ContactMethodare replaced by the ContactMethod parameter.

Specified by:
setRecipient in interface Msg
Parameters:
cm - the recipient

setRecipients

public void setRecipients(ContactMethod[] cms)
Set these recipient ContactMethods. Eliminates all previous recipients.

Specified by:
setRecipients in interface Msg
Parameters:
cms - the recipients

setReplyTo

public void setReplyTo(ContactMethod cm)
Set the address to which replies should be directed.

Specified by:
setReplyTo in interface Msg
Parameters:
cm - the reply ContactMethod

setReplyTo

public void setReplyTo(ContactMethod[] cms)
Set the addresses to which replies should be directed. (Normally only a single address will be specified.)

Specified by:
setReplyTo in interface Msg
Parameters:
cms - the reply ContactMethods

setSentDate

public void setSentDate(java.util.Date d)
Set the sent Date

Specified by:
setSentDate in interface Msg
Parameters:
d - the Date the Msg was sent

setSubject

public void setSubject(java.lang.String s)
Set the subject

Specified by:
setSubject in interface Msg
Parameters:
s - the subject

getText

public java.lang.String getText()
Convenience method to get the content of the Msg as a String

Specified by:
getText in interface Msg
Returns:
a String content

setText

public void setText(java.lang.String body)
Convenience method to set the content of the Msg to a String

Specified by:
setText in interface Msg
Parameters:
body - the text to set as the content

setUnread

public void setUnread(boolean isUnread)
Mutator for the unread state

Specified by:
setUnread in interface Msg
Parameters:
isUnread - whether the Msg has not been read

setNew

public void setNew(boolean isNew)
Mutator for the "new" state

Specified by:
setNew in interface Msg
Parameters:
isNew - whether the Msg is "new"

isUnread

public boolean isUnread()
Accessor for the unread state

Specified by:
isUnread in interface Msg
Returns:
whether the Msg has not been read

isNew

public boolean isNew()
Accessor for the "new" state

Specified by:
isNew in interface Msg
Returns:
whether the Msg is "new"


Copyright © 2002-2004 MFlow Group. All Rights Reserved.