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