View Javadoc

1   /*
2    * This file is part of Domingo
3    * an Open Source Java-API to Lotus Notes/Domino
4    * hosted at http://domingo.sourceforge.net
5    *
6    * Copyright (c) 2003-2007 Beck et al. projects GmbH Munich, Germany (http://www.bea.de)
7    *
8    * This library is free software; you can redistribute it and/or
9    * modify it under the terms of the GNU Lesser General Public
10   * License as published by the Free Software Foundation; either
11   * version 2.1 of the License, or (at your option) any later version.
12   *
13   * This library is distributed in the hope that it will be useful,
14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16   * Lesser General Public License for more details.
17   *
18   * You should have received a copy of the GNU Lesser General Public
19   * License along with this library; if not, write to the Free Software
20   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21   */
22  
23  package de.bea.domingo.groupware;
24  
25  import java.text.SimpleDateFormat;
26  import java.util.Calendar;
27  
28  import de.bea.domingo.map.BaseDigest;
29  import de.bea.domingo.util.GregorianDate;
30  import de.bea.domingo.util.GregorianTime;
31  
32  /***
33   * Represents a digest of a Notes mail document.
34   *
35   * @author <a href=mailto:kriede@users.sourceforge.net>Kurt Riede</a>
36   */
37  public final class EmailDigest extends BaseDigest {
38  
39      private String who;
40  
41      private Calendar date;
42  
43      private Calendar time;
44  
45      private String subject;
46  
47      /***
48       * @return Returns the date.
49       */
50      public Calendar getDate() {
51          return date;
52      }
53  
54      /***
55       * @param calendar The date to set.
56       */
57      public void setDate(final Calendar calendar) {
58          this.date = calendar instanceof GregorianDate ? calendar : new GregorianDate(calendar);
59      }
60  
61      /***
62       * @return Returns the subject.
63       */
64      public String getSubject() {
65          return subject;
66      }
67  
68      /***
69       * @param text The subject to set.
70       */
71      public void setSubject(final String text) {
72          this.subject = text;
73      }
74  
75      /***
76       * @return Returns the time.
77       */
78      public Calendar getTime() {
79          return time;
80      }
81  
82      /***
83       * @param calendar The time to set.
84       */
85      public void setTime(final Calendar calendar) {
86          this.time = calendar instanceof GregorianTime ? calendar : new GregorianTime(calendar);
87      }
88  
89      /***
90       * @return Returns the who.
91       */
92      public String getWho() {
93          return who;
94      }
95  
96      /***
97       * @param person The who to set.
98       */
99      public void setWho(final String person) {
100         this.who = person;
101     }
102 
103     /***
104      * @return  a string representation of the object.
105      * @see java.lang.Object#toString()
106      */
107     public String toString() {
108         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss Z");
109         return "" + sdf.format(this.getDate().getTime()) + " " + getWho() + "     " + getSubject();
110     }
111 }