001
014
015 package com.liferay.portlet.calendar.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.json.JSON;
020 import com.liferay.portal.kernel.util.DateUtil;
021 import com.liferay.portal.kernel.util.GetterUtil;
022 import com.liferay.portal.kernel.util.ProxyUtil;
023 import com.liferay.portal.kernel.util.StringBundler;
024 import com.liferay.portal.kernel.util.StringPool;
025 import com.liferay.portal.model.CacheModel;
026 import com.liferay.portal.model.impl.BaseModelImpl;
027 import com.liferay.portal.service.ServiceContext;
028 import com.liferay.portal.util.PortalUtil;
029
030 import com.liferay.portlet.calendar.model.CalEvent;
031 import com.liferay.portlet.calendar.model.CalEventModel;
032 import com.liferay.portlet.calendar.model.CalEventSoap;
033 import com.liferay.portlet.expando.model.ExpandoBridge;
034 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
035
036 import java.io.Serializable;
037
038 import java.sql.Types;
039
040 import java.util.ArrayList;
041 import java.util.Date;
042 import java.util.HashMap;
043 import java.util.List;
044 import java.util.Map;
045
046
059 @JSON(strict = true)
060 public class CalEventModelImpl extends BaseModelImpl<CalEvent>
061 implements CalEventModel {
062
067 public static final String TABLE_NAME = "CalEvent";
068 public static final Object[][] TABLE_COLUMNS = {
069 { "uuid_", Types.VARCHAR },
070 { "eventId", Types.BIGINT },
071 { "groupId", Types.BIGINT },
072 { "companyId", Types.BIGINT },
073 { "userId", Types.BIGINT },
074 { "userName", Types.VARCHAR },
075 { "createDate", Types.TIMESTAMP },
076 { "modifiedDate", Types.TIMESTAMP },
077 { "title", Types.VARCHAR },
078 { "description", Types.VARCHAR },
079 { "location", Types.VARCHAR },
080 { "startDate", Types.TIMESTAMP },
081 { "endDate", Types.TIMESTAMP },
082 { "durationHour", Types.INTEGER },
083 { "durationMinute", Types.INTEGER },
084 { "allDay", Types.BOOLEAN },
085 { "timeZoneSensitive", Types.BOOLEAN },
086 { "type_", Types.VARCHAR },
087 { "repeating", Types.BOOLEAN },
088 { "recurrence", Types.CLOB },
089 { "remindBy", Types.INTEGER },
090 { "firstReminder", Types.INTEGER },
091 { "secondReminder", Types.INTEGER }
092 };
093 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,location 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)";
094 public static final String TABLE_SQL_DROP = "drop table CalEvent";
095 public static final String ORDER_BY_JPQL = " ORDER BY calEvent.startDate ASC, calEvent.title ASC";
096 public static final String ORDER_BY_SQL = " ORDER BY CalEvent.startDate ASC, CalEvent.title ASC";
097 public static final String DATA_SOURCE = "liferayDataSource";
098 public static final String SESSION_FACTORY = "liferaySessionFactory";
099 public static final String TX_MANAGER = "liferayTransactionManager";
100 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
101 "value.object.entity.cache.enabled.com.liferay.portlet.calendar.model.CalEvent"),
102 true);
103 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
104 "value.object.finder.cache.enabled.com.liferay.portlet.calendar.model.CalEvent"),
105 true);
106 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
107 "value.object.column.bitmask.enabled.com.liferay.portlet.calendar.model.CalEvent"),
108 true);
109 public static long COMPANYID_COLUMN_BITMASK = 1L;
110 public static long GROUPID_COLUMN_BITMASK = 2L;
111 public static long REMINDBY_COLUMN_BITMASK = 4L;
112 public static long REPEATING_COLUMN_BITMASK = 8L;
113 public static long TYPE_COLUMN_BITMASK = 16L;
114 public static long UUID_COLUMN_BITMASK = 32L;
115 public static long STARTDATE_COLUMN_BITMASK = 64L;
116 public static long TITLE_COLUMN_BITMASK = 128L;
117
118
124 public static CalEvent toModel(CalEventSoap soapModel) {
125 if (soapModel == null) {
126 return null;
127 }
128
129 CalEvent model = new CalEventImpl();
130
131 model.setUuid(soapModel.getUuid());
132 model.setEventId(soapModel.getEventId());
133 model.setGroupId(soapModel.getGroupId());
134 model.setCompanyId(soapModel.getCompanyId());
135 model.setUserId(soapModel.getUserId());
136 model.setUserName(soapModel.getUserName());
137 model.setCreateDate(soapModel.getCreateDate());
138 model.setModifiedDate(soapModel.getModifiedDate());
139 model.setTitle(soapModel.getTitle());
140 model.setDescription(soapModel.getDescription());
141 model.setLocation(soapModel.getLocation());
142 model.setStartDate(soapModel.getStartDate());
143 model.setEndDate(soapModel.getEndDate());
144 model.setDurationHour(soapModel.getDurationHour());
145 model.setDurationMinute(soapModel.getDurationMinute());
146 model.setAllDay(soapModel.getAllDay());
147 model.setTimeZoneSensitive(soapModel.getTimeZoneSensitive());
148 model.setType(soapModel.getType());
149 model.setRepeating(soapModel.getRepeating());
150 model.setRecurrence(soapModel.getRecurrence());
151 model.setRemindBy(soapModel.getRemindBy());
152 model.setFirstReminder(soapModel.getFirstReminder());
153 model.setSecondReminder(soapModel.getSecondReminder());
154
155 return model;
156 }
157
158
164 public static List<CalEvent> toModels(CalEventSoap[] soapModels) {
165 if (soapModels == null) {
166 return null;
167 }
168
169 List<CalEvent> models = new ArrayList<CalEvent>(soapModels.length);
170
171 for (CalEventSoap soapModel : soapModels) {
172 models.add(toModel(soapModel));
173 }
174
175 return models;
176 }
177
178 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
179 "lock.expiration.time.com.liferay.portlet.calendar.model.CalEvent"));
180
181 public CalEventModelImpl() {
182 }
183
184 public long getPrimaryKey() {
185 return _eventId;
186 }
187
188 public void setPrimaryKey(long primaryKey) {
189 setEventId(primaryKey);
190 }
191
192 public Serializable getPrimaryKeyObj() {
193 return _eventId;
194 }
195
196 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
197 setPrimaryKey(((Long)primaryKeyObj).longValue());
198 }
199
200 public Class<?> getModelClass() {
201 return CalEvent.class;
202 }
203
204 public String getModelClassName() {
205 return CalEvent.class.getName();
206 }
207
208 @Override
209 public Map<String, Object> getModelAttributes() {
210 Map<String, Object> attributes = new HashMap<String, Object>();
211
212 attributes.put("uuid", getUuid());
213 attributes.put("eventId", getEventId());
214 attributes.put("groupId", getGroupId());
215 attributes.put("companyId", getCompanyId());
216 attributes.put("userId", getUserId());
217 attributes.put("userName", getUserName());
218 attributes.put("createDate", getCreateDate());
219 attributes.put("modifiedDate", getModifiedDate());
220 attributes.put("title", getTitle());
221 attributes.put("description", getDescription());
222 attributes.put("location", getLocation());
223 attributes.put("startDate", getStartDate());
224 attributes.put("endDate", getEndDate());
225 attributes.put("durationHour", getDurationHour());
226 attributes.put("durationMinute", getDurationMinute());
227 attributes.put("allDay", getAllDay());
228 attributes.put("timeZoneSensitive", getTimeZoneSensitive());
229 attributes.put("type", getType());
230 attributes.put("repeating", getRepeating());
231 attributes.put("recurrence", getRecurrence());
232 attributes.put("remindBy", getRemindBy());
233 attributes.put("firstReminder", getFirstReminder());
234 attributes.put("secondReminder", getSecondReminder());
235
236 return attributes;
237 }
238
239 @Override
240 public void setModelAttributes(Map<String, Object> attributes) {
241 String uuid = (String)attributes.get("uuid");
242
243 if (uuid != null) {
244 setUuid(uuid);
245 }
246
247 Long eventId = (Long)attributes.get("eventId");
248
249 if (eventId != null) {
250 setEventId(eventId);
251 }
252
253 Long groupId = (Long)attributes.get("groupId");
254
255 if (groupId != null) {
256 setGroupId(groupId);
257 }
258
259 Long companyId = (Long)attributes.get("companyId");
260
261 if (companyId != null) {
262 setCompanyId(companyId);
263 }
264
265 Long userId = (Long)attributes.get("userId");
266
267 if (userId != null) {
268 setUserId(userId);
269 }
270
271 String userName = (String)attributes.get("userName");
272
273 if (userName != null) {
274 setUserName(userName);
275 }
276
277 Date createDate = (Date)attributes.get("createDate");
278
279 if (createDate != null) {
280 setCreateDate(createDate);
281 }
282
283 Date modifiedDate = (Date)attributes.get("modifiedDate");
284
285 if (modifiedDate != null) {
286 setModifiedDate(modifiedDate);
287 }
288
289 String title = (String)attributes.get("title");
290
291 if (title != null) {
292 setTitle(title);
293 }
294
295 String description = (String)attributes.get("description");
296
297 if (description != null) {
298 setDescription(description);
299 }
300
301 String location = (String)attributes.get("location");
302
303 if (location != null) {
304 setLocation(location);
305 }
306
307 Date startDate = (Date)attributes.get("startDate");
308
309 if (startDate != null) {
310 setStartDate(startDate);
311 }
312
313 Date endDate = (Date)attributes.get("endDate");
314
315 if (endDate != null) {
316 setEndDate(endDate);
317 }
318
319 Integer durationHour = (Integer)attributes.get("durationHour");
320
321 if (durationHour != null) {
322 setDurationHour(durationHour);
323 }
324
325 Integer durationMinute = (Integer)attributes.get("durationMinute");
326
327 if (durationMinute != null) {
328 setDurationMinute(durationMinute);
329 }
330
331 Boolean allDay = (Boolean)attributes.get("allDay");
332
333 if (allDay != null) {
334 setAllDay(allDay);
335 }
336
337 Boolean timeZoneSensitive = (Boolean)attributes.get("timeZoneSensitive");
338
339 if (timeZoneSensitive != null) {
340 setTimeZoneSensitive(timeZoneSensitive);
341 }
342
343 String type = (String)attributes.get("type");
344
345 if (type != null) {
346 setType(type);
347 }
348
349 Boolean repeating = (Boolean)attributes.get("repeating");
350
351 if (repeating != null) {
352 setRepeating(repeating);
353 }
354
355 String recurrence = (String)attributes.get("recurrence");
356
357 if (recurrence != null) {
358 setRecurrence(recurrence);
359 }
360
361 Integer remindBy = (Integer)attributes.get("remindBy");
362
363 if (remindBy != null) {
364 setRemindBy(remindBy);
365 }
366
367 Integer firstReminder = (Integer)attributes.get("firstReminder");
368
369 if (firstReminder != null) {
370 setFirstReminder(firstReminder);
371 }
372
373 Integer secondReminder = (Integer)attributes.get("secondReminder");
374
375 if (secondReminder != null) {
376 setSecondReminder(secondReminder);
377 }
378 }
379
380 @JSON
381 public String getUuid() {
382 if (_uuid == null) {
383 return StringPool.BLANK;
384 }
385 else {
386 return _uuid;
387 }
388 }
389
390 public void setUuid(String uuid) {
391 if (_originalUuid == null) {
392 _originalUuid = _uuid;
393 }
394
395 _uuid = uuid;
396 }
397
398 public String getOriginalUuid() {
399 return GetterUtil.getString(_originalUuid);
400 }
401
402 @JSON
403 public long getEventId() {
404 return _eventId;
405 }
406
407 public void setEventId(long eventId) {
408 _eventId = eventId;
409 }
410
411 @JSON
412 public long getGroupId() {
413 return _groupId;
414 }
415
416 public void setGroupId(long groupId) {
417 _columnBitmask |= GROUPID_COLUMN_BITMASK;
418
419 if (!_setOriginalGroupId) {
420 _setOriginalGroupId = true;
421
422 _originalGroupId = _groupId;
423 }
424
425 _groupId = groupId;
426 }
427
428 public long getOriginalGroupId() {
429 return _originalGroupId;
430 }
431
432 @JSON
433 public long getCompanyId() {
434 return _companyId;
435 }
436
437 public void setCompanyId(long companyId) {
438 _columnBitmask |= COMPANYID_COLUMN_BITMASK;
439
440 if (!_setOriginalCompanyId) {
441 _setOriginalCompanyId = true;
442
443 _originalCompanyId = _companyId;
444 }
445
446 _companyId = companyId;
447 }
448
449 public long getOriginalCompanyId() {
450 return _originalCompanyId;
451 }
452
453 @JSON
454 public long getUserId() {
455 return _userId;
456 }
457
458 public void setUserId(long userId) {
459 _userId = userId;
460 }
461
462 public String getUserUuid() throws SystemException {
463 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
464 }
465
466 public void setUserUuid(String userUuid) {
467 _userUuid = userUuid;
468 }
469
470 @JSON
471 public String getUserName() {
472 if (_userName == null) {
473 return StringPool.BLANK;
474 }
475 else {
476 return _userName;
477 }
478 }
479
480 public void setUserName(String userName) {
481 _userName = userName;
482 }
483
484 @JSON
485 public Date getCreateDate() {
486 return _createDate;
487 }
488
489 public void setCreateDate(Date createDate) {
490 _createDate = createDate;
491 }
492
493 @JSON
494 public Date getModifiedDate() {
495 return _modifiedDate;
496 }
497
498 public void setModifiedDate(Date modifiedDate) {
499 _modifiedDate = modifiedDate;
500 }
501
502 @JSON
503 public String getTitle() {
504 if (_title == null) {
505 return StringPool.BLANK;
506 }
507 else {
508 return _title;
509 }
510 }
511
512 public void setTitle(String title) {
513 _columnBitmask = -1L;
514
515 _title = title;
516 }
517
518 @JSON
519 public String getDescription() {
520 if (_description == null) {
521 return StringPool.BLANK;
522 }
523 else {
524 return _description;
525 }
526 }
527
528 public void setDescription(String description) {
529 _description = description;
530 }
531
532 @JSON
533 public String getLocation() {
534 if (_location == null) {
535 return StringPool.BLANK;
536 }
537 else {
538 return _location;
539 }
540 }
541
542 public void setLocation(String location) {
543 _location = location;
544 }
545
546 @JSON
547 public Date getStartDate() {
548 return _startDate;
549 }
550
551 public void setStartDate(Date startDate) {
552 _columnBitmask = -1L;
553
554 _startDate = startDate;
555 }
556
557 @JSON
558 public Date getEndDate() {
559 return _endDate;
560 }
561
562 public void setEndDate(Date endDate) {
563 _endDate = endDate;
564 }
565
566 @JSON
567 public int getDurationHour() {
568 return _durationHour;
569 }
570
571 public void setDurationHour(int durationHour) {
572 _durationHour = durationHour;
573 }
574
575 @JSON
576 public int getDurationMinute() {
577 return _durationMinute;
578 }
579
580 public void setDurationMinute(int durationMinute) {
581 _durationMinute = durationMinute;
582 }
583
584 @JSON
585 public boolean getAllDay() {
586 return _allDay;
587 }
588
589 public boolean isAllDay() {
590 return _allDay;
591 }
592
593 public void setAllDay(boolean allDay) {
594 _allDay = allDay;
595 }
596
597 @JSON
598 public boolean getTimeZoneSensitive() {
599 return _timeZoneSensitive;
600 }
601
602 public boolean isTimeZoneSensitive() {
603 return _timeZoneSensitive;
604 }
605
606 public void setTimeZoneSensitive(boolean timeZoneSensitive) {
607 _timeZoneSensitive = timeZoneSensitive;
608 }
609
610 @JSON
611 public String getType() {
612 if (_type == null) {
613 return StringPool.BLANK;
614 }
615 else {
616 return _type;
617 }
618 }
619
620 public void setType(String type) {
621 _columnBitmask |= TYPE_COLUMN_BITMASK;
622
623 if (_originalType == null) {
624 _originalType = _type;
625 }
626
627 _type = type;
628 }
629
630 public String getOriginalType() {
631 return GetterUtil.getString(_originalType);
632 }
633
634 @JSON
635 public boolean getRepeating() {
636 return _repeating;
637 }
638
639 public boolean isRepeating() {
640 return _repeating;
641 }
642
643 public void setRepeating(boolean repeating) {
644 _columnBitmask |= REPEATING_COLUMN_BITMASK;
645
646 if (!_setOriginalRepeating) {
647 _setOriginalRepeating = true;
648
649 _originalRepeating = _repeating;
650 }
651
652 _repeating = repeating;
653 }
654
655 public boolean getOriginalRepeating() {
656 return _originalRepeating;
657 }
658
659 @JSON
660 public String getRecurrence() {
661 if (_recurrence == null) {
662 return StringPool.BLANK;
663 }
664 else {
665 return _recurrence;
666 }
667 }
668
669 public void setRecurrence(String recurrence) {
670 _recurrence = recurrence;
671 }
672
673 @JSON
674 public int getRemindBy() {
675 return _remindBy;
676 }
677
678 public void setRemindBy(int remindBy) {
679 _columnBitmask |= REMINDBY_COLUMN_BITMASK;
680
681 if (!_setOriginalRemindBy) {
682 _setOriginalRemindBy = true;
683
684 _originalRemindBy = _remindBy;
685 }
686
687 _remindBy = remindBy;
688 }
689
690 public int getOriginalRemindBy() {
691 return _originalRemindBy;
692 }
693
694 @JSON
695 public int getFirstReminder() {
696 return _firstReminder;
697 }
698
699 public void setFirstReminder(int firstReminder) {
700 _firstReminder = firstReminder;
701 }
702
703 @JSON
704 public int getSecondReminder() {
705 return _secondReminder;
706 }
707
708 public void setSecondReminder(int secondReminder) {
709 _secondReminder = secondReminder;
710 }
711
712 public long getColumnBitmask() {
713 return _columnBitmask;
714 }
715
716 @Override
717 public ExpandoBridge getExpandoBridge() {
718 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
719 CalEvent.class.getName(), getPrimaryKey());
720 }
721
722 @Override
723 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
724 ExpandoBridge expandoBridge = getExpandoBridge();
725
726 expandoBridge.setAttributes(serviceContext);
727 }
728
729 @Override
730 public CalEvent toEscapedModel() {
731 if (_escapedModel == null) {
732 _escapedModel = (CalEvent)ProxyUtil.newProxyInstance(_classLoader,
733 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
734 }
735
736 return _escapedModel;
737 }
738
739 @Override
740 public Object clone() {
741 CalEventImpl calEventImpl = new CalEventImpl();
742
743 calEventImpl.setUuid(getUuid());
744 calEventImpl.setEventId(getEventId());
745 calEventImpl.setGroupId(getGroupId());
746 calEventImpl.setCompanyId(getCompanyId());
747 calEventImpl.setUserId(getUserId());
748 calEventImpl.setUserName(getUserName());
749 calEventImpl.setCreateDate(getCreateDate());
750 calEventImpl.setModifiedDate(getModifiedDate());
751 calEventImpl.setTitle(getTitle());
752 calEventImpl.setDescription(getDescription());
753 calEventImpl.setLocation(getLocation());
754 calEventImpl.setStartDate(getStartDate());
755 calEventImpl.setEndDate(getEndDate());
756 calEventImpl.setDurationHour(getDurationHour());
757 calEventImpl.setDurationMinute(getDurationMinute());
758 calEventImpl.setAllDay(getAllDay());
759 calEventImpl.setTimeZoneSensitive(getTimeZoneSensitive());
760 calEventImpl.setType(getType());
761 calEventImpl.setRepeating(getRepeating());
762 calEventImpl.setRecurrence(getRecurrence());
763 calEventImpl.setRemindBy(getRemindBy());
764 calEventImpl.setFirstReminder(getFirstReminder());
765 calEventImpl.setSecondReminder(getSecondReminder());
766
767 calEventImpl.resetOriginalValues();
768
769 return calEventImpl;
770 }
771
772 public int compareTo(CalEvent calEvent) {
773 int value = 0;
774
775 value = DateUtil.compareTo(getStartDate(), calEvent.getStartDate());
776
777 if (value != 0) {
778 return value;
779 }
780
781 value = getTitle().compareToIgnoreCase(calEvent.getTitle());
782
783 if (value != 0) {
784 return value;
785 }
786
787 return 0;
788 }
789
790 @Override
791 public boolean equals(Object obj) {
792 if (obj == null) {
793 return false;
794 }
795
796 CalEvent calEvent = null;
797
798 try {
799 calEvent = (CalEvent)obj;
800 }
801 catch (ClassCastException cce) {
802 return false;
803 }
804
805 long primaryKey = calEvent.getPrimaryKey();
806
807 if (getPrimaryKey() == primaryKey) {
808 return true;
809 }
810 else {
811 return false;
812 }
813 }
814
815 @Override
816 public int hashCode() {
817 return (int)getPrimaryKey();
818 }
819
820 @Override
821 public void resetOriginalValues() {
822 CalEventModelImpl calEventModelImpl = this;
823
824 calEventModelImpl._originalUuid = calEventModelImpl._uuid;
825
826 calEventModelImpl._originalGroupId = calEventModelImpl._groupId;
827
828 calEventModelImpl._setOriginalGroupId = false;
829
830 calEventModelImpl._originalCompanyId = calEventModelImpl._companyId;
831
832 calEventModelImpl._setOriginalCompanyId = false;
833
834 calEventModelImpl._originalType = calEventModelImpl._type;
835
836 calEventModelImpl._originalRepeating = calEventModelImpl._repeating;
837
838 calEventModelImpl._setOriginalRepeating = false;
839
840 calEventModelImpl._originalRemindBy = calEventModelImpl._remindBy;
841
842 calEventModelImpl._setOriginalRemindBy = false;
843
844 calEventModelImpl._columnBitmask = 0;
845 }
846
847 @Override
848 public CacheModel<CalEvent> toCacheModel() {
849 CalEventCacheModel calEventCacheModel = new CalEventCacheModel();
850
851 calEventCacheModel.uuid = getUuid();
852
853 String uuid = calEventCacheModel.uuid;
854
855 if ((uuid != null) && (uuid.length() == 0)) {
856 calEventCacheModel.uuid = null;
857 }
858
859 calEventCacheModel.eventId = getEventId();
860
861 calEventCacheModel.groupId = getGroupId();
862
863 calEventCacheModel.companyId = getCompanyId();
864
865 calEventCacheModel.userId = getUserId();
866
867 calEventCacheModel.userName = getUserName();
868
869 String userName = calEventCacheModel.userName;
870
871 if ((userName != null) && (userName.length() == 0)) {
872 calEventCacheModel.userName = null;
873 }
874
875 Date createDate = getCreateDate();
876
877 if (createDate != null) {
878 calEventCacheModel.createDate = createDate.getTime();
879 }
880 else {
881 calEventCacheModel.createDate = Long.MIN_VALUE;
882 }
883
884 Date modifiedDate = getModifiedDate();
885
886 if (modifiedDate != null) {
887 calEventCacheModel.modifiedDate = modifiedDate.getTime();
888 }
889 else {
890 calEventCacheModel.modifiedDate = Long.MIN_VALUE;
891 }
892
893 calEventCacheModel.title = getTitle();
894
895 String title = calEventCacheModel.title;
896
897 if ((title != null) && (title.length() == 0)) {
898 calEventCacheModel.title = null;
899 }
900
901 calEventCacheModel.description = getDescription();
902
903 String description = calEventCacheModel.description;
904
905 if ((description != null) && (description.length() == 0)) {
906 calEventCacheModel.description = null;
907 }
908
909 calEventCacheModel.location = getLocation();
910
911 String location = calEventCacheModel.location;
912
913 if ((location != null) && (location.length() == 0)) {
914 calEventCacheModel.location = null;
915 }
916
917 Date startDate = getStartDate();
918
919 if (startDate != null) {
920 calEventCacheModel.startDate = startDate.getTime();
921 }
922 else {
923 calEventCacheModel.startDate = Long.MIN_VALUE;
924 }
925
926 Date endDate = getEndDate();
927
928 if (endDate != null) {
929 calEventCacheModel.endDate = endDate.getTime();
930 }
931 else {
932 calEventCacheModel.endDate = Long.MIN_VALUE;
933 }
934
935 calEventCacheModel.durationHour = getDurationHour();
936
937 calEventCacheModel.durationMinute = getDurationMinute();
938
939 calEventCacheModel.allDay = getAllDay();
940
941 calEventCacheModel.timeZoneSensitive = getTimeZoneSensitive();
942
943 calEventCacheModel.type = getType();
944
945 String type = calEventCacheModel.type;
946
947 if ((type != null) && (type.length() == 0)) {
948 calEventCacheModel.type = null;
949 }
950
951 calEventCacheModel.repeating = getRepeating();
952
953 calEventCacheModel.recurrence = getRecurrence();
954
955 String recurrence = calEventCacheModel.recurrence;
956
957 if ((recurrence != null) && (recurrence.length() == 0)) {
958 calEventCacheModel.recurrence = null;
959 }
960
961 calEventCacheModel.remindBy = getRemindBy();
962
963 calEventCacheModel.firstReminder = getFirstReminder();
964
965 calEventCacheModel.secondReminder = getSecondReminder();
966
967 return calEventCacheModel;
968 }
969
970 @Override
971 public String toString() {
972 StringBundler sb = new StringBundler(47);
973
974 sb.append("{uuid=");
975 sb.append(getUuid());
976 sb.append(", eventId=");
977 sb.append(getEventId());
978 sb.append(", groupId=");
979 sb.append(getGroupId());
980 sb.append(", companyId=");
981 sb.append(getCompanyId());
982 sb.append(", userId=");
983 sb.append(getUserId());
984 sb.append(", userName=");
985 sb.append(getUserName());
986 sb.append(", createDate=");
987 sb.append(getCreateDate());
988 sb.append(", modifiedDate=");
989 sb.append(getModifiedDate());
990 sb.append(", title=");
991 sb.append(getTitle());
992 sb.append(", description=");
993 sb.append(getDescription());
994 sb.append(", location=");
995 sb.append(getLocation());
996 sb.append(", startDate=");
997 sb.append(getStartDate());
998 sb.append(", endDate=");
999 sb.append(getEndDate());
1000 sb.append(", durationHour=");
1001 sb.append(getDurationHour());
1002 sb.append(", durationMinute=");
1003 sb.append(getDurationMinute());
1004 sb.append(", allDay=");
1005 sb.append(getAllDay());
1006 sb.append(", timeZoneSensitive=");
1007 sb.append(getTimeZoneSensitive());
1008 sb.append(", type=");
1009 sb.append(getType());
1010 sb.append(", repeating=");
1011 sb.append(getRepeating());
1012 sb.append(", recurrence=");
1013 sb.append(getRecurrence());
1014 sb.append(", remindBy=");
1015 sb.append(getRemindBy());
1016 sb.append(", firstReminder=");
1017 sb.append(getFirstReminder());
1018 sb.append(", secondReminder=");
1019 sb.append(getSecondReminder());
1020 sb.append("}");
1021
1022 return sb.toString();
1023 }
1024
1025 public String toXmlString() {
1026 StringBundler sb = new StringBundler(73);
1027
1028 sb.append("<model><model-name>");
1029 sb.append("com.liferay.portlet.calendar.model.CalEvent");
1030 sb.append("</model-name>");
1031
1032 sb.append(
1033 "<column><column-name>uuid</column-name><column-value><![CDATA[");
1034 sb.append(getUuid());
1035 sb.append("]]></column-value></column>");
1036 sb.append(
1037 "<column><column-name>eventId</column-name><column-value><![CDATA[");
1038 sb.append(getEventId());
1039 sb.append("]]></column-value></column>");
1040 sb.append(
1041 "<column><column-name>groupId</column-name><column-value><![CDATA[");
1042 sb.append(getGroupId());
1043 sb.append("]]></column-value></column>");
1044 sb.append(
1045 "<column><column-name>companyId</column-name><column-value><![CDATA[");
1046 sb.append(getCompanyId());
1047 sb.append("]]></column-value></column>");
1048 sb.append(
1049 "<column><column-name>userId</column-name><column-value><![CDATA[");
1050 sb.append(getUserId());
1051 sb.append("]]></column-value></column>");
1052 sb.append(
1053 "<column><column-name>userName</column-name><column-value><![CDATA[");
1054 sb.append(getUserName());
1055 sb.append("]]></column-value></column>");
1056 sb.append(
1057 "<column><column-name>createDate</column-name><column-value><![CDATA[");
1058 sb.append(getCreateDate());
1059 sb.append("]]></column-value></column>");
1060 sb.append(
1061 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1062 sb.append(getModifiedDate());
1063 sb.append("]]></column-value></column>");
1064 sb.append(
1065 "<column><column-name>title</column-name><column-value><![CDATA[");
1066 sb.append(getTitle());
1067 sb.append("]]></column-value></column>");
1068 sb.append(
1069 "<column><column-name>description</column-name><column-value><![CDATA[");
1070 sb.append(getDescription());
1071 sb.append("]]></column-value></column>");
1072 sb.append(
1073 "<column><column-name>location</column-name><column-value><![CDATA[");
1074 sb.append(getLocation());
1075 sb.append("]]></column-value></column>");
1076 sb.append(
1077 "<column><column-name>startDate</column-name><column-value><![CDATA[");
1078 sb.append(getStartDate());
1079 sb.append("]]></column-value></column>");
1080 sb.append(
1081 "<column><column-name>endDate</column-name><column-value><![CDATA[");
1082 sb.append(getEndDate());
1083 sb.append("]]></column-value></column>");
1084 sb.append(
1085 "<column><column-name>durationHour</column-name><column-value><![CDATA[");
1086 sb.append(getDurationHour());
1087 sb.append("]]></column-value></column>");
1088 sb.append(
1089 "<column><column-name>durationMinute</column-name><column-value><![CDATA[");
1090 sb.append(getDurationMinute());
1091 sb.append("]]></column-value></column>");
1092 sb.append(
1093 "<column><column-name>allDay</column-name><column-value><![CDATA[");
1094 sb.append(getAllDay());
1095 sb.append("]]></column-value></column>");
1096 sb.append(
1097 "<column><column-name>timeZoneSensitive</column-name><column-value><![CDATA[");
1098 sb.append(getTimeZoneSensitive());
1099 sb.append("]]></column-value></column>");
1100 sb.append(
1101 "<column><column-name>type</column-name><column-value><![CDATA[");
1102 sb.append(getType());
1103 sb.append("]]></column-value></column>");
1104 sb.append(
1105 "<column><column-name>repeating</column-name><column-value><![CDATA[");
1106 sb.append(getRepeating());
1107 sb.append("]]></column-value></column>");
1108 sb.append(
1109 "<column><column-name>recurrence</column-name><column-value><![CDATA[");
1110 sb.append(getRecurrence());
1111 sb.append("]]></column-value></column>");
1112 sb.append(
1113 "<column><column-name>remindBy</column-name><column-value><![CDATA[");
1114 sb.append(getRemindBy());
1115 sb.append("]]></column-value></column>");
1116 sb.append(
1117 "<column><column-name>firstReminder</column-name><column-value><![CDATA[");
1118 sb.append(getFirstReminder());
1119 sb.append("]]></column-value></column>");
1120 sb.append(
1121 "<column><column-name>secondReminder</column-name><column-value><![CDATA[");
1122 sb.append(getSecondReminder());
1123 sb.append("]]></column-value></column>");
1124
1125 sb.append("</model>");
1126
1127 return sb.toString();
1128 }
1129
1130 private static ClassLoader _classLoader = CalEvent.class.getClassLoader();
1131 private static Class<?>[] _escapedModelInterfaces = new Class[] {
1132 CalEvent.class
1133 };
1134 private String _uuid;
1135 private String _originalUuid;
1136 private long _eventId;
1137 private long _groupId;
1138 private long _originalGroupId;
1139 private boolean _setOriginalGroupId;
1140 private long _companyId;
1141 private long _originalCompanyId;
1142 private boolean _setOriginalCompanyId;
1143 private long _userId;
1144 private String _userUuid;
1145 private String _userName;
1146 private Date _createDate;
1147 private Date _modifiedDate;
1148 private String _title;
1149 private String _description;
1150 private String _location;
1151 private Date _startDate;
1152 private Date _endDate;
1153 private int _durationHour;
1154 private int _durationMinute;
1155 private boolean _allDay;
1156 private boolean _timeZoneSensitive;
1157 private String _type;
1158 private String _originalType;
1159 private boolean _repeating;
1160 private boolean _originalRepeating;
1161 private boolean _setOriginalRepeating;
1162 private String _recurrence;
1163 private int _remindBy;
1164 private int _originalRemindBy;
1165 private boolean _setOriginalRemindBy;
1166 private int _firstReminder;
1167 private int _secondReminder;
1168 private long _columnBitmask;
1169 private CalEvent _escapedModel;
1170 }