001: /*
002: * Copyright (c) 2001 - 2005 ivata limited.
003: * All rights reserved.
004: * -----------------------------------------------------------------------------
005: * ivata groupware may be redistributed under the GNU General Public
006: * License as published by the Free Software Foundation;
007: * version 2 of the License.
008: *
009: * These programs are free software; you can redistribute them and/or
010: * modify them under the terms of the GNU General Public License
011: * as published by the Free Software Foundation; version 2 of the License.
012: *
013: * These programs are distributed in the hope that they will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016: *
017: * See the GNU General Public License in the file LICENSE.txt for more
018: * details.
019: *
020: * If you would like a copy of the GNU General Public License write to
021: *
022: * Free Software Foundation, Inc.
023: * 59 Temple Place - Suite 330
024: * Boston, MA 02111-1307, USA.
025: *
026: *
027: * To arrange commercial support and licensing, contact ivata at
028: * http://www.ivata.com/contact.jsp
029: * -----------------------------------------------------------------------------
030: * $Log: FAQCategoryDO.java,v $
031: * Revision 1.2 2005/04/29 02:48:16 colinmacleod
032: * Data bugfixes.
033: * Changed primary key back to Integer.
034: *
035: * Revision 1.1 2005/04/26 15:21:54 colinmacleod
036: * Renamed Faq to FAQ.
037: *
038: * Revision 1.3 2005/04/10 20:31:59 colinmacleod
039: * Added new themes.
040: * Changed id type to String.
041: * Changed i tag to em and b tag to strong.
042: * Improved PicoContainerFactory with NanoContainer scripts.
043: *
044: * Revision 1.2 2005/04/09 17:19:45 colinmacleod
045: * Changed copyright text to GPL v2 explicitly.
046: *
047: * Revision 1.1.1.1 2005/03/10 17:51:59 colinmacleod
048: * Restructured ivata op around Hibernate/PicoContainer.
049: * Renamed ivata groupware.
050: *
051: * Revision 1.3 2004/07/13 19:47:28 colinmacleod
052: * Moved project to POJOs from EJBs.
053: * Applied PicoContainer to services layer (replacing session EJBs).
054: * Applied Hibernate to persistence layer (replacing entity EJBs).
055: *
056: * Revision 1.2 2004/03/21 21:16:29 colinmacleod
057: * Shortened name to ivata op.
058: *
059: * Revision 1.1.1.1 2004/01/27 20:58:39 colinmacleod
060: * Moved ivata openportal to SourceForge..
061: *
062: * Revision 1.2 2003/10/15 14:16:53 colin
063: * fixing for XDoclet
064: *
065: * Revision 1.1 2003/02/24 19:09:22 colin
066: * moved to business
067: *
068: * Revision 1.3 2003/02/04 17:43:47 colin
069: * copyright notice
070: *
071: * Revision 1.2 2002/10/24 14:35:39 peter
072: * search indexing implemented, 2 new fields added to DO
073: *
074: * Revision 1.1 2002/06/28 13:19:54 colin
075: * first release of the library
076: * -----------------------------------------------------------------------------
077: */
078: package com.ivata.groupware.business.library.faq.category;
079:
080: import java.util.List;
081:
082: import com.ivata.groupware.business.library.item.LibraryItemDO;
083: import com.ivata.groupware.container.persistence.BaseDO;
084:
085: /**
086: * <p>Contains one category of questions and answers in a frequently asked
087: * questions library item.</p>
088: *
089: * @since 2002-06-28
090: * @author Colin MacLeod
091: * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
092: * @version $Revision: 1.2 $
093: *
094: * @hibernate.class
095: * table="library_faq_category"
096: */
097: public class FAQCategoryDO extends BaseDO {
098:
099: /**
100: * <p>Text describing the function of this category. This is
101: * optional.</p>
102: */
103: private String description;
104:
105: /**
106: * <p>All of the questions/answers in this category.</p>
107: */
108: private List fAQs;
109:
110: /**
111: * <p>Store the library Item, the owner of this category.</p>
112: */
113: private LibraryItemDO libraryItem;
114: /**
115: * <p>The name for this category. This should be a clear-text name
116: * which can contain punctuation characters and spaces. This name should
117: * uniquely identify the category within the library item it is in.</p>
118: */
119: private String name;
120:
121: /**
122: * <p>Comparison method. See if the object supplied is a faq category
123: * dependent object and, if so, whether or not its contents are the same as
124: * this one. Only the <code>id</code> fields are compared.</p>
125: *
126: * @param compare the object to compare with this one.
127: * @return <code>true</code> if the object supplied in <code>compare</code>
128: * is effectively the same as this one, otherwise false.
129: */
130: public boolean equals(final Object compare) {
131: // first check it is non-null and the class is right
132: if ((compare == null) || !(this .getClass().isInstance(compare))) {
133: return false;
134: }
135:
136: FAQCategoryDO categoryDO = (FAQCategoryDO) compare;
137: Integer id = getId();
138: Integer categoryId = categoryDO.getId();
139:
140: // check that the ids are the same
141: return (((id == null) ? (categoryId == null) : id
142: .equals(categoryId)));
143: }
144:
145: /**
146: * <p>Get the text describing the function of this category. This is
147: * optional and may be set to null.</p>
148: *
149: * @return optional text describing the function and purpose of the
150: * category.
151: * @hibernate.property
152: */
153: public final String getDescription() {
154: return description;
155: }
156:
157: /**
158: * <p>Get all of the questions and answers in this category as a
159: * <code>List</code> of <code>FAQDO</code> instances.</p>
160: *
161: * @return all of the questions and answers in this category as a
162: * <code>List</code> of <code>FAQDO</code> instances.
163: *
164: * @hibernate.bag
165: * cascade="all"
166: * @hibernate.collection-key
167: * column="library_faq_category"
168: * @hibernate.collection-one-to-many
169: * class="com.ivata.groupware.business.library.faq.FAQDO"
170: */
171: public List getFAQs() {
172: return fAQs;
173: }
174:
175: /**
176: * <p>Get the library item.</p>
177: *
178: * @return the library item.
179: * @hibernate.many-to-one
180: * column="library_item"
181: */
182: public LibraryItemDO getLibraryItem() {
183: return libraryItem;
184: }
185:
186: /**
187: * <p>Get this name for this category. This should be a clear-text name
188: * which can contain punctuation characters and spaces. This name should
189: * uniquely identify the category within the library item it is in.</p>
190: *
191: * @return clear-text name which identifies this category within the
192: * library item.
193: * @hibernate.property
194: */
195: public final String getName() {
196: return name;
197: }
198:
199: /**
200: * <p>Set the text describing the function of this category. This is
201: * optional.</p>
202: *
203: * @param description optional text describing the function and purpose of
204: * the category.
205: */
206: public final void setDescription(final String description) {
207: this .description = description;
208: }
209:
210: /**
211: * <p>Set all of the questions and answers in this category as a
212: * <code>List</code> of <code>FAQDO</code> instances.</p>
213: *
214: * @param faqs all of the questions and answers in this category as a
215: * <code>List</code> of <code>FAQDO</code> instances.
216: */
217: public final void setFAQs(final List faqs) {
218: this .fAQs = faqs;
219: }
220:
221: /**
222: * <p>Set the library item for this category.</p>
223: *
224: * @param libraryItem new value of library item.
225: */
226: public final void setLibraryItem(final LibraryItemDO libraryItem) {
227: this .libraryItem = libraryItem;
228: }
229:
230: /**
231: * <p>Set this name for this category. This should be a clear-text name
232: * which can contain punctuation characters and spaces. This name should
233: * uniquely identify the category within the library item it is in.</p>
234: *
235: * @param name clear-text name which identifies this category within the
236: * library item.
237: */
238: public final void setName(final String name) {
239: this.name = name;
240: }
241: }
|