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.util.StringBundler;
018    import com.liferay.portal.kernel.util.StringPool;
019    import com.liferay.portal.model.CacheModel;
020    
021    import com.liferay.portlet.calendar.model.CalEvent;
022    
023    import java.io.Serializable;
024    
025    import java.util.Date;
026    
027    /**
028     * The cache model class for representing CalEvent in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see CalEvent
032     * @generated
033     */
034    public class CalEventCacheModel implements CacheModel<CalEvent>, Serializable {
035            @Override
036            public String toString() {
037                    StringBundler sb = new StringBundler(47);
038    
039                    sb.append("{uuid=");
040                    sb.append(uuid);
041                    sb.append(", eventId=");
042                    sb.append(eventId);
043                    sb.append(", groupId=");
044                    sb.append(groupId);
045                    sb.append(", companyId=");
046                    sb.append(companyId);
047                    sb.append(", userId=");
048                    sb.append(userId);
049                    sb.append(", userName=");
050                    sb.append(userName);
051                    sb.append(", createDate=");
052                    sb.append(createDate);
053                    sb.append(", modifiedDate=");
054                    sb.append(modifiedDate);
055                    sb.append(", title=");
056                    sb.append(title);
057                    sb.append(", description=");
058                    sb.append(description);
059                    sb.append(", location=");
060                    sb.append(location);
061                    sb.append(", startDate=");
062                    sb.append(startDate);
063                    sb.append(", endDate=");
064                    sb.append(endDate);
065                    sb.append(", durationHour=");
066                    sb.append(durationHour);
067                    sb.append(", durationMinute=");
068                    sb.append(durationMinute);
069                    sb.append(", allDay=");
070                    sb.append(allDay);
071                    sb.append(", timeZoneSensitive=");
072                    sb.append(timeZoneSensitive);
073                    sb.append(", type=");
074                    sb.append(type);
075                    sb.append(", repeating=");
076                    sb.append(repeating);
077                    sb.append(", recurrence=");
078                    sb.append(recurrence);
079                    sb.append(", remindBy=");
080                    sb.append(remindBy);
081                    sb.append(", firstReminder=");
082                    sb.append(firstReminder);
083                    sb.append(", secondReminder=");
084                    sb.append(secondReminder);
085                    sb.append("}");
086    
087                    return sb.toString();
088            }
089    
090            public CalEvent toEntityModel() {
091                    CalEventImpl calEventImpl = new CalEventImpl();
092    
093                    if (uuid == null) {
094                            calEventImpl.setUuid(StringPool.BLANK);
095                    }
096                    else {
097                            calEventImpl.setUuid(uuid);
098                    }
099    
100                    calEventImpl.setEventId(eventId);
101                    calEventImpl.setGroupId(groupId);
102                    calEventImpl.setCompanyId(companyId);
103                    calEventImpl.setUserId(userId);
104    
105                    if (userName == null) {
106                            calEventImpl.setUserName(StringPool.BLANK);
107                    }
108                    else {
109                            calEventImpl.setUserName(userName);
110                    }
111    
112                    if (createDate == Long.MIN_VALUE) {
113                            calEventImpl.setCreateDate(null);
114                    }
115                    else {
116                            calEventImpl.setCreateDate(new Date(createDate));
117                    }
118    
119                    if (modifiedDate == Long.MIN_VALUE) {
120                            calEventImpl.setModifiedDate(null);
121                    }
122                    else {
123                            calEventImpl.setModifiedDate(new Date(modifiedDate));
124                    }
125    
126                    if (title == null) {
127                            calEventImpl.setTitle(StringPool.BLANK);
128                    }
129                    else {
130                            calEventImpl.setTitle(title);
131                    }
132    
133                    if (description == null) {
134                            calEventImpl.setDescription(StringPool.BLANK);
135                    }
136                    else {
137                            calEventImpl.setDescription(description);
138                    }
139    
140                    if (location == null) {
141                            calEventImpl.setLocation(StringPool.BLANK);
142                    }
143                    else {
144                            calEventImpl.setLocation(location);
145                    }
146    
147                    if (startDate == Long.MIN_VALUE) {
148                            calEventImpl.setStartDate(null);
149                    }
150                    else {
151                            calEventImpl.setStartDate(new Date(startDate));
152                    }
153    
154                    if (endDate == Long.MIN_VALUE) {
155                            calEventImpl.setEndDate(null);
156                    }
157                    else {
158                            calEventImpl.setEndDate(new Date(endDate));
159                    }
160    
161                    calEventImpl.setDurationHour(durationHour);
162                    calEventImpl.setDurationMinute(durationMinute);
163                    calEventImpl.setAllDay(allDay);
164                    calEventImpl.setTimeZoneSensitive(timeZoneSensitive);
165    
166                    if (type == null) {
167                            calEventImpl.setType(StringPool.BLANK);
168                    }
169                    else {
170                            calEventImpl.setType(type);
171                    }
172    
173                    calEventImpl.setRepeating(repeating);
174    
175                    if (recurrence == null) {
176                            calEventImpl.setRecurrence(StringPool.BLANK);
177                    }
178                    else {
179                            calEventImpl.setRecurrence(recurrence);
180                    }
181    
182                    calEventImpl.setRemindBy(remindBy);
183                    calEventImpl.setFirstReminder(firstReminder);
184                    calEventImpl.setSecondReminder(secondReminder);
185    
186                    calEventImpl.resetOriginalValues();
187    
188                    return calEventImpl;
189            }
190    
191            public String uuid;
192            public long eventId;
193            public long groupId;
194            public long companyId;
195            public long userId;
196            public String userName;
197            public long createDate;
198            public long modifiedDate;
199            public String title;
200            public String description;
201            public String location;
202            public long startDate;
203            public long endDate;
204            public int durationHour;
205            public int durationMinute;
206            public boolean allDay;
207            public boolean timeZoneSensitive;
208            public String type;
209            public boolean repeating;
210            public String recurrence;
211            public int remindBy;
212            public int firstReminder;
213            public int secondReminder;
214    }