KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > business > mail > message > MessageDO


1 /*
2  * Copyright (c) 2001 - 2005 ivata limited.
3  * All rights reserved.
4  * -----------------------------------------------------------------------------
5  * ivata groupware may be redistributed under the GNU General Public
6  * License as published by the Free Software Foundation;
7  * version 2 of the License.
8  *
9  * These programs are free software; you can redistribute them and/or
10  * modify them under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; version 2 of the License.
12  *
13  * These programs are distributed in the hope that they will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * See the GNU General Public License in the file LICENSE.txt for more
18  * details.
19  *
20  * If you would like a copy of the GNU General Public License write to
21  *
22  * Free Software Foundation, Inc.
23  * 59 Temple Place - Suite 330
24  * Boston, MA 02111-1307, USA.
25  *
26  *
27  * To arrange commercial support and licensing, contact ivata at
28  * http://www.ivata.com/contact.jsp
29  * -----------------------------------------------------------------------------
30  * $Log: MessageDO.java,v $
31  * Revision 1.3 2005/04/10 18:47:42 colinmacleod
32  * Changed i tag to em and b tag to strong.
33  *
34  * Revision 1.2 2005/04/09 17:20:01 colinmacleod
35  * Changed copyright text to GPL v2 explicitly.
36  *
37  * Revision 1.1.1.1 2005/03/10 17:51:16 colinmacleod
38  * Restructured ivata op around Hibernate/PicoContainer.
39  * Renamed ivata groupware.
40  *
41  * Revision 1.6 2004/09/30 15:09:33 colinmacleod
42  * Bug fixes
43  *
44  * Revision 1.5 2004/07/13 19:48:12 colinmacleod
45  * Moved project to POJOs from EJBs.
46  * Applied PicoContainer to services layer (replacing session EJBs).
47  * Applied Hibernate to persistence layer (replacing entity EJBs).
48  *
49  * Revision 1.4 2004/03/21 21:16:39 colinmacleod
50  * Shortened name to ivata op.
51  *
52  * Revision 1.3 2004/02/10 19:57:26 colinmacleod
53  * Changed email address.
54  *
55  * Revision 1.2 2004/02/01 22:07:32 colinmacleod
56  * Added full names to author tags
57  *
58  * Revision 1.1.1.1 2004/01/27 20:59:57 colinmacleod
59  * Moved ivata openportal to SourceForge..
60  *
61  * Revision 1.2 2003/10/15 14:11:33 colin
62  * fixing for XDoclet
63  *
64  * Revision 1.2 2003/05/12 16:31:52 peter
65  * the attachments are a Vector of FileDOs now
66  * -----------------------------------------------------------------------------
67  */

68 package com.ivata.groupware.business.mail.message;
69
70 import java.util.GregorianCalendar JavaDoc;
71 import java.util.List JavaDoc;
72
73 import com.ivata.groupware.business.mail.MailBean;
74 import com.ivata.groupware.container.persistence.BaseDO;
75
76
77 /**
78  * <p>This is a dependent value class, used to pass data back from
79  * the</p>
80  * {@link com.ivata.groupware.business.mail.MailBean MailBean} to a
81  * client application.</p>
82  *
83  * @since 2002-08-26
84  * @author Peter Illes
85  * @author Colin MacLeod
86  * <a HREF='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
87  * @version $Revision: 1.3 $
88  * @see MailBean
89  */

