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