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: SearchItemDO.java,v $
031: * Revision 1.7 2005/10/02 14:08:57 colinmacleod
032: * Added/improved log4j logging.
033: *
034: * Revision 1.6 2005/09/29 13:22:46 colinmacleod
035: * Added read-only functionality to data object classes (with a check on each
036: * setter).
037: *
038: * Revision 1.5 2005/09/14 15:54:13 colinmacleod
039: * Removed unused local and class variables.
040: * Added serialVersionUID.
041: *
042: * Revision 1.4 2005/04/29 02:48:20 colinmacleod
043: * Data bugfixes.
044: * Changed primary key back to Integer.
045: *
046: * Revision 1.3 2005/04/10 20:09:48 colinmacleod
047: * Added new themes.
048: * Changed id type to String.
049: * Changed i tag to em and b tag to strong.
050: * Improved PicoContainerFactory with NanoContainer scripts.
051: *
052: * Revision 1.2 2005/04/09 17:19:55 colinmacleod
053: * Changed copyright text to GPL v2 explicitly.
054: *
055: * Revision 1.1.1.1 2005/03/10 17:52:38 colinmacleod
056: * Restructured ivata op around Hibernate/PicoContainer.
057: * Renamed ivata groupware.
058: *
059: * Revision 1.2 2004/09/30 15:02:08 colinmacleod
060: * Fixed hibernate tags.
061: *
062: * Revision 1.1 2004/08/01 11:40:30 colinmacleod
063: * Moved search classes to separate subproject.
064: *
065: * -----------------------------------------------------------------------------
066: */
067: package com.ivata.groupware.business.search.item;
068:
069: import org.apache.log4j.Logger;
070:
071: import java.util.Set;
072:
073: import com.ivata.groupware.container.persistence.BaseDO;
074:
075: /**
076: * <p>
077: * Each item which can be queried as a result of a search is abstracted by an
078: * instance of this class.
079: * </p>
080: *
081: * @since 2004-07-31
082: * @author Colin MacLeod
083: * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
084: * @version $Revision: 1.7 $
085: *
086: * @hibernate.class
087: * table="search_item"
088: * @hibernate.cache
089: * usage="read-write"
090: */
091: public class SearchItemDO extends BaseDO {
092: /**
093: * Logger for this class.
094: */
095: private static final Logger logger = Logger
096: .getLogger(SearchItemDO.class);
097:
098: /**
099: * Serialization version (for <code>Serializable</code> interface).
100: */
101: private static final long serialVersionUID = 1L;
102:
103: /**
104: * <p>
105: * Extra string to describe the category or topic associated with the indexed
106: * object. Used in conjunction with <code>type</code> and
107: * <code>targetId</code> to uniquely identify the target.
108: * </p>
109: */
110: private String category;
111:
112: /**
113: * <p>
114: * Refers to all the indexed contents of this item.
115: * </p>
116: */
117: private Set contents;
118:
119: /**
120: * <p>
121: * Unique identifier of the object being indexed.
122: * </p>
123: */
124: private Integer targetId;
125: /**
126: * <p>
127: * This is a text to describe the type of the object being indexed. In
128: * <strong>ivata groupware</strong>, this always refers to the class of the
129: * indexed object.
130: * </p>
131: */
132: private String type;
133:
134: /**
135: * <p>
136: * Extra string to describe the category or topic associated with the indexed
137: * object. Used in conjunction with <code>type</code> and
138: * <code>targetId</code> to uniquely identify the target.
139: * </p>
140: *
141: * @return Returns the category.
142: * @hibernate.property
143: */
144: public final String getCategory() {
145: if (logger.isDebugEnabled()) {
146: logger.debug("getCategory() - start");
147: }
148:
149: if (logger.isDebugEnabled()) {
150: logger.debug("getCategory() - end - return value = "
151: + category);
152: }
153: return category;
154: }
155:
156: /**
157: * <p>
158: * Refers to all the indexed contents of this item.
159: * </p>
160: *
161: * @hibernate.set
162: * cascade="all"
163: * @hibernate.collection-key
164: * column="search_item"
165: * @hibernate.collection-one-to-many
166: * class="com.ivata.cms.page.PageDO"
167: * @return Returns the contents.
168: */
169: public final Set getContents() {
170: if (logger.isDebugEnabled()) {
171: logger.debug("getContents() - start");
172: }
173:
174: if (logger.isDebugEnabled()) {
175: logger.debug("getContents() - end - return value = "
176: + contents);
177: }
178: return contents;
179: }
180:
181: /**
182: * <p>
183: * Unique identifier of the object being indexed.
184: * </p>
185: *
186: * @return Returns the targetId.
187: * @hibernate.property
188: * column="target_id"
189: */
190: public final Integer getTargetId() {
191: if (logger.isDebugEnabled()) {
192: logger.debug("getTargetId() - start");
193: }
194:
195: if (logger.isDebugEnabled()) {
196: logger.debug("getTargetId() - end - return value = "
197: + targetId);
198: }
199: return targetId;
200: }
201:
202: /**
203: * <p>
204: * This is a text to describe the type of the object being indexed. In
205: * <strong>ivata groupware</strong>, this always refers to the class of the
206: * indexed object.
207: * </p>
208: *
209: * @return Returns the type.
210: * @hibernate.property
211: */
212: public final String getType() {
213: if (logger.isDebugEnabled()) {
214: logger.debug("getType() - start");
215: }
216:
217: if (logger.isDebugEnabled()) {
218: logger.debug("getType() - end - return value = " + type);
219: }
220: return type;
221: }
222:
223: /**
224: * <p>
225: * Extra string to describe the category or topic associated with the indexed
226: * object. Used in conjunction with <code>type</code> and
227: * <code>targetId</code> to uniquely identify the target.
228: * </p>
229: *
230: * @param category The category to set.
231: */
232: public final void setCategory(final String category) {
233: if (logger.isDebugEnabled()) {
234: logger.debug("setCategory(String category = " + category
235: + ") - start");
236: }
237:
238: checkSetter();
239: this .category = category;
240:
241: if (logger.isDebugEnabled()) {
242: logger.debug("setCategory(String) - end");
243: }
244: }
245:
246: /**
247: * <p>
248: * Refers to all the indexed contents of this item.
249: * </p>
250: *
251: * @param contents The contents to set.
252: */
253: public final void setContents(final Set contents) {
254: if (logger.isDebugEnabled()) {
255: logger.debug("setContents(Set contents = " + contents
256: + ") - start");
257: }
258:
259: checkSetter();
260: this .contents = contents;
261:
262: if (logger.isDebugEnabled()) {
263: logger.debug("setContents(Set) - end");
264: }
265: }
266:
267: /**
268: * <p>
269: * Unique identifier of the object being indexed.
270: * </p>
271: *
272: * @param targetId The targetId to set.
273: */
274: public final void setTargetId(final Integer targetId) {
275: if (logger.isDebugEnabled()) {
276: logger.debug("setTargetId(Integer targetId = " + targetId
277: + ") - start");
278: }
279:
280: checkSetter();
281: this .targetId = targetId;
282:
283: if (logger.isDebugEnabled()) {
284: logger.debug("setTargetId(Integer) - end");
285: }
286: }
287:
288: /**
289: * <p>
290: * This is a text to describe the type of the object being indexed. In
291: * <strong>ivata groupware</strong>, this always refers to the class of the
292: * indexed object.
293: * </p>
294: *
295: * @param type The type to set.
296: */
297: public final void setType(final String type) {
298: if (logger.isDebugEnabled()) {
299: logger.debug("setType(String type = " + type + ") - start");
300: }
301:
302: checkSetter();
303: this .type = type;
304:
305: if (logger.isDebugEnabled()) {
306: logger.debug("setType(String) - end");
307: }
308: }
309: }
|