001
014
015 package com.liferay.portlet.blogs.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.blogs.model.BlogsEntry;
022
023 import java.io.Externalizable;
024 import java.io.IOException;
025 import java.io.ObjectInput;
026 import java.io.ObjectOutput;
027
028 import java.util.Date;
029
030
037 public class BlogsEntryCacheModel implements CacheModel<BlogsEntry>,
038 Externalizable {
039 @Override
040 public String toString() {
041 StringBundler sb = new StringBundler(47);
042
043 sb.append("{uuid=");
044 sb.append(uuid);
045 sb.append(", entryId=");
046 sb.append(entryId);
047 sb.append(", groupId=");
048 sb.append(groupId);
049 sb.append(", companyId=");
050 sb.append(companyId);
051 sb.append(", userId=");
052 sb.append(userId);
053 sb.append(", userName=");
054 sb.append(userName);
055 sb.append(", createDate=");
056 sb.append(createDate);
057 sb.append(", modifiedDate=");
058 sb.append(modifiedDate);
059 sb.append(", title=");
060 sb.append(title);
061 sb.append(", urlTitle=");
062 sb.append(urlTitle);
063 sb.append(", description=");
064 sb.append(description);
065 sb.append(", content=");
066 sb.append(content);
067 sb.append(", displayDate=");
068 sb.append(displayDate);
069 sb.append(", allowPingbacks=");
070 sb.append(allowPingbacks);
071 sb.append(", allowTrackbacks=");
072 sb.append(allowTrackbacks);
073 sb.append(", trackbacks=");
074 sb.append(trackbacks);
075 sb.append(", smallImage=");
076 sb.append(smallImage);
077 sb.append(", smallImageId=");
078 sb.append(smallImageId);
079 sb.append(", smallImageURL=");
080 sb.append(smallImageURL);
081 sb.append(", status=");
082 sb.append(status);
083 sb.append(", statusByUserId=");
084 sb.append(statusByUserId);
085 sb.append(", statusByUserName=");
086 sb.append(statusByUserName);
087 sb.append(", statusDate=");
088 sb.append(statusDate);
089 sb.append("}");
090
091 return sb.toString();
092 }
093
094 @Override
095 public BlogsEntry toEntityModel() {
096 BlogsEntryImpl blogsEntryImpl = new BlogsEntryImpl();
097
098 if (uuid == null) {
099 blogsEntryImpl.setUuid(StringPool.BLANK);
100 }
101 else {
102 blogsEntryImpl.setUuid(uuid);
103 }
104
105 blogsEntryImpl.setEntryId(entryId);
106 blogsEntryImpl.setGroupId(groupId);
107 blogsEntryImpl.setCompanyId(companyId);
108 blogsEntryImpl.setUserId(userId);
109
110 if (userName == null) {
111 blogsEntryImpl.setUserName(StringPool.BLANK);
112 }
113 else {
114 blogsEntryImpl.setUserName(userName);
115 }
116
117 if (createDate == Long.MIN_VALUE) {
118 blogsEntryImpl.setCreateDate(null);
119 }
120 else {
121 blogsEntryImpl.setCreateDate(new Date(createDate));
122 }
123
124 if (modifiedDate == Long.MIN_VALUE) {
125 blogsEntryImpl.setModifiedDate(null);
126 }
127 else {
128 blogsEntryImpl.setModifiedDate(new Date(modifiedDate));
129 }
130
131 if (title == null) {
132 blogsEntryImpl.setTitle(StringPool.BLANK);
133 }
134 else {
135 blogsEntryImpl.setTitle(title);
136 }
137
138 if (urlTitle == null) {
139 blogsEntryImpl.setUrlTitle(StringPool.BLANK);
140 }
141 else {
142 blogsEntryImpl.setUrlTitle(urlTitle);
143 }
144
145 if (description == null) {
146 blogsEntryImpl.setDescription(StringPool.BLANK);
147 }
148 else {
149 blogsEntryImpl.setDescription(description);
150 }
151
152 if (content == null) {
153 blogsEntryImpl.setContent(StringPool.BLANK);
154 }
155 else {
156 blogsEntryImpl.setContent(content);
157 }
158
159 if (displayDate == Long.MIN_VALUE) {
160 blogsEntryImpl.setDisplayDate(null);
161 }
162 else {
163 blogsEntryImpl.setDisplayDate(new Date(displayDate));
164 }
165
166 blogsEntryImpl.setAllowPingbacks(allowPingbacks);
167 blogsEntryImpl.setAllowTrackbacks(allowTrackbacks);
168
169 if (trackbacks == null) {
170 blogsEntryImpl.setTrackbacks(StringPool.BLANK);
171 }
172 else {
173 blogsEntryImpl.setTrackbacks(trackbacks);
174 }
175
176 blogsEntryImpl.setSmallImage(smallImage);
177 blogsEntryImpl.setSmallImageId(smallImageId);
178
179 if (smallImageURL == null) {
180 blogsEntryImpl.setSmallImageURL(StringPool.BLANK);
181 }
182 else {
183 blogsEntryImpl.setSmallImageURL(smallImageURL);
184 }
185
186 blogsEntryImpl.setStatus(status);
187 blogsEntryImpl.setStatusByUserId(statusByUserId);
188
189 if (statusByUserName == null) {
190 blogsEntryImpl.setStatusByUserName(StringPool.BLANK);
191 }
192 else {
193 blogsEntryImpl.setStatusByUserName(statusByUserName);
194 }
195
196 if (statusDate == Long.MIN_VALUE) {
197 blogsEntryImpl.setStatusDate(null);
198 }
199 else {
200 blogsEntryImpl.setStatusDate(new Date(statusDate));
201 }
202
203 blogsEntryImpl.resetOriginalValues();
204
205 return blogsEntryImpl;
206 }
207
208 @Override
209 public void readExternal(ObjectInput objectInput) throws IOException {
210 uuid = objectInput.readUTF();
211 entryId = objectInput.readLong();
212 groupId = objectInput.readLong();
213 companyId = objectInput.readLong();
214 userId = objectInput.readLong();
215 userName = objectInput.readUTF();
216 createDate = objectInput.readLong();
217 modifiedDate = objectInput.readLong();
218 title = objectInput.readUTF();
219 urlTitle = objectInput.readUTF();
220 description = objectInput.readUTF();
221 content = objectInput.readUTF();
222 displayDate = objectInput.readLong();
223 allowPingbacks = objectInput.readBoolean();
224 allowTrackbacks = objectInput.readBoolean();
225 trackbacks = objectInput.readUTF();
226 smallImage = objectInput.readBoolean();
227 smallImageId = objectInput.readLong();
228 smallImageURL = objectInput.readUTF();
229 status = objectInput.readInt();
230 statusByUserId = objectInput.readLong();
231 statusByUserName = objectInput.readUTF();
232 statusDate = objectInput.readLong();
233 }
234
235 @Override
236 public void writeExternal(ObjectOutput objectOutput)
237 throws IOException {
238 if (uuid == null) {
239 objectOutput.writeUTF(StringPool.BLANK);
240 }
241 else {
242 objectOutput.writeUTF(uuid);
243 }
244
245 objectOutput.writeLong(entryId);
246 objectOutput.writeLong(groupId);
247 objectOutput.writeLong(companyId);
248 objectOutput.writeLong(userId);
249
250 if (userName == null) {
251 objectOutput.writeUTF(StringPool.BLANK);
252 }
253 else {
254 objectOutput.writeUTF(userName);
255 }
256
257 objectOutput.writeLong(createDate);
258 objectOutput.writeLong(modifiedDate);
259
260 if (title == null) {
261 objectOutput.writeUTF(StringPool.BLANK);
262 }
263 else {
264 objectOutput.writeUTF(title);
265 }
266
267 if (urlTitle == null) {
268 objectOutput.writeUTF(StringPool.BLANK);
269 }
270 else {
271 objectOutput.writeUTF(urlTitle);
272 }
273
274 if (description == null) {
275 objectOutput.writeUTF(StringPool.BLANK);
276 }
277 else {
278 objectOutput.writeUTF(description);
279 }
280
281 if (content == null) {
282 objectOutput.writeUTF(StringPool.BLANK);
283 }
284 else {
285 objectOutput.writeUTF(content);
286 }
287
288 objectOutput.writeLong(displayDate);
289 objectOutput.writeBoolean(allowPingbacks);
290 objectOutput.writeBoolean(allowTrackbacks);
291
292 if (trackbacks == null) {
293 objectOutput.writeUTF(StringPool.BLANK);
294 }
295 else {
296 objectOutput.writeUTF(trackbacks);
297 }
298
299 objectOutput.writeBoolean(smallImage);
300 objectOutput.writeLong(smallImageId);
301
302 if (smallImageURL == null) {
303 objectOutput.writeUTF(StringPool.BLANK);
304 }
305 else {
306 objectOutput.writeUTF(smallImageURL);
307 }
308
309 objectOutput.writeInt(status);
310 objectOutput.writeLong(statusByUserId);
311
312 if (statusByUserName == null) {
313 objectOutput.writeUTF(StringPool.BLANK);
314 }
315 else {
316 objectOutput.writeUTF(statusByUserName);
317 }
318
319 objectOutput.writeLong(statusDate);
320 }
321
322 public String uuid;
323 public long entryId;
324 public long groupId;
325 public long companyId;
326 public long userId;
327 public String userName;
328 public long createDate;
329 public long modifiedDate;
330 public String title;
331 public String urlTitle;
332 public String description;
333 public String content;
334 public long displayDate;
335 public boolean allowPingbacks;
336 public boolean allowTrackbacks;
337 public String trackbacks;
338 public boolean smallImage;
339 public long smallImageId;
340 public String smallImageURL;
341 public int status;
342 public long statusByUserId;
343 public String statusByUserName;
344 public long statusDate;
345 }