001: /***
002: * jwma Java WebMail
003: * Copyright (c) 2000-2003 jwma team
004: *
005: * jwma is free software; you can distribute and use this source
006: * under the terms of the BSD-style license received along with
007: * the distribution.
008: ***/package dtw.webmail.model;
009:
010: import java.util.Date;
011:
012: /**
013: * An interface defining the contract for interaction with
014: * the JwmaMessageInfo model.
015: * <p>
016: * The JwmaMessageInfo allows a view programmer to obtain
017: * enough information about a message to show it in a list
018: * of messages. It could be considered as a lightweight proxy
019: * interface, concentrated on providing information for lists
020: * of messages.
021: *
022: * @author Dieter Wimberger
023: * @version 0.9.7 07/02/2003
024: *
025: * @see dtw.webmail.model.JwmaFolder
026: */
027: public interface JwmaMessageInfo {
028:
029: /**
030: * Returns an <tt>int</tt> representing the number
031: * of this message.
032: * <p>
033: * This number is the unique identifier for a message within
034: * a folder, and should be used on subsequent display, move
035: * or delete actions.
036: *
037: * @return the number of this message.
038: */
039: public int getMessageNumber();
040:
041: /**
042: * Tests if the message was already read.
043: *
044: * @return true if the message was read,
045: * false otherwise.
046: */
047: public boolean isRead();
048:
049: /**
050: * Tests if the message was answered.
051: *
052: * @return true if the message was answered,
053: * false otherwise.
054: */
055: public boolean isAnswered();
056:
057: /**
058: * Tests if the message was marked for deletion.
059: *
060: * @return true if the message was marked for deletion,
061: * false otherwise.
062: */
063: public boolean isDeleted();
064:
065: /**
066: * Tests if the message is new.
067: *
068: * @return true if the message is new,
069: * false otherwise.
070: */
071: public boolean isNew();
072:
073: /**
074: * Tests if the message is a draft.
075: *
076: * @return true if the message is a draft,
077: * false otherwise.
078: */
079: public boolean isDraft();
080:
081: /**
082: * Tests if the message was received.
083: *
084: * @return true if the message was received,
085: * false otherwise.
086: */
087: public boolean isReceived();
088:
089: /**
090: * Tests if the message was sent.
091: * <p>
092: * Note that this method will always return the opposite of
093: * isReceived() (i.e. represents !getReceived()).
094: *
095: * @return true if the message was sent,
096: * false otherwise.
097: */
098: public boolean isSent();
099:
100: /**
101: * Convenience method that returns a <tt>String</tt>
102: * representing the sender's or receiver's address of the message.
103: * (Depending on whether it was sent or received).
104: *
105: * @return the sender's or receiver's address of the message.
106: */
107: public String getWho();
108:
109: /**
110: * Returns a <tt>String</tt> representing the sender(s)
111: * of the message.
112: *
113: * @return the sender(s) of the message as String.
114: */
115: public String getFrom();
116:
117: /**
118: * Returns a <tt>String</tt> representing the receivers(s)
119: * of the message.
120: *
121: * @return the receiver(s) of the message as String.
122: */
123: public String getTo();
124:
125: /**
126: * Convenience method that returns a <tt>Date</tt>
127: * representing the received or sent date of the message.
128: * (Depending on whether it was sent or received).
129: *
130: * @return the received or sent date of the message.
131: */
132: public Date getDate();
133:
134: /**
135: * Returns a <tt>Date</tt> representing the
136: * date when the message was received.
137: *
138: * @return the received date of the message.
139: */
140: public Date getReceivedDate();
141:
142: /**
143: * Returns a <tt>Date</tt> representing the
144: * date when the message was sent.
145: *
146: * @return the sent date of the message.
147: */
148: public Date getSentDate();
149:
150: /**
151: * Returns a <tt>String</tt> representing the subject
152: * of the message.
153: *
154: * @return the subject of the message as String.
155: */
156: public String getSubject();
157:
158: /**
159: * Tests if the message is singlepart.
160: * <p>
161: * A singlepart message does not have any
162: * attachments.
163: *
164: * @return true if the message is singlepart,
165: * false otherwise.
166: */
167: public boolean isSinglepart();
168:
169: /**
170: * Tests if the message is multipart.
171: * <p>
172: * A multipart message has attachments
173: * or is composed out of different parts.
174: * Note that this method will always return the opposite
175: * of isSinglepart() (i.e. represents !isSinglepart()).
176: *
177: * @return true if the message is multipart,
178: * false otherwise.
179: */
180: public boolean isMultipart();
181:
182: /**
183: * Returns the size of the message in bytes.
184: *
185: * @return size of message in bytes as <tt>int</tt>.
186: */
187: public int getSize();
188:
189: }//class JwmaMessageInfo
|