001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
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.lar.StagedModelType;
022    import com.liferay.portal.kernel.util.DateUtil;
023    import com.liferay.portal.kernel.util.GetterUtil;
024    import com.liferay.portal.kernel.util.ProxyUtil;
025    import com.liferay.portal.kernel.util.StringBundler;
026    import com.liferay.portal.kernel.util.StringPool;
027    import com.liferay.portal.model.CacheModel;
028    import com.liferay.portal.model.User;
029    import com.liferay.portal.model.impl.BaseModelImpl;
030    import com.liferay.portal.service.ServiceContext;
031    import com.liferay.portal.service.UserLocalServiceUtil;
032    import com.liferay.portal.util.PortalUtil;
033    
034    import com.liferay.portlet.calendar.model.CalEvent;
035    import com.liferay.portlet.calendar.model.CalEventModel;
036    import com.liferay.portlet.expando.model.ExpandoBridge;
037    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
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    /**
048     * The base model implementation for the CalEvent service. Represents a row in the "CalEvent" database table, with each column mapped to a property of this class.
049     *
050     * <p>
051     * This implementation and its corresponding interface {@link com.liferay.portlet.calendar.model.CalEventModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link CalEventImpl}.
052     * </p>
053     *
054     * @author Brian Wing Shun Chan
055     * @see CalEventImpl
056     * @see com.liferay.portlet.calendar.model.CalEvent
057     * @see com.liferay.portlet.calendar.model.CalEventModel
058     * @generated
059     */
060    @ProviderType
061    public class CalEventModelImpl extends BaseModelImpl<CalEvent>
062            implements CalEventModel {
063            /*
064             * NOTE FOR DEVELOPERS:
065             *
066             * Never modify or reference this class directly. All methods that expect a cal event model instance should use the {@link com.liferay.portlet.calendar.model.CalEvent} interface instead.
067             */
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            @Override
463            public void setModifiedDate(Date modifiedDate) {
464                    _modifiedDate = modifiedDate;
465            }
466    
467            @Override
468            public String getTitle() {
469                    if (_title == null) {
470                            return StringPool.BLANK;
471                    }
472                    else {
473                            return _title;
474                    }
475            }
476    
477            @Override
478            public void setTitle(String title) {
479                    _columnBitmask = -1L;
480    
481                    _title = title;
482            }
483    
484            @Override
485            public String getDescription() {
486                    if (_description == null) {
487                            return StringPool.BLANK;
488                    }
489                    else {
490                            return _description;
491                    }
492            }
493    
494            @Override
495            public void setDescription(String description) {
496                    _description = description;
497            }
498    
499            @Override
500            public String getLocation() {
501                    if (_location == null) {
502                            return StringPool.BLANK;
503                    }
504                    else {
505                            return _location;
506                    }
507            }
508    
509            @Override
510            public void setLocation(String location) {
511                    _location = location;
512            }
513    
514            @Override
515            public Date getStartDate() {
516                    return _startDate;
517            }
518    
519            @Override
520            public void setStartDate(Date startDate) {
521                    _columnBitmask = -1L;
522    
523                    _startDate = startDate;
524            }
525    
526            @Override
527            public Date getEndDate() {
528                    return _endDate;
529            }
530    
531            @Override
532            public void setEndDate(Date endDate) {
533                    _endDate = endDate;
534            }
535    
536            @Override
537            public int getDurationHour() {
538                    return _durationHour;
539            }
540    
541            @Override
542            public void setDurationHour(int durationHour) {
543                    _durationHour = durationHour;
544            }
545    
546            @Override
547            public int getDurationMinute() {
548                    return _durationMinute;
549            }
550    
551            @Override
552            public void setDurationMinute(int durationMinute) {
553                    _durationMinute = durationMinute;
554            }
555    
556            @Override
557            public boolean getAllDay() {
558                    return _allDay;
559            }
560    
561            @Override
562            public boolean isAllDay() {
563                    return _allDay;
564            }
565    
566            @Override
567            public void setAllDay(boolean allDay) {
568                    _allDay = allDay;
569            }
570    
571            @Override
572            public boolean getTimeZoneSensitive() {
573                    return _timeZoneSensitive;
574            }
575    
576            @Override
577            public boolean isTimeZoneSensitive() {
578                    return _timeZoneSensitive;
579            }
580    
581            @Override
582            public void setTimeZoneSensitive(boolean timeZoneSensitive) {
583                    _timeZoneSensitive = timeZoneSensitive;
584            }
585    
586            @Override
587            public String getType() {
588                    if (_type == null) {
589                            return StringPool.BLANK;
590                    }
591                    else {
592                            return _type;
593                    }
594            }
595    
596            @Override
597            public void setType(String type) {
598                    _columnBitmask |= TYPE_COLUMN_BITMASK;
599    
600                    if (_originalType == null) {
601                            _originalType = _type;
602                    }
603    
604                    _type = type;
605            }
606    
607            public String getOriginalType() {
608                    return GetterUtil.getString(_originalType);
609            }
610    
611            @Override
612            public boolean getRepeating() {
613                    return _repeating;
614            }
615    
616            @Override
617            public boolean isRepeating() {
618                    return _repeating;
619            }
620    
621            @Override
622            public void setRepeating(boolean repeating) {
623                    _columnBitmask |= REPEATING_COLUMN_BITMASK;
624    
625                    if (!_setOriginalRepeating) {
626                            _setOriginalRepeating = true;
627    
628                            _originalRepeating = _repeating;
629                    }
630    
631                    _repeating = repeating;
632            }
633    
634            public boolean getOriginalRepeating() {
635                    return _originalRepeating;
636            }
637    
638            @Override
639            public String getRecurrence() {
640                    if (_recurrence == null) {
641                            return StringPool.BLANK;
642                    }
643                    else {
644                            return _recurrence;
645                    }
646            }
647    
648            @Override
649            public void setRecurrence(String recurrence) {
650                    _recurrence = recurrence;
651            }
652    
653            @Override
654            public int getRemindBy() {
655                    return _remindBy;
656            }
657    
658            @Override
659            public void setRemindBy(int remindBy) {
660                    _columnBitmask |= REMINDBY_COLUMN_BITMASK;
661    
662                    if (!_setOriginalRemindBy) {
663                            _setOriginalRemindBy = true;
664    
665                            _originalRemindBy = _remindBy;
666                    }
667    
668                    _remindBy = remindBy;
669            }
670    
671            public int getOriginalRemindBy() {
672                    return _originalRemindBy;
673            }
674    
675            @Override
676            public int getFirstReminder() {
677                    return _firstReminder;
678            }
679    
680            @Override
681            public void setFirstReminder(int firstReminder) {
682                    _firstReminder = firstReminder;
683            }
684    
685            @Override
686            public int getSecondReminder() {
687                    return _secondReminder;
688            }
689    
690            @Override
691            public void setSecondReminder(int secondReminder) {
692                    _secondReminder = secondReminder;
693            }
694    
695            @Override
696            public StagedModelType getStagedModelType() {
697                    return new StagedModelType(PortalUtil.getClassNameId(
698                                    CalEvent.class.getName()));
699            }
700    
701            public long getColumnBitmask() {
702                    return _columnBitmask;
703            }
704    
705            @Override
706            public ExpandoBridge getExpandoBridge() {
707                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
708                            CalEvent.class.getName(), getPrimaryKey());
709            }
710    
711            @Override
712            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
713                    ExpandoBridge expandoBridge = getExpandoBridge();
714    
715                    expandoBridge.setAttributes(serviceContext);
716            }
717    
718            @Override
719            public CalEvent toEscapedModel() {
720                    if (_escapedModel == null) {
721                            _escapedModel = (CalEvent)ProxyUtil.newProxyInstance(_classLoader,
722                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
723                    }
724    
725                    return _escapedModel;
726            }
727    
728            @Override
729            public Object clone() {
730                    CalEventImpl calEventImpl = new CalEventImpl();
731    
732                    calEventImpl.setUuid(getUuid());
733                    calEventImpl.setEventId(getEventId());
734                    calEventImpl.setGroupId(getGroupId());
735                    calEventImpl.setCompanyId(getCompanyId());
736                    calEventImpl.setUserId(getUserId());
737                    calEventImpl.setUserName(getUserName());
738                    calEventImpl.setCreateDate(getCreateDate());
739                    calEventImpl.setModifiedDate(getModifiedDate());
740                    calEventImpl.setTitle(getTitle());
741                    calEventImpl.setDescription(getDescription());
742                    calEventImpl.setLocation(getLocation());
743                    calEventImpl.setStartDate(getStartDate());
744                    calEventImpl.setEndDate(getEndDate());
745                    calEventImpl.setDurationHour(getDurationHour());
746                    calEventImpl.setDurationMinute(getDurationMinute());
747                    calEventImpl.setAllDay(getAllDay());
748                    calEventImpl.setTimeZoneSensitive(getTimeZoneSensitive());
749                    calEventImpl.setType(getType());
750                    calEventImpl.setRepeating(getRepeating());
751                    calEventImpl.setRecurrence(getRecurrence());
752                    calEventImpl.setRemindBy(getRemindBy());
753                    calEventImpl.setFirstReminder(getFirstReminder());
754                    calEventImpl.setSecondReminder(getSecondReminder());
755    
756                    calEventImpl.resetOriginalValues();
757    
758                    return calEventImpl;
759            }
760    
761            @Override
762            public int compareTo(CalEvent calEvent) {
763                    int value = 0;
764    
765                    value = DateUtil.compareTo(getStartDate(), calEvent.getStartDate());
766    
767                    if (value != 0) {
768                            return value;
769                    }
770    
771                    value = getTitle().compareToIgnoreCase(calEvent.getTitle());
772    
773                    if (value != 0) {
774                            return value;
775                    }
776    
777                    return 0;
778            }
779    
780            @Override
781            public boolean equals(Object obj) {
782                    if (this == obj) {
783                            return true;
784                    }
785    
786                    if (!(obj instanceof CalEvent)) {
787                            return false;
788                    }
789    
790                    CalEvent calEvent = (CalEvent)obj;
791    
792                    long primaryKey = calEvent.getPrimaryKey();
793    
794                    if (getPrimaryKey() == primaryKey) {
795                            return true;
796                    }
797                    else {
798                            return false;
799                    }
800            }
801    
802            @Override
803            public int hashCode() {
804                    return (int)getPrimaryKey();
805            }
806    
807            @Override
808            public boolean isEntityCacheEnabled() {
809                    return ENTITY_CACHE_ENABLED;
810            }
811    
812            @Override
813            public boolean isFinderCacheEnabled() {
814                    return FINDER_CACHE_ENABLED;
815            }
816    
817            @Override
818            public void resetOriginalValues() {
819                    CalEventModelImpl calEventModelImpl = this;
820    
821                    calEventModelImpl._originalUuid = calEventModelImpl._uuid;
822    
823                    calEventModelImpl._originalGroupId = calEventModelImpl._groupId;
824    
825                    calEventModelImpl._setOriginalGroupId = false;
826    
827                    calEventModelImpl._originalCompanyId = calEventModelImpl._companyId;
828    
829                    calEventModelImpl._setOriginalCompanyId = false;
830    
831                    calEventModelImpl._originalType = calEventModelImpl._type;
832    
833                    calEventModelImpl._originalRepeating = calEventModelImpl._repeating;
834    
835                    calEventModelImpl._setOriginalRepeating = false;
836    
837                    calEventModelImpl._originalRemindBy = calEventModelImpl._remindBy;
838    
839                    calEventModelImpl._setOriginalRemindBy = false;
840    
841                    calEventModelImpl._columnBitmask = 0;
842            }
843    
844            @Override
845            public CacheModel<CalEvent> toCacheModel() {
846                    CalEventCacheModel calEventCacheModel = new CalEventCacheModel();
847    
848                    calEventCacheModel.uuid = getUuid();
849    
850                    String uuid = calEventCacheModel.uuid;
851    
852                    if ((uuid != null) && (uuid.length() == 0)) {
853                            calEventCacheModel.uuid = null;
854                    }
855    
856                    calEventCacheModel.eventId = getEventId();
857    
858                    calEventCacheModel.groupId = getGroupId();
859    
860                    calEventCacheModel.companyId = getCompanyId();
861    
862                    calEventCacheModel.userId = getUserId();
863    
864                    calEventCacheModel.userName = getUserName();
865    
866                    String userName = calEventCacheModel.userName;
867    
868                    if ((userName != null) && (userName.length() == 0)) {
869                            calEventCacheModel.userName = null;
870                    }
871    
872                    Date createDate = getCreateDate();
873    
874                    if (createDate != null) {
875                            calEventCacheModel.createDate = createDate.getTime();
876                    }
877                    else {
878                            calEventCacheModel.createDate = Long.MIN_VALUE;
879                    }
880    
881                    Date modifiedDate = getModifiedDate();
882    
883                    if (modifiedDate != null) {
884                            calEventCacheModel.modifiedDate = modifiedDate.getTime();
885                    }
886                    else {
887                            calEventCacheModel.modifiedDate = Long.MIN_VALUE;
888                    }
889    
890                    calEventCacheModel.title = getTitle();
891    
892                    String title = calEventCacheModel.title;
893    
894                    if ((title != null) && (title.length() == 0)) {
895                            calEventCacheModel.title = null;
896                    }
897    
898                    calEventCacheModel.description = getDescription();
899    
900                    String description = calEventCacheModel.description;
901    
902                    if ((description != null) && (description.length() == 0)) {
903                            calEventCacheModel.description = null;
904                    }
905    
906                    calEventCacheModel.location = getLocation();
907    
908                    String location = calEventCacheModel.location;
909    
910                    if ((location != null) && (location.length() == 0)) {
911                            calEventCacheModel.location = null;
912                    }
913    
914                    Date startDate = getStartDate();
915    
916                    if (startDate != null) {
917                            calEventCacheModel.startDate = startDate.getTime();
918                    }
919                    else {
920                            calEventCacheModel.startDate = Long.MIN_VALUE;
921                    }
922    
923                    Date endDate = getEndDate();
924    
925                    if (endDate != null) {
926                            calEventCacheModel.endDate = endDate.getTime();
927                    }
928                    else {
929                            calEventCacheModel.endDate = Long.MIN_VALUE;
930                    }
931    
932                    calEventCacheModel.durationHour = getDurationHour();
933    
934                    calEventCacheModel.durationMinute = getDurationMinute();
935    
936                    calEventCacheModel.allDay = getAllDay();
937    
938                    calEventCacheModel.timeZoneSensitive = getTimeZoneSensitive();
939    
940                    calEventCacheModel.type = getType();
941    
942                    String type = calEventCacheModel.type;
943    
944                    if ((type != null) && (type.length() == 0)) {
945                            calEventCacheModel.type = null;
946                    }
947    
948                    calEventCacheModel.repeating = getRepeating();
949    
950                    calEventCacheModel.recurrence = getRecurrence();
951    
952                    String recurrence = calEventCacheModel.recurrence;
953    
954                    if ((recurrence != null) && (recurrence.length() == 0)) {
955                            calEventCacheModel.recurrence = null;
956                    }
957    
958                    calEventCacheModel.remindBy = getRemindBy();
959    
960                    calEventCacheModel.firstReminder = getFirstReminder();
961    
962                    calEventCacheModel.secondReminder = getSecondReminder();
963    
964                    return calEventCacheModel;
965            }
966    
967            @Override
968            public String toString() {
969                    StringBundler sb = new StringBundler(47);
970    
971                    sb.append("{uuid=");
972                    sb.append(getUuid());
973                    sb.append(", eventId=");
974                    sb.append(getEventId());
975                    sb.append(", groupId=");
976                    sb.append(getGroupId());
977                    sb.append(", companyId=");
978                    sb.append(getCompanyId());
979                    sb.append(", userId=");
980                    sb.append(getUserId());
981                    sb.append(", userName=");
982                    sb.append(getUserName());
983                    sb.append(", createDate=");
984                    sb.append(getCreateDate());
985                    sb.append(", modifiedDate=");
986                    sb.append(getModifiedDate());
987                    sb.append(", title=");
988                    sb.append(getTitle());
989                    sb.append(", description=");
990                    sb.append(getDescription());
991                    sb.append(", location=");
992                    sb.append(getLocation());
993                    sb.append(", startDate=");
994                    sb.append(getStartDate());
995                    sb.append(", endDate=");
996                    sb.append(getEndDate());
997                    sb.append(", durationHour=");
998                    sb.append(getDurationHour());
999                    sb.append(", durationMinute=");
1000                    sb.append(getDurationMinute());
1001                    sb.append(", allDay=");
1002                    sb.append(getAllDay());
1003                    sb.append(", timeZoneSensitive=");
1004                    sb.append(getTimeZoneSensitive());
1005                    sb.append(", type=");
1006                    sb.append(getType());
1007                    sb.append(", repeating=");
1008                    sb.append(getRepeating());
1009                    sb.append(", recurrence=");
1010                    sb.append(getRecurrence());
1011                    sb.append(", remindBy=");
1012                    sb.append(getRemindBy());
1013                    sb.append(", firstReminder=");
1014                    sb.append(getFirstReminder());
1015                    sb.append(", secondReminder=");
1016                    sb.append(getSecondReminder());
1017                    sb.append("}");
1018    
1019                    return sb.toString();
1020            }
1021    
1022            @Override
1023            public String toXmlString() {
1024                    StringBundler sb = new StringBundler(73);
1025    
1026                    sb.append("<model><model-name>");
1027                    sb.append("com.liferay.portlet.calendar.model.CalEvent");
1028                    sb.append("</model-name>");
1029    
1030                    sb.append(
1031                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
1032                    sb.append(getUuid());
1033                    sb.append("]]></column-value></column>");
1034                    sb.append(
1035                            "<column><column-name>eventId</column-name><column-value><![CDATA[");
1036                    sb.append(getEventId());
1037                    sb.append("]]></column-value></column>");
1038                    sb.append(
1039                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
1040                    sb.append(getGroupId());
1041                    sb.append("]]></column-value></column>");
1042                    sb.append(
1043                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
1044                    sb.append(getCompanyId());
1045                    sb.append("]]></column-value></column>");
1046                    sb.append(
1047                            "<column><column-name>userId</column-name><column-value><![CDATA[");
1048                    sb.append(getUserId());
1049                    sb.append("]]></column-value></column>");
1050                    sb.append(
1051                            "<column><column-name>userName</column-name><column-value><![CDATA[");
1052                    sb.append(getUserName());
1053                    sb.append("]]></column-value></column>");
1054                    sb.append(
1055                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
1056                    sb.append(getCreateDate());
1057                    sb.append("]]></column-value></column>");
1058                    sb.append(
1059                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1060                    sb.append(getModifiedDate());
1061                    sb.append("]]></column-value></column>");
1062                    sb.append(
1063                            "<column><column-name>title</column-name><column-value><![CDATA[");
1064                    sb.append(getTitle());
1065                    sb.append("]]></column-value></column>");
1066                    sb.append(
1067                            "<column><column-name>description</column-name><column-value><![CDATA[");
1068                    sb.append(getDescription());
1069                    sb.append("]]></column-value></column>");
1070                    sb.append(
1071                            "<column><column-name>location</column-name><column-value><![CDATA[");
1072                    sb.append(getLocation());
1073                    sb.append("]]></column-value></column>");
1074                    sb.append(
1075                            "<column><column-name>startDate</column-name><column-value><![CDATA[");
1076                    sb.append(getStartDate());
1077                    sb.append("]]></column-value></column>");
1078                    sb.append(
1079                            "<column><column-name>endDate</column-name><column-value><![CDATA[");
1080                    sb.append(getEndDate());
1081                    sb.append("]]></column-value></column>");
1082                    sb.append(
1083                            "<column><column-name>durationHour</column-name><column-value><![CDATA[");
1084                    sb.append(getDurationHour());
1085                    sb.append("]]></column-value></column>");
1086                    sb.append(
1087                            "<column><column-name>durationMinute</column-name><column-value><![CDATA[");
1088                    sb.append(getDurationMinute());
1089                    sb.append("]]></column-value></column>");
1090                    sb.append(
1091                            "<column><column-name>allDay</column-name><column-value><![CDATA[");
1092                    sb.append(getAllDay());
1093                    sb.append("]]></column-value></column>");
1094                    sb.append(
1095                            "<column><column-name>timeZoneSensitive</column-name><column-value><![CDATA[");
1096                    sb.append(getTimeZoneSensitive());
1097                    sb.append("]]></column-value></column>");
1098                    sb.append(
1099                            "<column><column-name>type</column-name><column-value><![CDATA[");
1100                    sb.append(getType());
1101                    sb.append("]]></column-value></column>");
1102                    sb.append(
1103                            "<column><column-name>repeating</column-name><column-value><![CDATA[");
1104                    sb.append(getRepeating());
1105                    sb.append("]]></column-value></column>");
1106                    sb.append(
1107                            "<column><column-name>recurrence</column-name><column-value><![CDATA[");
1108                    sb.append(getRecurrence());
1109                    sb.append("]]></column-value></column>");
1110                    sb.append(
1111                            "<column><column-name>remindBy</column-name><column-value><![CDATA[");
1112                    sb.append(getRemindBy());
1113                    sb.append("]]></column-value></column>");
1114                    sb.append(
1115                            "<column><column-name>firstReminder</column-name><column-value><![CDATA[");
1116                    sb.append(getFirstReminder());
1117                    sb.append("]]></column-value></column>");
1118                    sb.append(
1119                            "<column><column-name>secondReminder</column-name><column-value><![CDATA[");
1120                    sb.append(getSecondReminder());
1121                    sb.append("]]></column-value></column>");
1122    
1123                    sb.append("</model>");
1124    
1125                    return sb.toString();
1126            }
1127    
1128            private static final ClassLoader _classLoader = CalEvent.class.getClassLoader();
1129            private static final Class<?>[] _escapedModelInterfaces = new Class[] {
1130                            CalEvent.class
1131                    };
1132            private String _uuid;
1133            private String _originalUuid;
1134            private long _eventId;
1135            private long _groupId;
1136            private long _originalGroupId;
1137            private boolean _setOriginalGroupId;
1138            private long _companyId;
1139            private long _originalCompanyId;
1140            private boolean _setOriginalCompanyId;
1141            private long _userId;
1142            private String _userName;
1143            private Date _createDate;
1144            private Date _modifiedDate;
1145            private String _title;
1146            private String _description;
1147            private String _location;
1148            private Date _startDate;
1149            private Date _endDate;
1150            private int _durationHour;
1151            private int _durationMinute;
1152            private boolean _allDay;
1153            private boolean _timeZoneSensitive;
1154            private String _type;
1155            private String _originalType;
1156            private boolean _repeating;
1157            private boolean _originalRepeating;
1158            private boolean _setOriginalRepeating;
1159            private String _recurrence;
1160            private int _remindBy;
1161            private int _originalRemindBy;
1162            private boolean _setOriginalRemindBy;
1163            private int _firstReminder;
1164            private int _secondReminder;
1165            private long _columnBitmask;
1166            private CalEvent _escapedModel;
1167    }