KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > business > library > faq > category > FAQCategoryDO


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: FAQCategoryDO.java,v $
31  * Revision 1.2 2005/04/29 02:48:16 colinmacleod
32  * Data bugfixes.
33  * Changed primary key back to Integer.
34  *
35  * Revision 1.1 2005/04/26 15:21:54 colinmacleod
36  * Renamed Faq to FAQ.
37  *
38  * Revision 1.3 2005/04/10 20:31:59 colinmacleod
39  * Added new themes.
40  * Changed id type to String.
41  * Changed i tag to em and b tag to strong.
42  * Improved PicoContainerFactory with NanoContainer scripts.
43  *
44  * Revision 1.2 2005/04/09 17:19:45 colinmacleod
45  * Changed copyright text to GPL v2 explicitly.
46  *
47  * Revision 1.1.1.1 2005/03/10 17:51:59 colinmacleod
48  * Restructured ivata op around Hibernate/PicoContainer.
49  * Renamed ivata groupware.
50  *
51  * Revision 1.3 2004/07/13 19:47:28 colinmacleod
52  * Moved project to POJOs from EJBs.
53  * Applied PicoContainer to services layer (replacing session EJBs).
54  * Applied Hibernate to persistence layer (replacing entity EJBs).
55  *
56  * Revision 1.2 2004/03/21 21:16:29 colinmacleod
57  * Shortened name to ivata op.
58  *
59  * Revision 1.1.1.1 2004/01/27 20:58:39 colinmacleod
60  * Moved ivata openportal to SourceForge..
61  *
62  * Revision 1.2 2003/10/15 14:16:53 colin
63  * fixing for XDoclet
64  *
65  * Revision 1.1 2003/02/24 19:09:22 colin
66  * moved to business
67  *
68  * Revision 1.3 2003/02/04 17:43:47 colin
69  * copyright notice
70  *
71  * Revision 1.2 2002/10/24 14:35:39 peter
72  * search indexing implemented, 2 new fields added to DO
73  *
74  * Revision 1.1 2002/06/28 13:19:54 colin
75  * first release of the library
76  * -----------------------------------------------------------------------------
77  */

78 package com.ivata.groupware.business.library.faq.category;
79
80 import java.util.List JavaDoc;
81
82 import com.ivata.groupware.business.library.item.LibraryItemDO;
83 import com.ivata.groupware.container.persistence.BaseDO;
84
85
86 /**
87  * <p>Contains one category of questions and answers in a frequently asked
88  * questions library item.</p>
89  *
90  * @since 2002-06-28
91  * @author Colin MacLeod
92  * <a HREF='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
93  * @version $Revision: 1.2 $
94  *
95  * @hibernate.class
96  * table="library_faq_category"
97  */

98 public class FAQCategoryDO extends BaseDO {
99
100     /**
101      * <p>Text describing the function of this category. This is
102      * optional.</p>
103      */

104     private String JavaDoc description;
105
106     /**
107      * <p>All of the questions/answers in this category.</p>
108      */

109     private List JavaDoc fAQs;
110
111     /**
112      * <p>Store the library Item, the owner of this category.</p>
113      */

114     private LibraryItemDO libraryItem;
115     /**
116      * <p>The name for this category. This should be a clear-text name
117      * which can contain punctuation characters and spaces. This name should
118      * uniquely identify the category within the library item it is in.</p>
119      */

120     private String JavaDoc name;
121
122     /**
123      * <p>Comparison method. See if the object supplied is a faq category
124      * dependent object and, if so, whether or not its contents are the same as
125      * this one. Only the <code>id</code> fields are compared.</p>
126      *
127      * @param compare the object to compare with this one.
128      * @return <code>true</code> if the object supplied in <code>compare</code>
129      * is effectively the same as this one, otherwise false.
130      */

131     public boolean equals(final Object JavaDoc compare) {
132         // first check it is non-null and the class is right
133
if ((compare == null) || !(this.getClass().isInstance(compare))) {
134             return false;
135         }
136
137         FAQCategoryDO categoryDO = (FAQCategoryDO) compare;
138         Integer JavaDoc id = getId();
139         Integer JavaDoc categoryId = categoryDO.getId();
140
141         // check that the ids are the same
142
return (((id == null)
143                 ? (categoryId == null)
144                 : id.equals(categoryId)));
145     }
146
147     /**
148      * <p>Get the text describing the function of this category. This is
149      * optional and may be set to null.</p>
150      *
151      * @return optional text describing the function and purpose of the
152      * category.
153      * @hibernate.property
154      */

155     public final String JavaDoc getDescription() {
156         return description;
157     }
158
159     /**
160      * <p>Get all of the questions and answers in this category as a
161      * <code>List</code> of <code>FAQDO</code> instances.</p>
162      *
163      * @return all of the questions and answers in this category as a
164      * <code>List</code> of <code>FAQDO</code> instances.
165      *
166      * @hibernate.bag
167      * cascade="all"
168      * @hibernate.collection-key
169      * column="library_faq_category"
170      * @hibernate.collection-one-to-many
171      * class="com.ivata.groupware.business.library.faq.FAQDO"
172      */

173     public List JavaDoc getFAQs() {
174         return fAQs;
175     }
176     /**
177      * <p>Get the library item.</p>
178      *
179      * @return the library item.
180      * @hibernate.many-to-one
181      * column="library_item"
182      */

183     public LibraryItemDO getLibraryItem() {
184         return libraryItem;
185     }
186
187     /**
188      * <p>Get this name for this category. This should be a clear-text name
189      * which can contain punctuation characters and spaces. This name should
190      * uniquely identify the category within the library item it is in.</p>
191      *
192      * @return clear-text name which identifies this category within the
193      * library item.
194      * @hibernate.property
195      */

196     public final String JavaDoc getName() {
197         return name;
198     }
199
200     /**
201      * <p>Set the text describing the function of this category. This is
202      * optional.</p>
203      *
204      * @param description optional text describing the function and purpose of
205      * the category.
206      */

207     public final void setDescription(final String JavaDoc description) {
208         this.description = description;
209     }
210
211     /**
212      * <p>Set all of the questions and answers in this category as a
213      * <code>List</code> of <code>FAQDO</code> instances.</p>
214      *
215      * @param faqs all of the questions and answers in this category as a
216      * <code>List</code> of <code>FAQDO</code> instances.
217      */

218     public final void setFAQs(final List JavaDoc faqs) {
219         this.fAQs = faqs;
220     }
221
222     /**
223      * <p>Set the library item for this category.</p>
224      *
225      * @param libraryItem new value of library item.
226      */

227     public final void setLibraryItem(final LibraryItemDO libraryItem) {
228         this.libraryItem = libraryItem;
229     }
230
231     /**
232      * <p>Set this name for this category. This should be a clear-text name
233      * which can contain punctuation characters and spaces. This name should
234      * uniquely identify the category within the library item it is in.</p>
235      *
236      * @param name clear-text name which identifies this category within the
237      * library item.
238      */

239     public final void setName(final String JavaDoc name) {
240         this.name = name;
241     }
242 }
243
Popular Tags