Jwma

dtw.webmail.model
Class JwmaMessageInfoImpl

java.lang.Object
  |
  +--dtw.webmail.model.JwmaMessageInfoImpl
All Implemented Interfaces:
JwmaMessageInfo

public class JwmaMessageInfoImpl
extends java.lang.Object
implements JwmaMessageInfo

Class implementing the JwmaMessageInfo model. It is designed to wrap the minimum information of a mail message necessary to be listed in a list view.

Version:
0.9.7 07/02/2003
Author:
Dieter Wimberger

Method Summary
static JwmaMessageInfoImpl createJwmaMessageInfoImpl(javax.mail.Message msg)
          Factoy method that creates a new JwmaMessageInfoImpl instance.
 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.
 int getMessageNumber()
          Returns an int representing the number of this message.
 java.lang.Integer getNumberForSort()
          Returns the message's number as Integer.
 java.util.Date getReceivedDate()
          Returns a Date representing the date when the message was received.
 java.util.Date getSentDate()
          Returns a Date representing the date when the message was sent.
 int getSize()
          Returns the size of the message in bytes.
 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.
 java.lang.String getWho()
          Convenience method that returns a String representing the sender's or receiver's address of the message.
 boolean isAnswered()
          Tests if the message was answered.
 boolean isDeleted()
          Tests if the message was marked for deletion.
 boolean isDraft()
          Tests if the message is a draft.
 boolean isMultipart()
          Tests if the message is multipart.
 boolean isNew()
          Tests if the message is new.
 boolean isRead()
          Tests if the message was already read.
 boolean isReceived()
          Tests if the message was received.
 boolean isSent()
          Tests if the message was sent.
 boolean isSinglepart()
          Tests if the message is singlepart.
 void setMessageNumber(int num)
          Sets the message number of this MessageInfo.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMessageNumber

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

This number is the unique identifier for a message within a folder, and should be used on subsequent display, move or delete actions.

Specified by:
getMessageNumber in interface JwmaMessageInfo
Returns:
the number of this message.

getNumberForSort

public java.lang.Integer getNumberForSort()
Returns the message's number as Integer. This method is only used internally, and supposed to save a lot of resources, due to the fact that the standard collection sort Comparator does not need to create the wrapper instances on the fly for every comparison.

See Also:
MessageSortingUtil.NUMBER_NUMERICAL, MessageSortingUtil.NUMBER_REVERSE_NUMERICAL

setMessageNumber

public void setMessageNumber(int num)
Sets the message number of this MessageInfo. This method is public to allow caching in the JwmaMessageInfoListImpl. The number should reflect the number of the wrapped javax.mail.Message instance.

Parameters:
num - the number as int.
See Also:
JwmaMessageInfoListImpl.renumber()

isRead

public boolean isRead()
Description copied from interface: JwmaMessageInfo
Tests if the message was already read.

Specified by:
isRead in interface JwmaMessageInfo
Returns:
true if the message was read, false otherwise.

isDraft

public boolean isDraft()
Description copied from interface: JwmaMessageInfo
Tests if the message is a draft.

Specified by:
isDraft in interface JwmaMessageInfo
Returns:
true if the message is a draft, false otherwise.

isAnswered

public boolean isAnswered()
Description copied from interface: JwmaMessageInfo
Tests if the message was answered.

Specified by:
isAnswered in interface JwmaMessageInfo
Returns:
true if the message was answered, false otherwise.

isDeleted

public boolean isDeleted()
Description copied from interface: JwmaMessageInfo
Tests if the message was marked for deletion.

Specified by:
isDeleted in interface JwmaMessageInfo
Returns:
true if the message was marked for deletion, false otherwise.

isNew

public boolean isNew()
Description copied from interface: JwmaMessageInfo
Tests if the message is new.

Specified by:
isNew in interface JwmaMessageInfo
Returns:
true if the message is new, false otherwise.

isReceived

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

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

isSent

public boolean isSent()
Description copied from interface: JwmaMessageInfo
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 JwmaMessageInfo
Returns:
true if the message was sent, false otherwise.

getDate

public java.util.Date getDate()
Description copied from interface: JwmaMessageInfo
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 JwmaMessageInfo
Returns:
the received or sent date of the message.

getReceivedDate

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

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

getSentDate

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

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

getWho

public java.lang.String getWho()
Description copied from interface: JwmaMessageInfo
Convenience method that returns a String representing the sender's or receiver's address of the message. (Depending on whether it was sent or received).

Specified by:
getWho in interface JwmaMessageInfo
Returns:
the sender's or receiver's address of the message.

getFrom

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

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

getTo

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

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

getSubject

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

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

isSinglepart

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

A singlepart message does not have any attachments.

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

isMultipart

public boolean isMultipart()
Description copied from interface: JwmaMessageInfo
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 JwmaMessageInfo
Returns:
true if the message is multipart, false otherwise.

getSize

public int getSize()
Description copied from interface: JwmaMessageInfo
Returns the size of the message in bytes.

Specified by:
getSize in interface JwmaMessageInfo
Returns:
size of message in bytes as int.

createJwmaMessageInfoImpl

public static JwmaMessageInfoImpl createJwmaMessageInfoImpl(javax.mail.Message msg)
                                                     throws JwmaException
Factoy method that creates a new JwmaMessageInfoImpl instance. The passed in message should have been loaded with a slim profile. Values are extracted and set in the newly created instance.

Parameters:
msg - the message to be wrapped as javax.mail.Message.
JwmaException

Jwma

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