KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > business > library > comment > CommentDO


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: CommentDO.java,v $
31  * Revision 1.3 2005/04/10 20:09:44 colinmacleod
32  * Added new themes.
33  * Changed id type to String.
34  * Changed i tag to em and b tag to strong.
35  * Improved PicoContainerFactory with NanoContainer scripts.
36  *
37  * Revision 1.2 2005/04/09 17:19:44 colinmacleod
38  * Changed copyright text to GPL v2 explicitly.
39  *
40  * Revision 1.1.1.1 2005/03/10 17:52:05 colinmacleod
41  * Restructured ivata op around Hibernate/PicoContainer.
42  * Renamed ivata groupware.
43  *
44  * Revision 1.4 2004/07/13 19:47:28 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.3 2004/03/21 21:16:28 colinmacleod
50  * Shortened name to ivata op.
51  *
52  * Revision 1.2 2004/02/01 22:07:31 colinmacleod
53  * Added full names to author tags
54  *
55  * Revision 1.1.1.1 2004/01/27 20:58:38 colinmacleod
56  * Moved ivata openportal to SourceForge..
57  *
58  * Revision 1.2 2003/10/15 14:16:53 colin
59  * fixing for XDoclet
60  *
61  * Revision 1.2 2003/07/18 14:43:47 jano
62  * we need itemTitle
63  *
64  * Revision 1.1 2003/02/24 19:09:22 colin
65  * moved to business
66  *
67  * Revision 1.3 2003/02/04 17:43:47 colin
68  * copyright notice
69  *
70  * Revision 1.2 2002/07/12 09:39:34 colin
71  * added format field to choose between plain text and HTML comments
72  *
73  * Revision 1.1 2002/07/08 10:16:13 colin
74  * first version of comment/comment tree model design
75  * -----------------------------------------------------------------------------
76  */

77 package com.ivata.groupware.business.library.comment;
78
79 import java.io.Serializable JavaDoc;
80
81 import com.ivata.groupware.business.library.item.LibraryItemDO;
82 import com.ivata.groupware.container.persistence.TimestampDO;
83 import com.ivata.mask.web.format.FormatConstants;
84
85
86 /**
87  * <p>Represents a single comment by a user, either in reply to a library item
88  * or to another comment. The comments are usually displayed using a tree
89  * generated from the {@link CommentTreeModelBean tree model}.</p>
90  *
91  * @since 2002-07-05
92  * @author Colin MacLeod
93  * <a HREF='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
94  * @version $Revision: 1.3 $
95  *
96  * @hibernate.class
97  * table = "library_comment"
98  */

