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 new Long(_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().toLowerCase()
782 .compareTo(calEvent.getTitle().toLowerCase());
783
784 if (value != 0) {
785 return value;
786 }
787
788 return 0;
789 }
790
791 @Override
792 public boolean equals(Object obj) {
793 if (obj == null) {
794 return false;
795 }
796
797 CalEvent calEvent = null;
798
799 try {
800 calEvent = (CalEvent)obj;
801 }
802 catch (ClassCastException cce) {
803 return false;
804 }
805
806 long primaryKey = calEvent.getPrimaryKey();
807
808 if (getPrimaryKey() == primaryKey) {
809 return true;
810 }
811 else {
812 return false;
813 }
814 }
815
816 @Override
817 public int hashCode() {
818 return (int)getPrimaryKey();
819 }
820
821 @Override
822 public void resetOriginalValues() {
823 CalEventModelImpl calEventModelImpl = this;
824
825 calEventModelImpl._originalUuid = calEventModelImpl._uuid;
826
827 calEventModelImpl._originalGroupId = calEventModelImpl._groupId;
828
829 calEventModelImpl._setOriginalGroupId = false;
830
831 calEventModelImpl._originalCompanyId = calEventModelImpl._companyId;
832
833 calEventModelImpl._setOriginalCompanyId = false;
834
835 calEventModelImpl._originalType = calEventModelImpl._type;
836
837 calEventModelImpl._originalRepeating = calEventModelImpl._repeating;
838
839 calEventModelImpl._setOriginalRepeating = false;
840
841 calEventModelImpl._originalRemindBy = calEventModelImpl._remindBy;
842
843 calEventModelImpl._setOriginalRemindBy = false;
844
845 calEventModelImpl._columnBitmask = 0;
846 }
847
848 @Override
849 public CacheModel<CalEvent> toCacheModel() {
850 CalEventCacheModel calEventCacheModel = new CalEventCacheModel();
851
852 calEventCacheModel.uuid = getUuid();
853
854 String uuid = calEventCacheModel.uuid;
855
856 if ((uuid != null) && (uuid.length() == 0)) {
857 calEventCacheModel.uuid = null;
858 }
859
860 calEventCacheModel.eventId = getEventId();
861
862 calEventCacheModel.groupId = getGroupId();
863
864 calEventCacheModel.companyId = getCompanyId();
865
866 calEventCacheModel.userId = getUserId();
867
868 calEventCacheModel.userName = getUserName();
869
870 String userName = calEventCacheModel.userName;
871
872 if ((userName != null) && (userName.length() == 0)) {
873 calEventCacheModel.userName = null;
874 }
875
876 Date createDate = getCreateDate();
877
878 if (createDate != null) {
879 calEventCacheModel.createDate = createDate.getTime();
880 }
881 else {
882 calEventCacheModel.createDate = Long.MIN_VALUE;
883 }
884
885 Date modifiedDate = getModifiedDate();
886
887 if (modifiedDate != null) {
888 calEventCacheModel.modifiedDate = modifiedDate.getTime();
889 }
890 else {
891 calEventCacheModel.modifiedDate = Long.MIN_VALUE;
892 }
893
894 calEventCacheModel.title = getTitle();
895
896 String title = calEventCacheModel.title;
897
898 if ((title != null) && (title.length() == 0)) {
899 calEventCacheModel.title = null;
900 }
901
902 calEventCacheModel.description = getDescription();
903
904 String description = calEventCacheModel.description;
905
906 if ((description != null) && (description.length() == 0)) {
907 calEventCacheModel.description = null;
908 }
909
910 calEventCacheModel.location = getLocation();
911
912 String location = calEventCacheModel.location;
913
914 if ((location != null) && (location.length() == 0)) {
915 calEventCacheModel.location = null;
916 }
917
918 Date startDate = getStartDate();
919
920 if (startDate != null) {
921 calEventCacheModel.startDate = startDate.getTime();
922 }
923 else {
924 calEventCacheModel.startDate = Long.MIN_VALUE;
925 }
926
927 Date endDate = getEndDate();
928
929 if (endDate != null) {
930 calEventCacheModel.endDate = endDate.getTime();
931 }
932 else {
933 calEventCacheModel.endDate = Long.MIN_VALUE;
934 }
935
936 calEventCacheModel.durationHour = getDurationHour();
937
938 calEventCacheModel.durationMinute = getDurationMinute();
939
940 calEventCacheModel.allDay = getAllDay();
941
942 calEventCacheModel.timeZoneSensitive = getTimeZoneSensitive();
943
944 calEventCacheModel.type = getType();
945
946 String type = calEventCacheModel.type;
947
948 if ((type != null) && (type.length() == 0)) {
949 calEventCacheModel.type = null;
950 }
951
952 calEventCacheModel.repeating = getRepeating();
953
954 calEventCacheModel.recurrence = getRecurrence();
955
956 String recurrence = calEventCacheModel.recurrence;
957
958 if ((recurrence != null) && (recurrence.length() == 0)) {
959 calEventCacheModel.recurrence = null;
960 }
961
962 calEventCacheModel.remindBy = getRemindBy();
963
964 calEventCacheModel.firstReminder = getFirstReminder();
965
966 calEventCacheModel.secondReminder = getSecondReminder();
967
968 return calEventCacheModel;
969 }
970
971 @Override
972 public String toString() {
973 StringBundler sb = new StringBundler(47);
974
975 sb.append("{uuid=");
976 sb.append(getUuid());
977 sb.append(", eventId=");
978 sb.append(getEventId());
979 sb.append(", groupId=");
980 sb.append(getGroupId());
981 sb.append(", companyId=");
982 sb.append(getCompanyId());
983 sb.append(", userId=");
984 sb.append(getUserId());
985 sb.append(", userName=");
986 sb.append(getUserName());
987 sb.append(", createDate=");
988 sb.append(getCreateDate());
989 sb.append(", modifiedDate=");
990 sb.append(getModifiedDate());
991 sb.append(", title=");
992 sb.append(getTitle());
993 sb.append(", description=");
994 sb.append(getDescription());
995 sb.append(", location=");
996 sb.append(getLocation());
997 sb.append(", startDate=");
998 sb.append(getStartDate());
999 sb.append(", endDate=");
1000 sb.append(getEndDate());
1001 sb.append(", durationHour=");
1002 sb.append(getDurationHour());
1003 sb.append(", durationMinute=");
1004 sb.append(getDurationMinute());
1005 sb.append(", allDay=");
1006 sb.append(getAllDay());
1007 sb.append(", timeZoneSensitive=");
1008 sb.append(getTimeZoneSensitive());
1009 sb.append(", type=");
1010 sb.append(getType());
1011 sb.append(", repeating=");
1012 sb.append(getRepeating());
1013 sb.append(", recurrence=");
1014 sb.append(getRecurrence());
1015 sb.append(", remindBy=");
1016 sb.append(getRemindBy());
1017 sb.append(", firstReminder=");
1018 sb.append(getFirstReminder());
1019 sb.append(", secondReminder=");
1020 sb.append(getSecondReminder());
1021 sb.append("}");
1022
1023 return sb.toString();
1024 }
1025
1026 public String toXmlString() {
1027 StringBundler sb = new StringBundler(73);
1028
1029 sb.append("<model><model-name>");
1030 sb.append("com.liferay.portlet.calendar.model.CalEvent");
1031 sb.append("</model-name>");
1032
1033 sb.append(
1034 "<column><column-name>uuid</column-name><column-value><![CDATA[");
1035 sb.append(getUuid());
1036 sb.append("]]></column-value></column>");
1037 sb.append(
1038 "<column><column-name>eventId</column-name><column-value><![CDATA[");
1039 sb.append(getEventId());
1040 sb.append("]]></column-value></column>");
1041 sb.append(
1042 "<column><column-name>groupId</column-name><column-value><![CDATA[");
1043 sb.append(getGroupId());
1044 sb.append("]]></column-value></column>");
1045 sb.append(
1046 "<column><column-name>companyId</column-name><column-value><![CDATA[");
1047 sb.append(getCompanyId());
1048 sb.append("]]></column-value></column>");
1049 sb.append(
1050 "<column><column-name>userId</column-name><column-value><![CDATA[");
1051 sb.append(getUserId());
1052 sb.append("]]></column-value></column>");
1053 sb.append(
1054 "<column><column-name>userName</column-name><column-value><![CDATA[");
1055 sb.append(getUserName());
1056 sb.append("]]></column-value></column>");
1057 sb.append(
1058 "<column><column-name>createDate</column-name><column-value><![CDATA[");
1059 sb.append(getCreateDate());
1060 sb.append("]]></column-value></column>");
1061 sb.append(
1062 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1063 sb.append(getModifiedDate());
1064 sb.append("]]></column-value></column>");
1065 sb.append(
1066 "<column><column-name>title</column-name><column-value><![CDATA[");
1067 sb.append(getTitle());
1068 sb.append("]]></column-value></column>");
1069 sb.append(
1070 "<column><column-name>description</column-name><column-value><![CDATA[");
1071 sb.append(getDescription());
1072 sb.append("]]></column-value></column>");
1073 sb.append(
1074 "<column><column-name>location</column-name><column-value><![CDATA[");
1075 sb.append(getLocation());
1076 sb.append("]]></column-value></column>");
1077 sb.append(
1078 "<column><column-name>startDate</column-name><column-value><![CDATA[");
1079 sb.append(getStartDate());
1080 sb.append("]]></column-value></column>");
1081 sb.append(
1082 "<column><column-name>endDate</column-name><column-value><![CDATA[");
1083 sb.append(getEndDate());
1084 sb.append("]]></column-value></column>");
1085 sb.append(
1086 "<column><column-name>durationHour</column-name><column-value><![CDATA[");
1087 sb.append(getDurationHour());
1088 sb.append("]]></column-value></column>");
1089 sb.append(
1090 "<column><column-name>durationMinute</column-name><column-value><![CDATA[");
1091 sb.append(getDurationMinute());
1092 sb.append("]]></column-value></column>");
1093 sb.append(
1094 "<column><column-name>allDay</column-name><column-value><![CDATA[");
1095 sb.append(getAllDay());
1096 sb.append("]]></column-value></column>");
1097 sb.append(
1098 "<column><column-name>timeZoneSensitive</column-name><column-value><![CDATA[");
1099 sb.append(getTimeZoneSensitive());
1100 sb.append("]]></column-value></column>");
1101 sb.append(
1102 "<column><column-name>type</column-name><column-value><![CDATA[");
1103 sb.append(getType());
1104 sb.append("]]></column-value></column>");
1105 sb.append(
1106 "<column><column-name>repeating</column-name><column-value><![CDATA[");
1107 sb.append(getRepeating());
1108 sb.append("]]></column-value></column>");
1109 sb.append(
1110 "<column><column-name>recurrence</column-name><column-value><![CDATA[");
1111 sb.append(getRecurrence());
1112 sb.append("]]></column-value></column>");
1113 sb.append(
1114 "<column><column-name>remindBy</column-name><column-value><![CDATA[");
1115 sb.append(getRemindBy());
1116 sb.append("]]></column-value></column>");
1117 sb.append(
1118 "<column><column-name>firstReminder</column-name><column-value><![CDATA[");
1119 sb.append(getFirstReminder());
1120 sb.append("]]></column-value></column>");
1121 sb.append(
1122 "<column><column-name>secondReminder</column-name><column-value><![CDATA[");
1123 sb.append(getSecondReminder());
1124 sb.append("]]></column-value></column>");
1125
1126 sb.append("</model>");
1127
1128 return sb.toString();
1129 }
1130
1131 private static ClassLoader _classLoader = CalEvent.class.getClassLoader();
1132 private static Class<?>[] _escapedModelInterfaces = new Class[] {
1133 CalEvent.class
1134 };
1135 private String _uuid;
1136 private String _originalUuid;
1137 private long _eventId;
1138 private long _groupId;
1139 private long _originalGroupId;
1140 private boolean _setOriginalGroupId;
1141 private long _companyId;
1142 private long _originalCompanyId;
1143 private boolean _setOriginalCompanyId;
1144 private long _userId;
1145 private String _userUuid;
1146 private String _userName;
1147 private Date _createDate;
1148 private Date _modifiedDate;
1149 private String _title;
1150 private String _description;
1151 private String _location;
1152 private Date _startDate;
1153 private Date _endDate;
1154 private int _durationHour;
1155 private int _durationMinute;
1156 private boolean _allDay;
1157 private boolean _timeZoneSensitive;
1158 private String _type;
1159 private String _originalType;
1160 private boolean _repeating;
1161 private boolean _originalRepeating;
1162 private boolean _setOriginalRepeating;
1163 private String _recurrence;
1164 private int _remindBy;
1165 private int _originalRemindBy;
1166 private boolean _setOriginalRemindBy;
1167 private int _firstReminder;
1168 private int _secondReminder;
1169 private long _columnBitmask;
1170 private CalEvent _escapedModel;
1171 }