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