1
22
23 package com.liferay.portlet.calendar.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.DateUtil;
27 import com.liferay.portal.kernel.util.GetterUtil;
28 import com.liferay.portal.model.impl.BaseModelImpl;
29 import com.liferay.portal.util.PropsUtil;
30
31 import com.liferay.portlet.calendar.model.CalEvent;
32
33 import com.liferay.util.Html;
34
35 import java.io.Serializable;
36
37 import java.lang.reflect.Proxy;
38
39 import java.sql.Types;
40
41 import java.util.Date;
42
43
63 public class CalEventModelImpl extends BaseModelImpl {
64 public static final String TABLE_NAME = "CalEvent";
65 public static final Object[][] TABLE_COLUMNS = {
66 { "uuid_", new Integer(Types.VARCHAR) },
67
68
69 { "eventId", new Integer(Types.BIGINT) },
70
71
72 { "groupId", new Integer(Types.BIGINT) },
73
74
75 { "companyId", new Integer(Types.BIGINT) },
76
77
78 { "userId", new Integer(Types.BIGINT) },
79
80
81 { "userName", new Integer(Types.VARCHAR) },
82
83
84 { "createDate", new Integer(Types.TIMESTAMP) },
85
86
87 { "modifiedDate", new Integer(Types.TIMESTAMP) },
88
89
90 { "title", new Integer(Types.VARCHAR) },
91
92
93 { "description", new Integer(Types.VARCHAR) },
94
95
96 { "startDate", new Integer(Types.TIMESTAMP) },
97
98
99 { "endDate", new Integer(Types.TIMESTAMP) },
100
101
102 { "durationHour", new Integer(Types.INTEGER) },
103
104
105 { "durationMinute", new Integer(Types.INTEGER) },
106
107
108 { "allDay", new Integer(Types.BOOLEAN) },
109
110
111 { "timeZoneSensitive", new Integer(Types.BOOLEAN) },
112
113
114 { "type_", new Integer(Types.VARCHAR) },
115
116
117 { "repeating", new Integer(Types.BOOLEAN) },
118
119
120 { "recurrence", new Integer(Types.CLOB) },
121
122
123 { "remindBy", new Integer(Types.VARCHAR) },
124
125
126 { "firstReminder", new Integer(Types.INTEGER) },
127
128
129 { "secondReminder", new Integer(Types.INTEGER) }
130 };
131 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)";
132 public static final String TABLE_SQL_DROP = "drop table CalEvent";
133 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
134 "value.object.finder.cache.enabled.com.liferay.portlet.calendar.model.CalEvent"),
135 true);
136 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
137 "lock.expiration.time.com.liferay.portlet.calendar.model.CalEvent"));
138
139 public CalEventModelImpl() {
140 }
141
142 public long getPrimaryKey() {
143 return _eventId;
144 }
145
146 public void setPrimaryKey(long pk) {
147 setEventId(pk);
148 }
149
150 public Serializable getPrimaryKeyObj() {
151 return new Long(_eventId);
152 }
153
154 public String getUuid() {
155 return GetterUtil.getString(_uuid);
156 }
157
158 public void setUuid(String uuid) {
159 if ((uuid != null) && (uuid != _uuid)) {
160 _uuid = uuid;
161 }
162 }
163
164 public long getEventId() {
165 return _eventId;
166 }
167
168 public void setEventId(long eventId) {
169 if (eventId != _eventId) {
170 _eventId = eventId;
171 }
172 }
173
174 public long getGroupId() {
175 return _groupId;
176 }
177
178 public void setGroupId(long groupId) {
179 if (groupId != _groupId) {
180 _groupId = groupId;
181 }
182 }
183
184 public long getCompanyId() {
185 return _companyId;
186 }
187
188 public void setCompanyId(long companyId) {
189 if (companyId != _companyId) {
190 _companyId = companyId;
191 }
192 }
193
194 public long getUserId() {
195 return _userId;
196 }
197
198 public void setUserId(long userId) {
199 if (userId != _userId) {
200 _userId = userId;
201 }
202 }
203
204 public String getUserName() {
205 return GetterUtil.getString(_userName);
206 }
207
208 public void setUserName(String userName) {
209 if (((userName == null) && (_userName != null)) ||
210 ((userName != null) && (_userName == null)) ||
211 ((userName != null) && (_userName != null) &&
212 !userName.equals(_userName))) {
213 _userName = userName;
214 }
215 }
216
217 public Date getCreateDate() {
218 return _createDate;
219 }
220
221 public void setCreateDate(Date createDate) {
222 if (((createDate == null) && (_createDate != null)) ||
223 ((createDate != null) && (_createDate == null)) ||
224 ((createDate != null) && (_createDate != null) &&
225 !createDate.equals(_createDate))) {
226 _createDate = createDate;
227 }
228 }
229
230 public Date getModifiedDate() {
231 return _modifiedDate;
232 }
233
234 public void setModifiedDate(Date modifiedDate) {
235 if (((modifiedDate == null) && (_modifiedDate != null)) ||
236 ((modifiedDate != null) && (_modifiedDate == null)) ||
237 ((modifiedDate != null) && (_modifiedDate != null) &&
238 !modifiedDate.equals(_modifiedDate))) {
239 _modifiedDate = modifiedDate;
240 }
241 }
242
243 public String getTitle() {
244 return GetterUtil.getString(_title);
245 }
246
247 public void setTitle(String title) {
248 if (((title == null) && (_title != null)) ||
249 ((title != null) && (_title == null)) ||
250 ((title != null) && (_title != null) && !title.equals(_title))) {
251 _title = title;
252 }
253 }
254
255 public String getDescription() {
256 return GetterUtil.getString(_description);
257 }
258
259 public void setDescription(String description) {
260 if (((description == null) && (_description != null)) ||
261 ((description != null) && (_description == null)) ||
262 ((description != null) && (_description != null) &&
263 !description.equals(_description))) {
264 _description = description;
265 }
266 }
267
268 public Date getStartDate() {
269 return _startDate;
270 }
271
272 public void setStartDate(Date startDate) {
273 if (((startDate == null) && (_startDate != null)) ||
274 ((startDate != null) && (_startDate == null)) ||
275 ((startDate != null) && (_startDate != null) &&
276 !startDate.equals(_startDate))) {
277 _startDate = startDate;
278 }
279 }
280
281 public Date getEndDate() {
282 return _endDate;
283 }
284
285 public void setEndDate(Date endDate) {
286 if (((endDate == null) && (_endDate != null)) ||
287 ((endDate != null) && (_endDate == null)) ||
288 ((endDate != null) && (_endDate != null) &&
289 !endDate.equals(_endDate))) {
290 _endDate = endDate;
291 }
292 }
293
294 public int getDurationHour() {
295 return _durationHour;
296 }
297
298 public void setDurationHour(int durationHour) {
299 if (durationHour != _durationHour) {
300 _durationHour = durationHour;
301 }
302 }
303
304 public int getDurationMinute() {
305 return _durationMinute;
306 }
307
308 public void setDurationMinute(int durationMinute) {
309 if (durationMinute != _durationMinute) {
310 _durationMinute = durationMinute;
311 }
312 }
313
314 public boolean getAllDay() {
315 return _allDay;
316 }
317
318 public boolean isAllDay() {
319 return _allDay;
320 }
321
322 public void setAllDay(boolean allDay) {
323 if (allDay != _allDay) {
324 _allDay = allDay;
325 }
326 }
327
328 public boolean getTimeZoneSensitive() {
329 return _timeZoneSensitive;
330 }
331
332 public boolean isTimeZoneSensitive() {
333 return _timeZoneSensitive;
334 }
335
336 public void setTimeZoneSensitive(boolean timeZoneSensitive) {
337 if (timeZoneSensitive != _timeZoneSensitive) {
338 _timeZoneSensitive = timeZoneSensitive;
339 }
340 }
341
342 public String getType() {
343 return GetterUtil.getString(_type);
344 }
345
346 public void setType(String type) {
347 if (((type == null) && (_type != null)) ||
348 ((type != null) && (_type == null)) ||
349 ((type != null) && (_type != null) && !type.equals(_type))) {
350 _type = type;
351 }
352 }
353
354 public boolean getRepeating() {
355 return _repeating;
356 }
357
358 public boolean isRepeating() {
359 return _repeating;
360 }
361
362 public void setRepeating(boolean repeating) {
363 if (repeating != _repeating) {
364 _repeating = repeating;
365 }
366 }
367
368 public String getRecurrence() {
369 return GetterUtil.getString(_recurrence);
370 }
371
372 public void setRecurrence(String recurrence) {
373 if (((recurrence == null) && (_recurrence != null)) ||
374 ((recurrence != null) && (_recurrence == null)) ||
375 ((recurrence != null) && (_recurrence != null) &&
376 !recurrence.equals(_recurrence))) {
377 _recurrence = recurrence;
378 }
379 }
380
381 public String getRemindBy() {
382 return GetterUtil.getString(_remindBy);
383 }
384
385 public void setRemindBy(String remindBy) {
386 if (((remindBy == null) && (_remindBy != null)) ||
387 ((remindBy != null) && (_remindBy == null)) ||
388 ((remindBy != null) && (_remindBy != null) &&
389 !remindBy.equals(_remindBy))) {
390 _remindBy = remindBy;
391 }
392 }
393
394 public int getFirstReminder() {
395 return _firstReminder;
396 }
397
398 public void setFirstReminder(int firstReminder) {
399 if (firstReminder != _firstReminder) {
400 _firstReminder = firstReminder;
401 }
402 }
403
404 public int getSecondReminder() {
405 return _secondReminder;
406 }
407
408 public void setSecondReminder(int secondReminder) {
409 if (secondReminder != _secondReminder) {
410 _secondReminder = secondReminder;
411 }
412 }
413
414 public CalEvent toEscapedModel() {
415 if (isEscapedModel()) {
416 return (CalEvent)this;
417 }
418 else {
419 CalEvent model = new CalEventImpl();
420
421 model.setEscapedModel(true);
422
423 model.setUuid(Html.escape(getUuid()));
424 model.setEventId(getEventId());
425 model.setGroupId(getGroupId());
426 model.setCompanyId(getCompanyId());
427 model.setUserId(getUserId());
428 model.setUserName(Html.escape(getUserName()));
429 model.setCreateDate(getCreateDate());
430 model.setModifiedDate(getModifiedDate());
431 model.setTitle(Html.escape(getTitle()));
432 model.setDescription(Html.escape(getDescription()));
433 model.setStartDate(getStartDate());
434 model.setEndDate(getEndDate());
435 model.setDurationHour(getDurationHour());
436 model.setDurationMinute(getDurationMinute());
437 model.setAllDay(getAllDay());
438 model.setTimeZoneSensitive(getTimeZoneSensitive());
439 model.setType(Html.escape(getType()));
440 model.setRepeating(getRepeating());
441 model.setRecurrence(Html.escape(getRecurrence()));
442 model.setRemindBy(Html.escape(getRemindBy()));
443 model.setFirstReminder(getFirstReminder());
444 model.setSecondReminder(getSecondReminder());
445
446 model = (CalEvent)Proxy.newProxyInstance(CalEvent.class.getClassLoader(),
447 new Class[] { CalEvent.class },
448 new ReadOnlyBeanHandler(model));
449
450 return model;
451 }
452 }
453
454 public Object clone() {
455 CalEventImpl clone = new CalEventImpl();
456
457 clone.setUuid(getUuid());
458 clone.setEventId(getEventId());
459 clone.setGroupId(getGroupId());
460 clone.setCompanyId(getCompanyId());
461 clone.setUserId(getUserId());
462 clone.setUserName(getUserName());
463 clone.setCreateDate(getCreateDate());
464 clone.setModifiedDate(getModifiedDate());
465 clone.setTitle(getTitle());
466 clone.setDescription(getDescription());
467 clone.setStartDate(getStartDate());
468 clone.setEndDate(getEndDate());
469 clone.setDurationHour(getDurationHour());
470 clone.setDurationMinute(getDurationMinute());
471 clone.setAllDay(getAllDay());
472 clone.setTimeZoneSensitive(getTimeZoneSensitive());
473 clone.setType(getType());
474 clone.setRepeating(getRepeating());
475 clone.setRecurrence(getRecurrence());
476 clone.setRemindBy(getRemindBy());
477 clone.setFirstReminder(getFirstReminder());
478 clone.setSecondReminder(getSecondReminder());
479
480 return clone;
481 }
482
483 public int compareTo(Object obj) {
484 if (obj == null) {
485 return -1;
486 }
487
488 CalEventImpl calEvent = (CalEventImpl)obj;
489
490 int value = 0;
491
492 value = DateUtil.compareTo(getStartDate(), calEvent.getStartDate());
493
494 if (value != 0) {
495 return value;
496 }
497
498 value = getTitle().toLowerCase().compareTo(calEvent.getTitle()
499 .toLowerCase());
500
501 if (value != 0) {
502 return value;
503 }
504
505 return 0;
506 }
507
508 public boolean equals(Object obj) {
509 if (obj == null) {
510 return false;
511 }
512
513 CalEventImpl calEvent = null;
514
515 try {
516 calEvent = (CalEventImpl)obj;
517 }
518 catch (ClassCastException cce) {
519 return false;
520 }
521
522 long pk = calEvent.getPrimaryKey();
523
524 if (getPrimaryKey() == pk) {
525 return true;
526 }
527 else {
528 return false;
529 }
530 }
531
532 public int hashCode() {
533 return (int)getPrimaryKey();
534 }
535
536 private String _uuid;
537 private long _eventId;
538 private long _groupId;
539 private long _companyId;
540 private long _userId;
541 private String _userName;
542 private Date _createDate;
543 private Date _modifiedDate;
544 private String _title;
545 private String _description;
546 private Date _startDate;
547 private Date _endDate;
548 private int _durationHour;
549 private int _durationMinute;
550 private boolean _allDay;
551 private boolean _timeZoneSensitive;
552 private String _type;
553 private boolean _repeating;
554 private String _recurrence;
555 private String _remindBy;
556 private int _firstReminder;
557 private int _secondReminder;
558 }