90 public class MessageDO extends BaseDO {
91
92     /**
93      * <p><code>List</code> of attachments as <code>FileDO</code>s. These can be used
94      * to identify the attachment for later downloading.</p>
95      */

96     private List JavaDoc attachments;
97     /**
98      * <p>The mail folder where this message is located.</p>
99      */

100     private String JavaDoc folderName;
101
102     /**
103      * <p>The format of the text, must be set to one of the formats in
104      * {@link
105      * com.ivata.mask.web.format.FormatConstants
106      * FormatConstants}.</p>
107      */

108     private int format;
109
110     /**
111      * <p>
112      * This is the <strong>JavaMail</strong> message id.
113      * </p>
114      */

115     private String JavaDoc messageID;
116
117     /**
118      * <p>The date the message was received.</p>
119      */

120     private GregorianCalendar JavaDoc received;
121
122     /**
123      * <p>Recipients of the message as a <code>List</code> of strings.</p>
124      */

125     private List JavaDoc recipients;
126
127     /**
128      * <p>"Blind carbon copy" recipients as List of strings. These are
129      * additional
130      * recipients whose identity is <em>not</em> made known to all other
131      * recipients.</p>
132      */

133     private List JavaDoc recipientsBCC;
134
135     /**
136      * <p>"Carbon copy" recipients as List of strings. These are
137      * additional
138      * recipients whose identity is made known to all other
139      * recipients.</p>
140      */

141     private List JavaDoc recipientsCC;
142
143     /**
144      * <p>Senders of the message as a <code>List</code> of strings.</p>
145      */

146     private List JavaDoc senders;
147
148     /**
149      * <p>The date the message was sent.</p>
150      */

151     private GregorianCalendar JavaDoc sent;
152
153     /**
154      * <p>The size of the message, including attachments, in bytes.</p>
155      */

156     private Integer JavaDoc size;
157
158     /**
159      * <p>The subject of the message.</p>
160      */

161     private String JavaDoc subject;
162
163     /**
164      * <p>The textual content of the message. This can either be
165      * <code>HTML</code> formatted or plain-text, depending on the value
166      * of the
167      * <code>format</code> field.</p>
168      */

169     private String JavaDoc text;
170
171     /**
172      * <p>Get all of the identifiers for message attachments. This method
173      * retrieves the ids, content types, sizes so they can be used to identify and download the
174      * message attachments.</p>
175      *
176      * @return <p><code>Vector</code> of <code>FileDO</code>s. These can be used to identify the
177      * attachment
178      * for later downloading.</p>
179      *
180      */

181     public List JavaDoc getAttachments() {
182         return attachments;
183     }
184
185     /**
186      * <p>Get the mail folder where this message is located.</p>
187      *
188      * @return name of the mail folder where this message is located.
189      *
190      */

191     public final String JavaDoc getFolderName() {
192         return folderName;
193     }
194
195     /**
196      * <p>Get the format of the text.</p>
197      *
198      * @return one of the formats in
199      * {@link com.ivata.mask.web.format.FormatConstants
200      * FormatConstants}.</p>
201      *
202      */

203     public final int getFormat() {
204         return format;
205     }
206     /**
207      * <p>
208      * This is the <strong>JavaMail</strong> message id.
209      * </p>
210      *
211      * @return Returns the messageID.
212      */

213     public final String JavaDoc getMessageID() {
214         return messageID;
215     }
216
217     /**
218      * <p>Get the time the message was received.</p>
219      *
220      * @return time the message was received, or <code>null</code> if this
221      * has not
222      * been set for this message.
223      *
224      */

225     public final GregorianCalendar JavaDoc getReceived() {
226         return this.received;
227     }
228
229     /**
230      * <p>Get recipients of the message.</p>
231      *
232      * @return recipients of the message, as a <code>List</code>
233      * of <code>String</code> instances, each one formatted according to
234      * <a HREF='http://www.faqs.org/rfcs/rfc822.HTML'>RFC822</a>.
235      */

236     public List JavaDoc getRecipients() {
237         return recipients;
238     }
239
240     /**
241      * <p>Get "Blind carbon copy" recipients as List of strings. These are
242      * additional recipients whose identity is <em>not</em> made known to
243      * any
244      * other recipients.</p>
245      *
246      * @return recipients of the message, as a <code>List</code>
247      * of <code>String</code> instances, each one formatted according to
248      * <a HREF='http://www.faqs.org/rfcs/rfc822.HTML'>RFC822</a>.
249      *
250      */

251     public List JavaDoc getRecipientsBCC() {
252         return recipientsBCC;
253     }
254
255     /**
256      * <p>Get "Carbon copy" recipients of the message. These are
257      * additional
258      * recipients whose identity is made known to all other
259      * recipients.</p>
260      *
261      * @return recipients of the message, as a <code>List</code>
262      * of <code>String</code> instances, each one formatted according to
263      * <a HREF='http://www.faqs.org/rfcs/rfc822.HTML'>RFC822</a>.
264      */

265     public List JavaDoc getRecipientsCC() {
266         return recipientsCC;
267     }
268
269     /**
270      * <p>Get senders of the message.</p>
271      *
272      * @return senders of the message, as a <code>List</code>
273      * of <code>String</code> instances, each one formatted according to
274      * <a HREF='http://www.faqs.org/rfcs/rfc822.HTML'>RFC822</a>.
275      *
276      */

277     public List JavaDoc getSenders() {
278         return senders;
279     }
280
281     /**
282      * <p>Get the time the message was sent.</p>
283      *
284      * @return time the message was sent, or <code>null</code> if this has
285      * not
286      * been set for this message.
287      *
288      */

289     public final GregorianCalendar JavaDoc getSent() {
290         return sent;
291     }
292
293     /**
294      * <p>Get the size of the message, including attachments.</p>
295      *
296      * @return total size of the message and attachments, in bytes.
297      *
298      */

299     public final Integer JavaDoc getSize() {
300         return size;
301     }
302
303     /**
304      * <p>Get the subject of this message.</p>
305      *
306      * @return the subject of the mail, in plain text without
307      * <code>HTML</code> code or character entities.
308      *
309      */

310     public final String JavaDoc getSubject() {
311         return subject;
312     }
313
314     /**
315      * <p>Get the textual content of the message.</p>
316      *
317      * @return either be <code>HTML</code> formatted or plain-text,
318      * depending on
319      * the value of the <code>format</code> field.
320      * @see #setFormat
321      *
322      */

323     public final String JavaDoc getText() {
324         return text;
325     }
326
327     /**
328      * <p>Set all of the identifiers for message attachments. This method
329      * will only every be called server-side to set up the atachment list the client can later locate the correct attachments.</p>
330      *
331      * @param attachments <code>List</code> of <code>FileDO</code>s.
332      */

333     public final void setAttachments(final List JavaDoc attachments) {
334         this.attachments = attachments;
335     }
336
337     /**
338      * <p>Set the mail folder where this message is located. <strong>Note:</strong>
339      * this
340      * method is not enough to actually <em>move</em> the folder. The
341      * <code>messageDO</code> merely records information about the
342      * message.</p>
343      *
344      * @param folderName new value of folder where this message is located.
345      *
346      */

347     public final void setFolderName(final String JavaDoc folderName) {
348         this.folderName = folderName;
349     }
350
351     /**
352      * <p>Set the format of the text.</p>
353      *
354      * @param format one of the formats in
355      * {@link com.ivata.mask.web.format.FormatConstants
356      * FormatConstants}.</p>
357      *
358      */

359     public final void setFormat(final int format) {
360         this.format = format;
361     }
362     /**
363      * <p>
364      * This is the <strong>JavaMail</strong> message id.
365      * </p>
366      *
367      * @param messageID The messageID to set.
368      * @hibernate.property
369      */

370     public final void setMessageID(final String JavaDoc messageID) {
371         this.messageID = messageID;
372     }
373
374     /**
375      * <p>Set the time the message was received.</p>
376      *
377      * @param received valid date and time the message was received.
378      *
379      */

380     public final void setReceived(final GregorianCalendar JavaDoc received) {
381         this.received = received;
382     }
383
384     /**
385      * <p>Set recipients of the message.</p>
386      *
387      * @param recipients recipients of the message, as a <code>List</code>
388      * of <code>String</code> instances, each one formatted according to
389      * <a HREF='http://www.faqs.org/rfcs/rfc822.HTML'>RFC822</a>.
390      *
391      */

392     public final void setRecipients(final List JavaDoc recipients) {
393         this.recipients = recipients;
394     }
395
396     /**
397      * <p>Set "Blind carbon copy" recipients as List of strings. These are
398      * additional recipients whose identity is <em>not</em> made known to
399      * any
400      * other recipients.</p>
401      *
402      * @param recipientsBCC recipients of the message, as a
403      * <code>List</code>
404      * of <code>String</code> instances, each one formatted according to
405      * <a HREF='http://www.faqs.org/rfcs/rfc822.HTML'>RFC822</a>.
406      *
407      */

408     public final void setRecipientsBCC(final List JavaDoc recipientsBCC) {
409         this.recipientsBCC = recipientsBCC;
410     }
411
412     /**
413      * <p>Set "Carbon copy" recipients of the message. These are
414      * additional
415      * recipients whose identity is made known to all other
416      * recipients.</p>
417      *
418      * @param recipientsCC recipients of the message, as a
419      * <code>List</code>
420      * of <code>String</code> instances, each one formatted according to
421      * <a HREF='http://www.faqs.org/rfcs/rfc822.HTML'>RFC822</a>.
422      *
423      */

424     public final void setRecipientsCC(final List JavaDoc recipientsCC) {
425         this.recipientsCC = recipientsCC;
426     }
427
428     /**
429      * <p>Set senders of the message.</p>
430      *
431      * @param senders senders of the message, as a <code>List</code>
432      * of <code>String</code> instances, each one formatted according to
433      * <a HREF='http://www.faqs.org/rfcs/rfc822.HTML'>RFC822</a>.
434      *
435      */

436     public final void setSenders(final List JavaDoc senders) {
437         this.senders = senders;
438     }
439
440     /**
441      * <p>Set the time the message was sent.</p>
442      *
443      * @param sent valid date and time the message was sent.
444      *
445      */

446     public final void setSent(final GregorianCalendar JavaDoc sent) {
447         this.sent = sent;
448     }
449
450     /**
451      * <p>Set the size of the message, including attachments.</p>
452      *
453      * @param size total size of the message and attachments, in bytes.
454      *
455      */

456     public final void setSize(final Integer JavaDoc size) {
457         this.size = size;
458     }
459
460     /**
461      * <p>Set the subject of this message.</p>
462      *
463      * @param subject the subject of the mail, in plain text without
464      * <code>HTML</code> code or character entities.
465      *
466      */

467     public final void setSubject(final String JavaDoc subject) {
468         this.subject = subject;
469     }
470
471     /**
472      * <p>Set the textual content of the message.</p>
473      *
474      * @param text this can either be <code>HTML</code> formatted or
475      * plain-text,
476      * depending on the value of the <code>format</code> field.
477      * @see #setFormat
478      *
479      */

480     public final void setText(final String JavaDoc text) {
481         this.text = text;
482     }
483 }
484
Popular Tags