001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portlet.calendar.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.DateUtil;
025: import com.liferay.portal.kernel.util.GetterUtil;
026: import com.liferay.portal.model.impl.BaseModelImpl;
027: import com.liferay.portal.util.PropsUtil;
028:
029: import com.liferay.portlet.calendar.model.CalEvent;
030:
031: import com.liferay.util.Html;
032:
033: import java.io.Serializable;
034:
035: import java.lang.reflect.Proxy;
036:
037: import java.sql.Types;
038:
039: import java.util.Date;
040:
041: /**
042: * <a href="CalEventModelImpl.java.html"><b><i>View Source</i></b></a>
043: *
044: * <p>
045: * ServiceBuilder generated this class. Modifications in this class will be
046: * overwritten the next time is generated.
047: * </p>
048: *
049: * <p>
050: * This class is a model that represents the <code>CalEvent</code> table
051: * in the database.
052: * </p>
053: *
054: * @author Brian Wing Shun Chan
055: *
056: * @see com.liferay.portlet.calendar.service.model.CalEvent
057: * @see com.liferay.portlet.calendar.service.model.CalEventModel
058: * @see com.liferay.portlet.calendar.service.model.impl.CalEventImpl
059: *
060: */
061: public class CalEventModelImpl extends BaseModelImpl {
062: public static final String TABLE_NAME = "CalEvent";
063: public static final Object[][] TABLE_COLUMNS = {
064: { "uuid_", new Integer(Types.VARCHAR) },
065:
066: { "eventId", new Integer(Types.BIGINT) },
067:
068: { "groupId", new Integer(Types.BIGINT) },
069:
070: { "companyId", new Integer(Types.BIGINT) },
071:
072: { "userId", new Integer(Types.BIGINT) },
073:
074: { "userName", new Integer(Types.VARCHAR) },
075:
076: { "createDate", new Integer(Types.TIMESTAMP) },
077:
078: { "modifiedDate", new Integer(Types.TIMESTAMP) },
079:
080: { "title", new Integer(Types.VARCHAR) },
081:
082: { "description", new Integer(Types.VARCHAR) },
083:
084: { "startDate", new Integer(Types.TIMESTAMP) },
085:
086: { "endDate", new Integer(Types.TIMESTAMP) },
087:
088: { "durationHour", new Integer(Types.INTEGER) },
089:
090: { "durationMinute", new Integer(Types.INTEGER) },
091:
092: { "allDay", new Integer(Types.BOOLEAN) },
093:
094: { "timeZoneSensitive", new Integer(Types.BOOLEAN) },
095:
096: { "type_", new Integer(Types.VARCHAR) },
097:
098: { "repeating", new Integer(Types.BOOLEAN) },
099:
100: { "recurrence", new Integer(Types.CLOB) },
101:
102: { "remindBy", new Integer(Types.VARCHAR) },
103:
104: { "firstReminder", new Integer(Types.INTEGER) },
105:
106: { "secondReminder", new Integer(Types.INTEGER) } };
107: public static final String TABLE_SQL_CREATE = "create table CalEvent (uuid_ VARCHAR(75) null,eventId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,title VARCHAR(75) null,description STRING null,startDate DATE null,endDate DATE null,durationHour INTEGER,durationMinute INTEGER,allDay BOOLEAN,timeZoneSensitive BOOLEAN,type_ VARCHAR(75) null,repeating BOOLEAN,recurrence TEXT null,remindBy VARCHAR(75) null,firstReminder INTEGER,secondReminder INTEGER)";
108: public static final String TABLE_SQL_DROP = "drop table CalEvent";
109: public static final boolean CACHE_ENABLED = GetterUtil
110: .getBoolean(
111: PropsUtil
112: .get("value.object.finder.cache.enabled.com.liferay.portlet.calendar.model.CalEvent"),
113: true);
114: public static final long LOCK_EXPIRATION_TIME = GetterUtil
115: .getLong(PropsUtil
116: .get("lock.expiration.time.com.liferay.portlet.calendar.model.CalEvent"));
117:
118: public CalEventModelImpl() {
119: }
120:
121: public long getPrimaryKey() {
122: return _eventId;
123: }
124:
125: public void setPrimaryKey(long pk) {
126: setEventId(pk);
127: }
128:
129: public Serializable getPrimaryKeyObj() {
130: return new Long(_eventId);
131: }
132:
133: public String getUuid() {
134: return GetterUtil.getString(_uuid);
135: }
136:
137: public void setUuid(String uuid) {
138: if ((uuid != null) && (uuid != _uuid)) {
139: _uuid = uuid;
140: }
141: }
142:
143: public long getEventId() {
144: return _eventId;
145: }
146:
147: public void setEventId(long eventId) {
148: if (eventId != _eventId) {
149: _eventId = eventId;
150: }
151: }
152:
153: public long getGroupId() {
154: return _groupId;
155: }
156:
157: public void setGroupId(long groupId) {
158: if (groupId != _groupId) {
159: _groupId = groupId;
160: }
161: }
162:
163: public long getCompanyId() {
164: return _companyId;
165: }
166:
167: public void setCompanyId(long companyId) {
168: if (companyId != _companyId) {
169: _companyId = companyId;
170: }
171: }
172:
173: public long getUserId() {
174: return _userId;
175: }
176:
177: public void setUserId(long userId) {
178: if (userId != _userId) {
179: _userId = userId;
180: }
181: }
182:
183: public String getUserName() {
184: return GetterUtil.getString(_userName);
185: }
186:
187: public void setUserName(String userName) {
188: if (((userName == null) && (_userName != null))
189: || ((userName != null) && (_userName == null))
190: || ((userName != null) && (_userName != null) && !userName
191: .equals(_userName))) {
192: _userName = userName;
193: }
194: }
195:
196: public Date getCreateDate() {
197: return _createDate;
198: }
199:
200: public void setCreateDate(Date createDate) {
201: if (((createDate == null) && (_createDate != null))
202: || ((createDate != null) && (_createDate == null))
203: || ((createDate != null) && (_createDate != null) && !createDate
204: .equals(_createDate))) {
205: _createDate = createDate;
206: }
207: }
208:
209: public Date getModifiedDate() {
210: return _modifiedDate;
211: }
212:
213: public void setModifiedDate(Date modifiedDate) {
214: if (((modifiedDate == null) && (_modifiedDate != null))
215: || ((modifiedDate != null) && (_modifiedDate == null))
216: || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate
217: .equals(_modifiedDate))) {
218: _modifiedDate = modifiedDate;
219: }
220: }
221:
222: public String getTitle() {
223: return GetterUtil.getString(_title);
224: }
225:
226: public void setTitle(String title) {
227: if (((title == null) && (_title != null))
228: || ((title != null) && (_title == null))
229: || ((title != null) && (_title != null) && !title
230: .equals(_title))) {
231: _title = title;
232: }
233: }
234:
235: public String getDescription() {
236: return GetterUtil.getString(_description);
237: }
238:
239: public void setDescription(String description) {
240: if (((description == null) && (_description != null))
241: || ((description != null) && (_description == null))
242: || ((description != null) && (_description != null) && !description
243: .equals(_description))) {
244: _description = description;
245: }
246: }
247:
248: public Date getStartDate() {
249: return _startDate;
250: }
251:
252: public void setStartDate(Date startDate) {
253: if (((startDate == null) && (_startDate != null))
254: || ((startDate != null) && (_startDate == null))
255: || ((startDate != null) && (_startDate != null) && !startDate
256: .equals(_startDate))) {
257: _startDate = startDate;
258: }
259: }
260:
261: public Date getEndDate() {
262: return _endDate;
263: }
264:
265: public void setEndDate(Date endDate) {
266: if (((endDate == null) && (_endDate != null))
267: || ((endDate != null) && (_endDate == null))
268: || ((endDate != null) && (_endDate != null) && !endDate
269: .equals(_endDate))) {
270: _endDate = endDate;
271: }
272: }
273:
274: public int getDurationHour() {
275: return _durationHour;
276: }
277:
278: public void setDurationHour(int durationHour) {
279: if (durationHour != _durationHour) {
280: _durationHour = durationHour;
281: }
282: }
283:
284: public int getDurationMinute() {
285: return _durationMinute;
286: }
287:
288: public void setDurationMinute(int durationMinute) {
289: if (durationMinute != _durationMinute) {
290: _durationMinute = durationMinute;
291: }
292: }
293:
294: public boolean getAllDay() {
295: return _allDay;
296: }
297:
298: public boolean isAllDay() {
299: return _allDay;
300: }
301:
302: public void setAllDay(boolean allDay) {
303: if (allDay != _allDay) {
304: _allDay = allDay;
305: }
306: }
307:
308: public boolean getTimeZoneSensitive() {
309: return _timeZoneSensitive;
310: }
311:
312: public boolean isTimeZoneSensitive() {
313: return _timeZoneSensitive;
314: }
315:
316: public void setTimeZoneSensitive(boolean timeZoneSensitive) {
317: if (timeZoneSensitive != _timeZoneSensitive) {
318: _timeZoneSensitive = timeZoneSensitive;
319: }
320: }
321:
322: public String getType() {
323: return GetterUtil.getString(_type);
324: }
325:
326: public void setType(String type) {
327: if (((type == null) && (_type != null))
328: || ((type != null) && (_type == null))
329: || ((type != null) && (_type != null) && !type
330: .equals(_type))) {
331: _type = type;
332: }
333: }
334:
335: public boolean getRepeating() {
336: return _repeating;
337: }
338:
339: public boolean isRepeating() {
340: return _repeating;
341: }
342:
343: public void setRepeating(boolean repeating) {
344: if (repeating != _repeating) {
345: _repeating = repeating;
346: }
347: }
348:
349: public String getRecurrence() {
350: return GetterUtil.getString(_recurrence);
351: }
352:
353: public void setRecurrence(String recurrence) {
354: if (((recurrence == null) && (_recurrence != null))
355: || ((recurrence != null) && (_recurrence == null))
356: || ((recurrence != null) && (_recurrence != null) && !recurrence
357: .equals(_recurrence))) {
358: _recurrence = recurrence;
359: }
360: }
361:
362: public String getRemindBy() {
363: return GetterUtil.getString(_remindBy);
364: }
365:
366: public void setRemindBy(String remindBy) {
367: if (((remindBy == null) && (_remindBy != null))
368: || ((remindBy != null) && (_remindBy == null))
369: || ((remindBy != null) && (_remindBy != null) && !remindBy
370: .equals(_remindBy))) {
371: _remindBy = remindBy;
372: }
373: }
374:
375: public int getFirstReminder() {
376: return _firstReminder;
377: }
378:
379: public void setFirstReminder(int firstReminder) {
380: if (firstReminder != _firstReminder) {
381: _firstReminder = firstReminder;
382: }
383: }
384:
385: public int getSecondReminder() {
386: return _secondReminder;
387: }
388:
389: public void setSecondReminder(int secondReminder) {
390: if (secondReminder != _secondReminder) {
391: _secondReminder = secondReminder;
392: }
393: }
394:
395: public CalEvent toEscapedModel() {
396: if (isEscapedModel()) {
397: return (CalEvent) this ;
398: } else {
399: CalEvent model = new CalEventImpl();
400:
401: model.setEscapedModel(true);
402:
403: model.setUuid(Html.escape(getUuid()));
404: model.setEventId(getEventId());
405: model.setGroupId(getGroupId());
406: model.setCompanyId(getCompanyId());
407: model.setUserId(getUserId());
408: model.setUserName(Html.escape(getUserName()));
409: model.setCreateDate(getCreateDate());
410: model.setModifiedDate(getModifiedDate());
411: model.setTitle(Html.escape(getTitle()));
412: model.setDescription(Html.escape(getDescription()));
413: model.setStartDate(getStartDate());
414: model.setEndDate(getEndDate());
415: model.setDurationHour(getDurationHour());
416: model.setDurationMinute(getDurationMinute());
417: model.setAllDay(getAllDay());
418: model.setTimeZoneSensitive(getTimeZoneSensitive());
419: model.setType(Html.escape(getType()));
420: model.setRepeating(getRepeating());
421: model.setRecurrence(Html.escape(getRecurrence()));
422: model.setRemindBy(Html.escape(getRemindBy()));
423: model.setFirstReminder(getFirstReminder());
424: model.setSecondReminder(getSecondReminder());
425:
426: model = (CalEvent) Proxy.newProxyInstance(CalEvent.class
427: .getClassLoader(), new Class[] { CalEvent.class },
428: new ReadOnlyBeanHandler(model));
429:
430: return model;
431: }
432: }
433:
434: public Object clone() {
435: CalEventImpl clone = new CalEventImpl();
436:
437: clone.setUuid(getUuid());
438: clone.setEventId(getEventId());
439: clone.setGroupId(getGroupId());
440: clone.setCompanyId(getCompanyId());
441: clone.setUserId(getUserId());
442: clone.setUserName(getUserName());
443: clone.setCreateDate(getCreateDate());
444: clone.setModifiedDate(getModifiedDate());
445: clone.setTitle(getTitle());
446: clone.setDescription(getDescription());
447: clone.setStartDate(getStartDate());
448: clone.setEndDate(getEndDate());
449: clone.setDurationHour(getDurationHour());
450: clone.setDurationMinute(getDurationMinute());
451: clone.setAllDay(getAllDay());
452: clone.setTimeZoneSensitive(getTimeZoneSensitive());
453: clone.setType(getType());
454: clone.setRepeating(getRepeating());
455: clone.setRecurrence(getRecurrence());
456: clone.setRemindBy(getRemindBy());
457: clone.setFirstReminder(getFirstReminder());
458: clone.setSecondReminder(getSecondReminder());
459:
460: return clone;
461: }
462:
463: public int compareTo(Object obj) {
464: if (obj == null) {
465: return -1;
466: }
467:
468: CalEventImpl calEvent = (CalEventImpl) obj;
469:
470: int value = 0;
471:
472: value = DateUtil.compareTo(getStartDate(), calEvent
473: .getStartDate());
474:
475: if (value != 0) {
476: return value;
477: }
478:
479: value = getTitle().toLowerCase().compareTo(
480: calEvent.getTitle().toLowerCase());
481:
482: if (value != 0) {
483: return value;
484: }
485:
486: return 0;
487: }
488:
489: public boolean equals(Object obj) {
490: if (obj == null) {
491: return false;
492: }
493:
494: CalEventImpl calEvent = null;
495:
496: try {
497: calEvent = (CalEventImpl) obj;
498: } catch (ClassCastException cce) {
499: return false;
500: }
501:
502: long pk = calEvent.getPrimaryKey();
503:
504: if (getPrimaryKey() == pk) {
505: return true;
506: } else {
507: return false;
508: }
509: }
510:
511: public int hashCode() {
512: return (int) getPrimaryKey();
513: }
514:
515: private String _uuid;
516: private long _eventId;
517: private long _groupId;
518: private long _companyId;
519: private long _userId;
520: private String _userName;
521: private Date _createDate;
522: private Date _modifiedDate;
523: private String _title;
524: private String _description;
525: private Date _startDate;
526: private Date _endDate;
527: private int _durationHour;
528: private int _durationMinute;
529: private boolean _allDay;
530: private boolean _timeZoneSensitive;
531: private String _type;
532: private boolean _repeating;
533: private String _recurrence;
534: private String _remindBy;
535: private int _firstReminder;
536: private int _secondReminder;
537: }
|