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: SearchIndexDO.java,v $
031: * Revision 1.6 2005/10/02 14:08:57 colinmacleod
032: * Added/improved log4j logging.
033: *
034: * Revision 1.5 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.4 2005/09/14 15:54:13 colinmacleod
039: * Removed unused local and class variables.
040: * Added serialVersionUID.
041: *
042: * Revision 1.3 2005/04/10 20:09:47 colinmacleod
043: * Added new themes.
044: * Changed id type to String.
045: * Changed i tag to em and b tag to strong.
046: * Improved PicoContainerFactory with NanoContainer scripts.
047: *
048: * Revision 1.2 2005/04/09 17:19:55 colinmacleod
049: * Changed copyright text to GPL v2 explicitly.
050: *
051: * Revision 1.1.1.1 2005/03/10 17:52:38 colinmacleod
052: * Restructured ivata op around Hibernate/PicoContainer.
053: * Renamed ivata groupware.
054: *
055: * Revision 1.1 2004/08/01 11:40:29 colinmacleod
056: * Moved search classes to separate subproject.
057: *
058: * -----------------------------------------------------------------------------
059: */
060: package com.ivata.groupware.business.search.index;
061:
062: import org.apache.log4j.Logger;
063:
064: import com.ivata.groupware.business.search.item.content.SearchItemContentDO;
065: import com.ivata.groupware.container.persistence.BaseDO;
066:
067: /**
068: * <p>
069: * Each word within an item has an index associated with it. This data object
070: * stores that index.
071: * </p>
072: *
073: * @since 2004-07-31
074: * @author Colin MacLeod
075: * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
076: * @version $Revision: 1.6 $
077: *
078: * @hibernate.class
079: * table="search_index"
080: * @hibernate.cache
081: * usage="read-write"
082: */
083: public class SearchIndexDO extends BaseDO {
084: /**
085: * Logger for this class.
086: */
087: private static final Logger logger = Logger
088: .getLogger(SearchIndexDO.class);
089:
090: /**
091: * Serialization version (for <code>Serializable</code> interface).
092: */
093: private static final long serialVersionUID = 1L;
094: /**
095: * <p>
096: * This is the content in the item which this index matches.
097: * </p>
098: */
099: private SearchItemContentDO content;
100: /**
101: * <p>
102: * Indicates how well the query applies to this result.
103: * </p>
104: */
105: private float weight;
106: /**
107: * <p>
108: * Word within the object which is indexed.
109: * </p>
110: */
111: private String word;
112:
113: /**
114: * <p>
115: * This is the content in the item which this index matches.
116: * </p>
117: *
118: * @return Returns the item.
119: * @hibernate.many-to-one
120: */
121: public final SearchItemContentDO getContent() {
122: if (logger.isDebugEnabled()) {
123: logger.debug("getContent() - start");
124: }
125:
126: if (logger.isDebugEnabled()) {
127: logger.debug("getContent() - end - return value = "
128: + content);
129: }
130: return content;
131: }
132:
133: /**
134: * <p>
135: * Indicates how well the query applies to this result.
136: * </p>
137: *
138: * @return Returns the weight.
139: * @hibernate.property
140: */
141: public final float getWeight() {
142: if (logger.isDebugEnabled()) {
143: logger.debug("getWeight() - start");
144: }
145:
146: if (logger.isDebugEnabled()) {
147: logger
148: .debug("getWeight() - end - return value = "
149: + weight);
150: }
151: return weight;
152: }
153:
154: /**
155: * <p>
156: * Word within the object which is indexed.
157: * </p>
158: *
159: * @return Returns the word.
160: * @hibernate.property
161: */
162: public final String getWord() {
163: if (logger.isDebugEnabled()) {
164: logger.debug("getWord() - start");
165: }
166:
167: if (logger.isDebugEnabled()) {
168: logger.debug("getWord() - end - return value = " + word);
169: }
170: return word;
171: }
172:
173: /**
174: * <p>
175: * This is the content in the item which this index matches.
176: * </p>
177: *
178: * @param content Content of the item which this index matches.
179: */
180: public final void setContent(final SearchItemContentDO content) {
181: if (logger.isDebugEnabled()) {
182: logger.debug("setContent(SearchItemContentDO content = "
183: + content + ") - start");
184: }
185:
186: checkSetter();
187: this .content = content;
188:
189: if (logger.isDebugEnabled()) {
190: logger.debug("setContent(SearchItemContentDO) - end");
191: }
192: }
193:
194: /**
195: * <p>
196: * Indicates how often the word occurs within this object.
197: * </p>
198: *
199: * @param weight The weight to set.
200: */
201: public final void setWeight(final float weight) {
202: if (logger.isDebugEnabled()) {
203: logger.debug("setWeight(float weight = " + weight
204: + ") - start");
205: }
206:
207: checkSetter();
208: this .weight = weight;
209:
210: if (logger.isDebugEnabled()) {
211: logger.debug("setWeight(float) - end");
212: }
213: }
214:
215: /**
216: * <p>
217: * Word within the object which is indexed.
218: * </p>
219: *
220: * @param word The word to set.
221: */
222: public final void setWord(final String word) {
223: if (logger.isDebugEnabled()) {
224: logger.debug("setWord(String word = " + word + ") - start");
225: }
226:
227: checkSetter();
228: this .word = word;
229:
230: if (logger.isDebugEnabled()) {
231: logger.debug("setWord(String) - end");
232: }
233: }
234: }
|