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.kernel.util.HtmlUtil;
29 import com.liferay.portal.model.impl.BaseModelImpl;
30
31 import com.liferay.portlet.calendar.model.CalEvent;
32 import com.liferay.portlet.calendar.model.CalEventSoap;
33
34 import java.io.Serializable;
35
36 import java.lang.reflect.Proxy;
37
38 import java.sql.Types;
39
40 import java.util.ArrayList;
41 import java.util.Date;
42 import java.util.List;
43
44
64 public class CalEventModelImpl extends BaseModelImpl<CalEvent> {
65 public static final String TABLE_NAME = "CalEvent";
66 public static final Object[][] TABLE_COLUMNS = {
67 { "uuid_", new Integer(Types.VARCHAR) },
68
69
70 { "eventId", new Integer(Types.BIGINT) },
71
72
73 { "groupId", new Integer(Types.BIGINT) },
74
75
76 { "companyId", new Integer(Types.BIGINT) },
77
78
79 { "userId", new Integer(Types.BIGINT) },
80
81
82 { "userName", new Integer(Types.VARCHAR) },
83
84
85 { "createDate", new Integer(Types.TIMESTAMP) },
86
87
88 { "modifiedDate", new Integer(Types.TIMESTAMP) },
89
90
91 { "title", new Integer(Types.VARCHAR) },
92
93
94 { "description", new Integer(Types.VARCHAR) },
95
96
97 { "startDate", new Integer(Types.TIMESTAMP) },
98
99
100 { "endDate", new Integer(Types.TIMESTAMP) },
101
102
103 { "durationHour", new Integer(Types.INTEGER) },
104
105
106 { "durationMinute", new Integer(Types.INTEGER) },
107
108
109 { "allDay", new Integer(Types.BOOLEAN) },
110
111
112 { "timeZoneSensitive", new Integer(Types.BOOLEAN) },
113
114
115 { "type_", new Integer(Types.VARCHAR) },
116
117
118 { "repeating", new Integer(Types.BOOLEAN) },
119
120
121 { "recurrence", new Integer(Types.CLOB) },
122
123
124 { "remindBy", new Integer(Types.INTEGER) },
125
126
127 { "firstReminder", new Integer(Types.INTEGER) },
128
129
130 { "secondReminder", new Integer(Types.INTEGER) }
131 };
132 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 INTEGER,firstReminder INTEGER,secondReminder INTEGER)";
133 public static final String TABLE_SQL_DROP = "drop table CalEvent";
134 public static final String DATA_SOURCE = "liferayDataSource";
135 public static final String SESSION_FACTORY = "liferaySessionFactory";
136 public static final String TX_MANAGER = "liferayTransactionManager";
137 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
138 "value.object.entity.cache.enabled.com.liferay.portlet.calendar.model.CalEvent"),
139 true);
140 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
141 "value.object.finder.cache.enabled.com.liferay.portlet.calendar.model.CalEvent"),
142 true);
143
144 public static CalEvent toModel(CalEventSoap soapModel) {
145 CalEvent model = new CalEventImpl();
146
147 model.setUuid(soapModel.getUuid());
148 model.setEventId(soapModel.getEventId());
149 model.setGroupId(soapModel.getGroupId());
150 model.setCompanyId(soapModel.getCompanyId());
151 model.setUserId(soapModel.getUserId());
152 model.setUserName(soapModel.getUserName());
153 model.setCreateDate(soapModel.getCreateDate());
154 model.setModifiedDate(soapModel.getModifiedDate());
155 model.setTitle(soapModel.getTitle());
156 model.setDescription(soapModel.getDescription());
157 model.setStartDate(soapModel.getStartDate());
158 model.setEndDate(soapModel.getEndDate());
159 model.setDurationHour(soapModel.getDurationHour());
160 model.setDurationMinute(soapModel.getDurationMinute());
161 model.setAllDay(soapModel.getAllDay());
162 model.setTimeZoneSensitive(soapModel.getTimeZoneSensitive());
163 model.setType(soapModel.getType());
164 model.setRepeating(soapModel.getRepeating());
165 model.setRecurrence(soapModel.getRecurrence());
166 model.setRemindBy(soapModel.getRemindBy());
167 model.setFirstReminder(soapModel.getFirstReminder());
168 model.setSecondReminder(soapModel.getSecondReminder());
169
170 return model;
171 }
172
173 public static List<CalEvent> toModels(CalEventSoap[] soapModels) {
174 List<CalEvent> models = new ArrayList<CalEvent>(soapModels.length);
175
176 for (CalEventSoap soapModel : soapModels) {
177 models.add(toModel(soapModel));
178 }
179
180 return models;
181 }
182
183 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
184 "lock.expiration.time.com.liferay.portlet.calendar.model.CalEvent"));
185
186 public CalEventModelImpl() {
187 }
188
189 public long getPrimaryKey() {
190 return _eventId;
191 }
192
193 public void setPrimaryKey(long pk) {
194 setEventId(pk);
195 }
196
197 public Serializable getPrimaryKeyObj() {
198 return new Long(_eventId);
199 }
200
201 public String getUuid() {
202 return GetterUtil.getString(_uuid);
203 }
204
205 public void setUuid(String uuid) {
206 _uuid = uuid;
207
208 if (_originalUuid == null) {
209 _originalUuid = uuid;
210 }
211 }
212
213 public String getOriginalUuid() {
214 return GetterUtil.getString(_originalUuid);
215 }
216
217 public long getEventId() {
218 return _eventId;
219 }
220
221 public void setEventId(long eventId) {
222 _eventId = eventId;
223 }
224
225 public long getGroupId() {
226 return _groupId;
227 }
228
229 public void setGroupId(long groupId) {
230 _groupId = groupId;
231
232 if (!_setOriginalGroupId) {
233 _setOriginalGroupId = true;
234
235 _originalGroupId = groupId;
236 }
237 }
238
239 public long getOriginalGroupId() {
240 return _originalGroupId;
241 }
242
243 public long getCompanyId() {
244 return _companyId;
245 }
246
247 public void setCompanyId(long companyId) {
248 _companyId = companyId;
249 }
250
251 public long getUserId() {
252 return _userId;
253 }
254
255 public void setUserId(long userId) {
256 _userId = userId;
257 }
258
259 public String getUserName() {
260 return GetterUtil.getString(_userName);
261 }
262
263 public void setUserName(String userName) {
264 _userName = userName;
265 }
266
267 public Date getCreateDate() {
268 return _createDate;
269 }
270
271 public void setCreateDate(Date createDate) {
272 _createDate = createDate;
273 }
274
275 public Date getModifiedDate() {
276 return _modifiedDate;
277 }
278
279 public void setModifiedDate(Date modifiedDate) {
280 _modifiedDate = modifiedDate;
281 }
282
283 public String getTitle() {
284 return GetterUtil.getString(_title);
285 }
286
287 public void setTitle(String title) {
288 _title = title;
289 }
290
291 public String getDescription() {
292 return GetterUtil.getString(_description);
293 }
294
295 public void setDescription(String description) {
296 _description = description;
297 }
298
299 public Date getStartDate() {
300 return _startDate;
301 }
302
303 public void setStartDate(Date startDate) {
304 _startDate = startDate;
305 }
306
307 public Date getEndDate() {
308 return _endDate;
309 }
310
311 public void setEndDate(Date endDate) {
312 _endDate = endDate;
313 }
314
315 public int getDurationHour() {
316 return _durationHour;
317 }
318
319 public void setDurationHour(int durationHour) {
320 _durationHour = durationHour;
321 }
322
323 public int getDurationMinute() {
324 return _durationMinute;
325 }
326
327 public void setDurationMinute(int durationMinute) {
328 _durationMinute = durationMinute;
329 }
330
331 public boolean getAllDay() {
332 return _allDay;
333 }
334
335 public boolean isAllDay() {
336 return _allDay;
337 }
338
339 public void setAllDay(boolean allDay) {
340 _allDay = allDay;
341 }
342
343 public boolean getTimeZoneSensitive() {
344 return _timeZoneSensitive;
345 }
346
347 public boolean isTimeZoneSensitive() {
348 return _timeZoneSensitive;
349 }
350
351 public void setTimeZoneSensitive(boolean timeZoneSensitive) {
352 _timeZoneSensitive = timeZoneSensitive;
353 }
354
355 public String getType() {
356 return GetterUtil.getString(_type);
357 }
358
359 public void setType(String type) {
360 _type = type;
361 }
362
363 public boolean getRepeating() {
364 return _repeating;
365 }
366
367 public boolean isRepeating() {
368 return _repeating;
369 }
370
371 public void setRepeating(boolean repeating) {
372 _repeating = repeating;
373 }
374
375 public String getRecurrence() {
376 return GetterUtil.getString(_recurrence);
377 }
378
379 public void setRecurrence(String recurrence) {
380 _recurrence = recurrence;
381 }
382
383 public int getRemindBy() {
384 return _remindBy;
385 }
386
387 public void setRemindBy(int remindBy) {
388 _remindBy = remindBy;
389 }
390
391 public int getFirstReminder() {
392 return _firstReminder;
393 }
394
395 public void setFirstReminder(int firstReminder) {
396 _firstReminder = firstReminder;
397 }
398
399 public int getSecondReminder() {
400 return _secondReminder;
401 }
402
403 public void setSecondReminder(int secondReminder) {
404 _secondReminder = secondReminder;
405 }
406
407 public CalEvent toEscapedModel() {
408 if (isEscapedModel()) {
409 return (CalEvent)this;
410 }
411 else {
412 CalEvent model = new CalEventImpl();
413
414 model.setNew(isNew());
415 model.setEscapedModel(true);
416
417 model.setUuid(HtmlUtil.escape(getUuid()));
418 model.setEventId(getEventId());
419 model.setGroupId(getGroupId());
420 model.setCompanyId(getCompanyId());
421 model.setUserId(getUserId());
422 model.setUserName(HtmlUtil.escape(getUserName()));
423 model.setCreateDate(getCreateDate());
424 model.setModifiedDate(getModifiedDate());
425 model.setTitle(HtmlUtil.escape(getTitle()));
426 model.setDescription(HtmlUtil.escape(getDescription()));
427 model.setStartDate(getStartDate());
428 model.setEndDate(getEndDate());
429 model.setDurationHour(getDurationHour());
430 model.setDurationMinute(getDurationMinute());
431 model.setAllDay(getAllDay());
432 model.setTimeZoneSensitive(getTimeZoneSensitive());
433 model.setType(HtmlUtil.escape(getType()));
434 model.setRepeating(getRepeating());
435 model.setRecurrence(getRecurrence());
436 model.setRemindBy(getRemindBy());
437 model.setFirstReminder(getFirstReminder());
438 model.setSecondReminder(getSecondReminder());
439
440 model = (CalEvent)Proxy.newProxyInstance(CalEvent.class.getClassLoader(),
441 new Class[] { CalEvent.class },
442 new ReadOnlyBeanHandler(model));
443
444 return model;
445 }
446 }
447
448 public Object clone() {
449 CalEventImpl clone = new CalEventImpl();
450
451 clone.setUuid(getUuid());
452 clone.setEventId(getEventId());
453 clone.setGroupId(getGroupId());
454 clone.setCompanyId(getCompanyId());
455 clone.setUserId(getUserId());
456 clone.setUserName(getUserName());
457 clone.setCreateDate(getCreateDate());
458 clone.setModifiedDate(getModifiedDate());
459 clone.setTitle(getTitle());
460 clone.setDescription(getDescription());
461 clone.setStartDate(getStartDate());
462 clone.setEndDate(getEndDate());
463 clone.setDurationHour(getDurationHour());
464 clone.setDurationMinute(getDurationMinute());
465 clone.setAllDay(getAllDay());
466 clone.setTimeZoneSensitive(getTimeZoneSensitive());
467 clone.setType(getType());
468 clone.setRepeating(getRepeating());
469 clone.setRecurrence(getRecurrence());
470 clone.setRemindBy(getRemindBy());
471 clone.setFirstReminder(getFirstReminder());
472 clone.setSecondReminder(getSecondReminder());
473
474 return clone;
475 }
476
477 public int compareTo(CalEvent calEvent) {
478 int value = 0;
479
480 value = DateUtil.compareTo(getStartDate(), calEvent.getStartDate());
481
482 if (value != 0) {
483 return value;
484 }
485
486 value = getTitle().toLowerCase()
487 .compareTo(calEvent.getTitle().toLowerCase());
488
489 if (value != 0) {
490 return value;
491 }
492
493 return 0;
494 }
495
496 public boolean equals(Object obj) {
497 if (obj == null) {
498 return false;
499 }
500
501 CalEvent calEvent = null;
502
503 try {
504 calEvent = (CalEvent)obj;
505 }
506 catch (ClassCastException cce) {
507 return false;
508 }
509
510 long pk = calEvent.getPrimaryKey();
511
512 if (getPrimaryKey() == pk) {
513 return true;
514 }
515 else {
516 return false;
517 }
518 }
519
520 public int hashCode() {
521 return (int)getPrimaryKey();
522 }
523
524 public String toString() {
525 StringBuilder sb = new StringBuilder();
526
527 sb.append("{uuid=");
528 sb.append(getUuid());
529 sb.append(", eventId=");
530 sb.append(getEventId());
531 sb.append(", groupId=");
532 sb.append(getGroupId());
533 sb.append(", companyId=");
534 sb.append(getCompanyId());
535 sb.append(", userId=");
536 sb.append(getUserId());
537 sb.append(", userName=");
538 sb.append(getUserName());
539 sb.append(", createDate=");
540 sb.append(getCreateDate());
541 sb.append(", modifiedDate=");
542 sb.append(getModifiedDate());
543 sb.append(", title=");
544 sb.append(getTitle());
545 sb.append(", description=");
546 sb.append(getDescription());
547 sb.append(", startDate=");
548 sb.append(getStartDate());
549 sb.append(", endDate=");
550 sb.append(getEndDate());
551 sb.append(", durationHour=");
552 sb.append(getDurationHour());
553 sb.append(", durationMinute=");
554 sb.append(getDurationMinute());
555 sb.append(", allDay=");
556 sb.append(getAllDay());
557 sb.append(", timeZoneSensitive=");
558 sb.append(getTimeZoneSensitive());
559 sb.append(", type=");
560 sb.append(getType());
561 sb.append(", repeating=");
562 sb.append(getRepeating());
563 sb.append(", recurrence=");
564 sb.append(getRecurrence());
565 sb.append(", remindBy=");
566 sb.append(getRemindBy());
567 sb.append(", firstReminder=");
568 sb.append(getFirstReminder());
569 sb.append(", secondReminder=");
570 sb.append(getSecondReminder());
571 sb.append("}");
572
573 return sb.toString();
574 }
575
576 public String toXmlString() {
577 StringBuilder sb = new StringBuilder();
578
579 sb.append("<model><model-name>");
580 sb.append("com.liferay.portlet.calendar.model.CalEvent");
581 sb.append("</model-name>");
582
583 sb.append(
584 "<column><column-name>uuid</column-name><column-value><![CDATA[");
585 sb.append(getUuid());
586 sb.append("]]></column-value></column>");
587 sb.append(
588 "<column><column-name>eventId</column-name><column-value><![CDATA[");
589 sb.append(getEventId());
590 sb.append("]]></column-value></column>");
591 sb.append(
592 "<column><column-name>groupId</column-name><column-value><![CDATA[");
593 sb.append(getGroupId());
594 sb.append("]]></column-value></column>");
595 sb.append(
596 "<column><column-name>companyId</column-name><column-value><![CDATA[");
597 sb.append(getCompanyId());
598 sb.append("]]></column-value></column>");
599 sb.append(
600 "<column><column-name>userId</column-name><column-value><![CDATA[");
601 sb.append(getUserId());
602 sb.append("]]></column-value></column>");
603 sb.append(
604 "<column><column-name>userName</column-name><column-value><![CDATA[");
605 sb.append(getUserName());
606 sb.append("]]></column-value></column>");
607 sb.append(
608 "<column><column-name>createDate</column-name><column-value><![CDATA[");
609 sb.append(getCreateDate());
610 sb.append("]]></column-value></column>");
611 sb.append(
612 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
613 sb.append(getModifiedDate());
614 sb.append("]]></column-value></column>");
615 sb.append(
616 "<column><column-name>title</column-name><column-value><![CDATA[");
617 sb.append(getTitle());
618 sb.append("]]></column-value></column>");
619 sb.append(
620 "<column><column-name>description</column-name><column-value><![CDATA[");
621 sb.append(getDescription());
622 sb.append("]]></column-value></column>");
623 sb.append(
624 "<column><column-name>startDate</column-name><column-value><![CDATA[");
625 sb.append(getStartDate());
626 sb.append("]]></column-value></column>");
627 sb.append(
628 "<column><column-name>endDate</column-name><column-value><![CDATA[");
629 sb.append(getEndDate());
630 sb.append("]]></column-value></column>");
631 sb.append(
632 "<column><column-name>durationHour</column-name><column-value><![CDATA[");
633 sb.append(getDurationHour());
634 sb.append("]]></column-value></column>");
635 sb.append(
636 "<column><column-name>durationMinute</column-name><column-value><![CDATA[");
637 sb.append(getDurationMinute());
638 sb.append("]]></column-value></column>");
639 sb.append(
640 "<column><column-name>allDay</column-name><column-value><![CDATA[");
641 sb.append(getAllDay());
642 sb.append("]]></column-value></column>");
643 sb.append(
644 "<column><column-name>timeZoneSensitive</column-name><column-value><![CDATA[");
645 sb.append(getTimeZoneSensitive());
646 sb.append("]]></column-value></column>");
647 sb.append(
648 "<column><column-name>type</column-name><column-value><![CDATA[");
649 sb.append(getType());
650 sb.append("]]></column-value></column>");
651 sb.append(
652 "<column><column-name>repeating</column-name><column-value><![CDATA[");
653 sb.append(getRepeating());
654 sb.append("]]></column-value></column>");
655 sb.append(
656 "<column><column-name>recurrence</column-name><column-value><![CDATA[");
657 sb.append(getRecurrence());
658 sb.append("]]></column-value></column>");
659 sb.append(
660 "<column><column-name>remindBy</column-name><column-value><![CDATA[");
661 sb.append(getRemindBy());
662 sb.append("]]></column-value></column>");
663 sb.append(
664 "<column><column-name>firstReminder</column-name><column-value><![CDATA[");
665 sb.append(getFirstReminder());
666 sb.append("]]></column-value></column>");
667 sb.append(
668 "<column><column-name>secondReminder</column-name><column-value><![CDATA[");
669 sb.append(getSecondReminder());
670 sb.append("]]></column-value></column>");
671
672 sb.append("</model>");
673
674 return sb.toString();
675 }
676
677 private String _uuid;
678 private String _originalUuid;
679 private long _eventId;
680 private long _groupId;
681 private long _originalGroupId;
682 private boolean _setOriginalGroupId;
683 private long _companyId;
684 private long _userId;
685 private String _userName;
686 private Date _createDate;
687 private Date _modifiedDate;
688 private String _title;
689 private String _description;
690 private Date _startDate;
691 private Date _endDate;
692 private int _durationHour;
693 private int _durationMinute;
694 private boolean _allDay;
695 private boolean _timeZoneSensitive;
696 private String _type;
697 private boolean _repeating;
698 private String _recurrence;
699 private int _remindBy;
700 private int _firstReminder;
701 private int _secondReminder;
702 }