99 public class CommentDO extends TimestampDO
100         implements com.ivata.groupware.web.tree.TreeNode,
101         Serializable JavaDoc {
102
103     /**
104      * <p>Store the format of this comment. This should correspond to one of the
105      * <code>FORMAT_...</code> constants in {@link
106      * com.ivata.mask.web.format.FormatConstants FormatConstants}.</p>
107      */

108     private int format = FormatConstants.FORMAT_TEXT;
109
110     /**
111      * <p>Store the item the comment relates to.</p>
112      */

113     private LibraryItemDO item;
114
115     /**
116      * <p>Parent comment which contains this one.</p>
117      */

118     private CommentDO parent;
119
120     /**
121      * <p>Store the subject for this comment. This is usually a clear-text
122      * describing the comment, and can begin with "Re: " to show that it is
123      * related to other comments in a thread.</p>
124      */

125     private String JavaDoc subject;
126
127     /**
128      * <p>Store the actual comment body, describing the user's thoughts.</p>
129      */

130     private String JavaDoc text;
131
132     /**
133      * <p>
134      * If a comment should be ignored and needs no reply, set this to
135      * <code>true</code>.
136      * </p>
137      */

138     private boolean unacknowledged = false;
139
140     /**
141      * <p>Get the format of this comment. This should correspond to one of the
142      * <code>FORMAT_...</code> constants in {@link
143      * com.ivata.mask.web.format.FormatConstants FormatConstants}.</p>
144      *
145      * @return one of the <code>FORMAT_...</code> constants in {@link
146      * com.ivata.mask.web.format.FormatConstants FormatConstants} which
147      * identifies the formatting of this comment.
148      *
149      * @hibernate.property
150      */

151     public final int getFormat() {
152         return format;
153     }
154
155     /**
156      * <p>Get the library item this comment relates
157      * to. Every comment in the system must relate to a library item.</p>
158      *
159      * @return unique identifier of the library item this comment
160      * relates to.
161      * @hibernate.many-to-one
162      */

163     public final LibraryItemDO getItem() {
164         return item;
165     }
166
167     /**
168      * <p>Get the 'name' for the subject as it appears in the tree. This returns
169      * the same as <code>getSubject</code>.</p>
170      *
171      * @return see {@link #getSubject getSubject}.
172      */

173     public final String JavaDoc getName() {
174         return getSubject();
175     }
176     /**
177      * <p>Parent comment which contains this one.</p>
178      *
179      * @return comment which contains this one
180      * @hibernate.many-to-one
181      * column="id_reply_to"
182      */

183     public final CommentDO getParent() {
184         return parent;
185     }
186
187     /**
188      * <p>Get the subject for this comment. This is usually a clear-text
189      * describing the comment, and can begin with "Re: " to show that it is
190      * related to other comments in a thread.</p>
191      *
192      * @return clear-text describing the comment content.
193      * @hibernate.property
194      */

195     public final String JavaDoc getSubject() {
196         return subject;
197     }
198
199     /**
200      * <p>Get the actual comment body, describing the user's thoughts.</p>
201      *
202      * @return new value for the comment body describing the user's
203      * thoughts.
204      * @hibernate.property
205      */

206     public final String JavaDoc getText() {
207         return text;
208     }
209     /**
210      * <p>
211      * If a comment should be ignored and needs no reply, set this to
212      * <code>true</code>.
213      * </p>
214      *
215      * @return current value of ignored.
216      * @hibernate.property
217      * column="no_reply"
218      */

219     public boolean isUnacknowledged() {
220         return unacknowledged;
221     }
222
223     /**
224      * <p>Set the format of this comment. This should correspond to one of the
225      * <code>FORMAT_...</code> constants in {@link
226      * com.ivata.mask.web.format.FormatConstants FormatConstants}.</p>
227      *
228      * @param format one of the <code>FORMAT_...</code> constants in {@link
229      * com.ivata.mask.web.format.FormatConstants FormatConstants} to
230      * identify the formatting of this comment.
231      */

232     public final void setFormat(final int format) {
233         this.format = format;
234     }
235
236     /**
237      * <p>Set the unique identifier of the library item this comment relates
238      * to. Every comment in the system must relate to a library item.</p>
239      *
240      * @param itemId new unique identifier of the library item this comment
241      * relates to.
242      */

243     public final void setItem(final LibraryItemDO item) {
244         this.item = item;
245     }
246
247     /**
248      * <p>Parent comment which contains this one.</p>
249      *
250      * @param parent comment which contains this one
251      */

252     public final void setParent(final CommentDO parent) {
253         this.parent = parent;
254     }
255
256     /**
257      * <p>Set the subject for this comment. This is usually a clear-text
258      * describing the comment, and can begin with "Re: " to show that it is
259      * related to other comments in a thread.</p>
260      *
261      * @param subject clear-text describing the comment content.
262      */

263     public final void setSubject(final String JavaDoc subject) {
264         this.subject = subject;
265     }
266
267     /**
268      * <p>Set the actual comment body, describing the user's thoughts.</p>
269      *
270      * @param text new value for the comment body describing the user's
271      * thoughts.
272      */

273     public final void setText(final String JavaDoc text) {
274         this.text = text;
275     }
276     /**
277      * <p>
278      * If a comment should be ignored and needs no reply, set this to
279      * <code>true</code>.
280      * </p>
281      *
282      * @param ignored new value of ignored.
283      */

284     public final void setUnacknowledged(final boolean ignored) {
285         this.unacknowledged = ignored;
286     }
287 }
288
Popular Tags