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.messageboards.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.messageboards.model.MBMessage;
022    
023    import java.io.Serializable;
024    
025    import java.util.Date;
026    
027    /**
028     * The cache model class for representing MBMessage in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see MBMessage
032     * @generated
033     */
034    public class MBMessageCacheModel implements CacheModel<MBMessage>, Serializable {
035            @Override
036            public String toString() {
037                    StringBundler sb = new StringBundler(53);
038    
039                    sb.append("{uuid=");
040                    sb.append(uuid);
041                    sb.append(", messageId=");
042                    sb.append(messageId);
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(", classNameId=");
056                    sb.append(classNameId);
057                    sb.append(", classPK=");
058                    sb.append(classPK);
059                    sb.append(", categoryId=");
060                    sb.append(categoryId);
061                    sb.append(", threadId=");
062                    sb.append(threadId);
063                    sb.append(", rootMessageId=");
064                    sb.append(rootMessageId);
065                    sb.append(", parentMessageId=");
066                    sb.append(parentMessageId);
067                    sb.append(", subject=");
068                    sb.append(subject);
069                    sb.append(", body=");
070                    sb.append(body);
071                    sb.append(", format=");
072                    sb.append(format);
073                    sb.append(", attachments=");
074                    sb.append(attachments);
075                    sb.append(", anonymous=");
076                    sb.append(anonymous);
077                    sb.append(", priority=");
078                    sb.append(priority);
079                    sb.append(", allowPingbacks=");
080                    sb.append(allowPingbacks);
081                    sb.append(", answer=");
082                    sb.append(answer);
083                    sb.append(", status=");
084                    sb.append(status);
085                    sb.append(", statusByUserId=");
086                    sb.append(statusByUserId);
087                    sb.append(", statusByUserName=");
088                    sb.append(statusByUserName);
089                    sb.append(", statusDate=");
090                    sb.append(statusDate);
091                    sb.append("}");
092    
093                    return sb.toString();
094            }
095    
096            public MBMessage toEntityModel() {
097                    MBMessageImpl mbMessageImpl = new MBMessageImpl();
098    
099                    if (uuid == null) {
100                            mbMessageImpl.setUuid(StringPool.BLANK);
101                    }
102                    else {
103                            mbMessageImpl.setUuid(uuid);
104                    }
105    
106                    mbMessageImpl.setMessageId(messageId);
107                    mbMessageImpl.setGroupId(groupId);
108                    mbMessageImpl.setCompanyId(companyId);
109                    mbMessageImpl.setUserId(userId);
110    
111                    if (userName == null) {
112                            mbMessageImpl.setUserName(StringPool.BLANK);
113                    }
114                    else {
115                            mbMessageImpl.setUserName(userName);
116                    }
117    
118                    if (createDate == Long.MIN_VALUE) {
119                            mbMessageImpl.setCreateDate(null);
120                    }
121                    else {
122                            mbMessageImpl.setCreateDate(new Date(createDate));
123                    }
124    
125                    if (modifiedDate == Long.MIN_VALUE) {
126                            mbMessageImpl.setModifiedDate(null);
127                    }
128                    else {
129                            mbMessageImpl.setModifiedDate(new Date(modifiedDate));
130                    }
131    
132                    mbMessageImpl.setClassNameId(classNameId);
133                    mbMessageImpl.setClassPK(classPK);
134                    mbMessageImpl.setCategoryId(categoryId);
135                    mbMessageImpl.setThreadId(threadId);
136                    mbMessageImpl.setRootMessageId(rootMessageId);
137                    mbMessageImpl.setParentMessageId(parentMessageId);
138    
139                    if (subject == null) {
140                            mbMessageImpl.setSubject(StringPool.BLANK);
141                    }
142                    else {
143                            mbMessageImpl.setSubject(subject);
144                    }
145    
146                    if (body == null) {
147                            mbMessageImpl.setBody(StringPool.BLANK);
148                    }
149                    else {
150                            mbMessageImpl.setBody(body);
151                    }
152    
153                    if (format == null) {
154                            mbMessageImpl.setFormat(StringPool.BLANK);
155                    }
156                    else {
157                            mbMessageImpl.setFormat(format);
158                    }
159    
160                    mbMessageImpl.setAttachments(attachments);
161                    mbMessageImpl.setAnonymous(anonymous);
162                    mbMessageImpl.setPriority(priority);
163                    mbMessageImpl.setAllowPingbacks(allowPingbacks);
164                    mbMessageImpl.setAnswer(answer);
165                    mbMessageImpl.setStatus(status);
166                    mbMessageImpl.setStatusByUserId(statusByUserId);
167    
168                    if (statusByUserName == null) {
169                            mbMessageImpl.setStatusByUserName(StringPool.BLANK);
170                    }
171                    else {
172                            mbMessageImpl.setStatusByUserName(statusByUserName);
173                    }
174    
175                    if (statusDate == Long.MIN_VALUE) {
176                            mbMessageImpl.setStatusDate(null);
177                    }
178                    else {
179                            mbMessageImpl.setStatusDate(new Date(statusDate));
180                    }
181    
182                    mbMessageImpl.resetOriginalValues();
183    
184                    return mbMessageImpl;
185            }
186    
187            public String uuid;
188            public long messageId;
189            public long groupId;
190            public long companyId;
191            public long userId;
192            public String userName;
193            public long createDate;
194            public long modifiedDate;
195            public long classNameId;
196            public long classPK;
197            public long categoryId;
198            public long threadId;
199            public long rootMessageId;
200            public long parentMessageId;
201            public String subject;
202            public String body;
203            public String format;
204            public boolean attachments;
205            public boolean anonymous;
206            public double priority;
207            public boolean allowPingbacks;
208            public boolean answer;
209            public int status;
210            public long statusByUserId;
211            public String statusByUserName;
212            public long statusDate;
213    }