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: EventDO.java,v $
031: * Revision 1.7 2005/10/11 18:58:58 colinmacleod
032: * Fixed some checkstyle and javadoc issues.
033: *
034: * Revision 1.6 2005/10/02 14:08:55 colinmacleod
035: * Added/improved log4j logging.
036: *
037: * Revision 1.5 2005/09/29 13:22:44 colinmacleod
038: * Added read-only functionality to data object classes (with a check on each
039: * setter).
040: *
041: * Revision 1.4 2005/09/14 15:12:19 colinmacleod
042: * Added serialVersionUID.
043: *
044: * Revision 1.3 2005/04/10 20:09:41 colinmacleod
045: * Added new themes.
046: * Changed id type to String.
047: * Changed i tag to em and b tag to strong.
048: * Improved PicoContainerFactory with NanoContainer scripts.
049: *
050: * Revision 1.2 2005/04/09 17:19:16 colinmacleod
051: * Changed copyright text to GPL v2 explicitly.
052: *
053: * Revision 1.1.1.1 2005/03/10 17:47:45 colinmacleod
054: * Restructured ivata op around Hibernate/PicoContainer.
055: * Renamed ivata groupware.
056: *
057: * Revision 1.4 2004/11/03 15:49:50 colinmacleod
058: * Changed todo comments to TODO: all caps.
059: *
060: * Revision 1.3 2004/07/13 19:42:12 colinmacleod
061: * Moved project to POJOs from EJBs.
062: * Applied PicoContainer to services layer (replacing session EJBs).
063: * Applied Hibernate to persistence layer (replacing entity EJBs).
064: *
065: * Revision 1.2 2004/03/21 21:16:21 colinmacleod
066: * Shortened name to ivata op.
067: *
068: * Revision 1.1.1.1 2004/01/27 20:58:20 colinmacleod
069: * Moved ivata openportal to SourceForge..
070: *
071: * Revision 1.2 2003/10/15 13:57:23 colin
072: * fixing for XDoclet
073: *
074: * Revision 1.2 2003/03/03 16:42:37 colin
075: * added created, modifiedBy and userName (applied it) to event
076: *
077: * Revision 1.1 2003/02/24 19:09:21 colin
078: * moved to business
079: *
080: * Revision 1.8 2003/02/04 17:41:45 colin
081: * renamed dayevent to allDayEvent
082: *
083: * Revision 1.7 2002/09/06 07:20:00 colin
084: * changed country implementation to new AddressCountry bean
085: *
086: * Revision 1.6 2002/08/02 16:21:13 jano
087: * added Public Holiday
088: *
089: * Revision 1.5 2002/07/30 08:06:58 jano
090: * added field TYPE to Event
091: *
092: * Revision 1.4 2002/07/22 12:59:30 jano
093: * change Calendar to Calendar in EventDO
094: *
095: * Revision 1.3 2002/07/15 11:59:25 jano
096: * added property DAYEVENT to EventBean
097: *
098: * Revision 1.2 2002/07/11 13:10:09 jano
099: * commiting all calendar files for sure
100: *
101: * Revision 1.1 2002/07/05 09:34:28 jano
102: * first version of EventDO
103: * -----------------------------------------------------------------------------
104: */
105: package com.ivata.groupware.business.calendar.event;
106:
107: import org.apache.log4j.Logger;
108:
109: import java.util.Calendar;
110:
111: import com.ivata.groupware.container.persistence.AuthorTimestampDO;
112:
113: /**
114: * <p>
115: * This class represents a single calendar event.
116: * </p>
117: *
118: * @author Jan Boros
119: * <a href='mailto:janboros@sourceforge.net'>janboros@sourceforge.net</a>
120: * @author Colin MacLeod
121: * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
122: * @version $Revision: 1.7 $
123: * @since ivata groupware 0.9 2002-07-05
124: *
125: * @hibernate.class
126: * table="calendar_event"
127: * @hibernate.cache
128: * usage="read-write"
129: */
130: public class EventDO extends AuthorTimestampDO {
131: /**
132: * Logger for this class.
133: */
134: private static final Logger logger = Logger
135: .getLogger(EventDO.class);
136:
137: /**
138: * Serialization version (for <code>Serializable</code> interface).
139: */
140: private static final long serialVersionUID = 1L;
141:
142: /**
143: * <p>Store whether or not this is an 'all-day' event.</p>
144: */
145: private boolean allDayEvent;
146:
147: /**
148: * <p>Store the description with additional information about the event.</p>
149: */
150: private String description;
151:
152: /**
153: * <p>Store the finish Calendar/time of the event.</p>
154: */
155: private Calendar finish;
156:
157: /**
158: * <p>Store the start Calendar/time of the event.</p>
159: */
160: private Calendar start;
161:
162: /**
163: * <p>Store the subject of this event.</p>
164: */
165: private String subject;
166:
167: /**
168: * <p>Get the description with additional information about the event.</p>
169: *
170: * @return current value of description.
171: * @hibernate.property
172: */
173: public final String getDescription() {
174: if (logger.isDebugEnabled()) {
175: logger.debug("getDescription() - start");
176: }
177:
178: if (logger.isDebugEnabled()) {
179: logger.debug("getDescription() - end - return value = "
180: + description);
181: }
182: return description;
183: }
184:
185: /**
186: * <p>Get the time the event will finish.</p>
187: *
188: * @return time the event will finish.
189: * @hibernate.property
190: */
191: public final Calendar getFinish() {
192: if (logger.isDebugEnabled()) {
193: logger.debug("getFinish() - start");
194: }
195:
196: if (logger.isDebugEnabled()) {
197: logger
198: .debug("getFinish() - end - return value = "
199: + finish);
200: }
201: return finish;
202: }
203:
204: /**
205: * <p>Get the time the event will start.</p>
206: *
207: * @return time the event will start.
208: * @hibernate.property
209: */
210: public final Calendar getStart() {
211: if (logger.isDebugEnabled()) {
212: logger.debug("getStart() - start");
213: }
214:
215: if (logger.isDebugEnabled()) {
216: logger.debug("getStart() - end - return value = " + start);
217: }
218: return start;
219: }
220:
221: /**
222: * <p>Get the brief subject describing the purpose of the event.</p>
223: *
224: * @return current value of subject.
225: * @hibernate.property
226: */
227: public final String getSubject() {
228: if (logger.isDebugEnabled()) {
229: logger.debug("getSubject() - start");
230: }
231:
232: if (logger.isDebugEnabled()) {
233: logger.debug("getSubject() - end - return value = "
234: + subject);
235: }
236: return subject;
237: }
238:
239: /**
240: * <p>Get whether or not this is an 'all-day' event.</p>
241: *
242: * @return <code>true</code> if this is an 'all-day' event,
243: * otherwise <code>false</code>.
244: *
245: * TODO: change the column in the table
246: * @hibernate.property
247: * column="dayevent"
248: */
249: public boolean isAllDayEvent() {
250: if (logger.isDebugEnabled()) {
251: logger.debug("isAllDayEvent() - start");
252: }
253:
254: if (logger.isDebugEnabled()) {
255: logger.debug("isAllDayEvent() - end - return value = "
256: + allDayEvent);
257: }
258: return allDayEvent;
259: }
260:
261: /**
262: * <p>Set whether or not this is an 'all-day' event.</p>
263: *
264: * @param allDayEventParam <code>true</code> if this is an 'all-day' event,
265: * otherwise <code>false</code>.
266: */
267: public final void setAllDayEvent(final boolean allDayEventParam) {
268: if (logger.isDebugEnabled()) {
269: logger.debug("setAllDayEvent(boolean allDayEvent = "
270: + allDayEventParam + ") - start");
271: }
272:
273: checkSetter();
274: this .allDayEvent = allDayEventParam;
275:
276: if (logger.isDebugEnabled()) {
277: logger.debug("setAllDayEvent(boolean) - end");
278: }
279: }
280:
281: /**
282: * <p>Set the description with additional information about the event.</p>
283: *
284: * @param descriptionParam new value of description.
285: */
286: public final void setDescription(final String descriptionParam) {
287: if (logger.isDebugEnabled()) {
288: logger.debug("setDescription(String description = "
289: + descriptionParam + ") - start");
290: }
291:
292: checkSetter();
293: this .description = descriptionParam;
294:
295: if (logger.isDebugEnabled()) {
296: logger.debug("setDescription(String) - end");
297: }
298: }
299:
300: /**
301: * <p>Set the time the event will finish.</p>
302: *
303: * @param finishParam Time the event will finish. Can be <code>null</code>,
304: * if the event has an open finish time.
305: */
306: public final void setFinish(final Calendar finishParam) {
307: if (logger.isDebugEnabled()) {
308: logger.debug("setFinish(Calendar finish = " + finishParam
309: + ") - start");
310: }
311:
312: checkSetter();
313: this .finish = finishParam;
314:
315: if (logger.isDebugEnabled()) {
316: logger.debug("setFinish(Calendar) - end");
317: }
318: }
319:
320: /**
321: * <p>Set the time the event will start.</p>
322: *
323: * @param startParam new time the event will start.
324: */
325: public final void setStart(final Calendar startParam) {
326: if (logger.isDebugEnabled()) {
327: logger.debug("setStart(Calendar start = " + startParam
328: + ") - start");
329: }
330:
331: checkSetter();
332: this .start = startParam;
333:
334: if (logger.isDebugEnabled()) {
335: logger.debug("setStart(Calendar) - end");
336: }
337: }
338:
339: /**
340: * <p>Set the brief subject describing the purpose of the event.</p>
341: *
342: * @param subjectParam new value of subject.
343: */
344: public final void setSubject(final String subjectParam) {
345: if (logger.isDebugEnabled()) {
346: logger.debug("setSubject(String subject = " + subjectParam
347: + ") - start");
348: }
349:
350: checkSetter();
351: this .subject = subjectParam;
352:
353: if (logger.isDebugEnabled()) {
354: logger.debug("setSubject(String) - end");
355: }
356: }
357:
358: }
|