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 JwmaMessage model.
015: * <p>
016: * The JwmaMessage allows a view programmer to obtain
017: * information about a message to display it for reading
018: * or composing.
019: *
020: * @author Dieter Wimberger
021: * @version 0.9.7 07/02/2003
022: *
023: */
024: public interface JwmaMessage {
025:
026: /**
027: * Returns the full message header as <tt>String</tt>.
028: *
029: * @return the full message header as <tt>String</tt>.
030: */
031: public String getFullHeader();
032:
033: /**
034: * Returns an <tt>int</tt> representing the number
035: * of this message.
036: * <p>
037: * This number is the unique identifier for a message within
038: * a folder, or <tt>-1</tt> in case of a message created
039: * for being composed.
040: *
041: * @return the number of this message, or -1 if newly created
042: * for composing.
043: */
044: public int getMessageNumber();
045:
046: /**
047: * Tests if the message was received.
048: *
049: * @return true if the message was received,
050: * false otherwise.
051: */
052: public boolean isReceived();
053:
054: /**
055: * Tests if the message was sent.
056: * <p>
057: * Note that this method will always return the opposite of
058: * isReceived() (i.e. represents !getReceived()).
059: *
060: * @return true if the message was sent,
061: * false otherwise.
062: */
063: public boolean isSent();
064:
065: /**
066: * Returns a <tt>String</tt> representing the sender(s)
067: * of the message.
068: *
069: * @return the sender(s) of the message as String.
070: */
071: public String getFrom();
072:
073: /**
074: * Returns a <tt>String</tt> representing the Reply-To
075: * address(es) of the message.
076: *
077: * @return the Reply-To address(es) of the message as String.
078: */
079: public String getReplyTo();
080:
081: /**
082: * Returns a <tt>String</tt> representing the receivers(s)
083: * of the message.
084: *
085: * @return the receiver(s) of the message as String.
086: */
087: public String getTo();
088:
089: /**
090: * Returns a <tt>String</tt> representing the
091: * carbon copy receivers(s) of the message.
092: *
093: * @return the carbon copy receiver(s) of the
094: * message as String.
095: */
096: public String getCCTo();
097:
098: /**
099: * Returns a <tt>String</tt> representing the
100: * blind carbon copy receivers(s) of the message.
101: *
102: * @return the blind carbon copy receiver(s) of the
103: * message as String.
104: */
105: public String getBCCTo();
106:
107: /**
108: * Convenience method that returns a <tt>Date</tt>
109: * representing the received or sent date of the message.
110: * (Depending on whether it was sent or received).
111: *
112: * @return the received or sent date of the message.
113: */
114: public Date getDate();
115:
116: /**
117: * Returns a <tt>Date</tt> representing the
118: * date when the message was received.
119: *
120: * @return the received date of the message.
121: */
122: public Date getReceivedDate();
123:
124: /**
125: * Returns a <tt>Date</tt> representing the
126: * date when the message was sent.
127: *
128: * @return the sent date of the message.
129: */
130: public Date getSentDate();
131:
132: /**
133: * Returns a <tt>String</tt> representing the subject
134: * of the message.
135: *
136: * @return the subject of the message as String.
137: */
138: public String getSubject();
139:
140: /**
141: * Returns a <tt>String</tt> representing the body
142: * of the message.
143: * <p>
144: * Note that the body will be the (plain text) content of
145: * a singlepart message. The method will return an empty
146: * <tt>String</tt> for a multipart message.
147: * <p>
148: * A view programmer should base display decisions on
149: * the <tt>isSinglepart()</tt> (or <tt>isMultipart()</tt>
150: * method.
151: *
152: * @return the content of the message as String.
153: *
154: * @see #isSinglepart()
155: * @see #isMultipart()
156: */
157: public String getBody();
158:
159: /**
160: * Returns an array of <tt>JwmaMessagePart</tt> objects.
161: * <p>
162: * If this message does not contain any parts, then this
163: * method returns an empty array. Otherwise it contains
164: * one <tt>JwmaMessagePart</tt> object for each part
165: * of this message representing information about the part.
166: * <p>
167: * A view programmer should base display decisions on
168: * the <tt>isSinglepart()</tt> (or <tt>isMultipart()</tt>
169: * method.
170: *
171: * @return an array of JwmaMessagePart objects each representing
172: * information about a part of this message.
173: * The array will be empty if this message has no
174: * parts.
175: *
176: * @see dtw.webmail.model.JwmaMessagePart
177: * @see #isSinglepart()
178: * @see #isMultipart()
179: */
180: public JwmaMessagePart[] getMessageParts();
181:
182: /**
183: * Tests if the message is singlepart.
184: * <p>
185: * A singlepart message does not have any
186: * attachments.
187: *
188: * @return true if the message is singlepart,
189: * false otherwise.
190: */
191: public boolean isSinglepart();
192:
193: /**
194: * Tests if the message is multipart.
195: * <p>
196: * A multipart message has attachments
197: * or is composed out of different parts.
198: * Note that this method will always return the opposite
199: * of isSinglepart() (i.e. represents !isSinglepart()).
200: *
201: * @return true if the message is multipart,
202: * false otherwise.
203: */
204: public boolean isMultipart();
205:
206: }//interface JwmaMessage
|