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