001
014
015 package com.liferay.portlet.blogs.model.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.blogs.kernel.model.BlogsEntry;
020
021 import com.liferay.portal.kernel.model.CacheModel;
022 import com.liferay.portal.kernel.util.HashUtil;
023 import com.liferay.portal.kernel.util.StringBundler;
024 import com.liferay.portal.kernel.util.StringPool;
025
026 import java.io.Externalizable;
027 import java.io.IOException;
028 import java.io.ObjectInput;
029 import java.io.ObjectOutput;
030
031 import java.util.Date;
032
033
040 @ProviderType
041 public class BlogsEntryCacheModel implements CacheModel<BlogsEntry>,
042 Externalizable {
043 @Override
044 public boolean equals(Object obj) {
045 if (this == obj) {
046 return true;
047 }
048
049 if (!(obj instanceof BlogsEntryCacheModel)) {
050 return false;
051 }
052
053 BlogsEntryCacheModel blogsEntryCacheModel = (BlogsEntryCacheModel)obj;
054
055 if (entryId == blogsEntryCacheModel.entryId) {
056 return true;
057 }
058
059 return false;
060 }
061
062 @Override
063 public int hashCode() {
064 return HashUtil.hash(0, entryId);
065 }
066
067 @Override
068 public String toString() {
069 StringBundler sb = new StringBundler(59);
070
071 sb.append("{uuid=");
072 sb.append(uuid);
073 sb.append(", entryId=");
074 sb.append(entryId);
075 sb.append(", groupId=");
076 sb.append(groupId);
077 sb.append(", companyId=");
078 sb.append(companyId);
079 sb.append(", userId=");
080 sb.append(userId);
081 sb.append(", userName=");
082 sb.append(userName);
083 sb.append(", createDate=");
084 sb.append(createDate);
085 sb.append(", modifiedDate=");
086 sb.append(modifiedDate);
087 sb.append(", title=");
088 sb.append(title);
089 sb.append(", subtitle=");
090 sb.append(subtitle);
091 sb.append(", urlTitle=");
092 sb.append(urlTitle);
093 sb.append(", description=");
094 sb.append(description);
095 sb.append(", content=");
096 sb.append(content);
097 sb.append(", displayDate=");
098 sb.append(displayDate);
099 sb.append(", allowPingbacks=");
100 sb.append(allowPingbacks);
101 sb.append(", allowTrackbacks=");
102 sb.append(allowTrackbacks);
103 sb.append(", trackbacks=");
104 sb.append(trackbacks);
105 sb.append(", coverImageCaption=");
106 sb.append(coverImageCaption);
107 sb.append(", coverImageFileEntryId=");
108 sb.append(coverImageFileEntryId);
109 sb.append(", coverImageURL=");
110 sb.append(coverImageURL);
111 sb.append(", smallImage=");
112 sb.append(smallImage);
113 sb.append(", smallImageFileEntryId=");
114 sb.append(smallImageFileEntryId);
115 sb.append(", smallImageId=");
116 sb.append(smallImageId);
117 sb.append(", smallImageURL=");
118 sb.append(smallImageURL);
119 sb.append(", lastPublishDate=");
120 sb.append(lastPublishDate);
121 sb.append(", status=");
122 sb.append(status);
123 sb.append(", statusByUserId=");
124 sb.append(statusByUserId);
125 sb.append(", statusByUserName=");
126 sb.append(statusByUserName);
127 sb.append(", statusDate=");
128 sb.append(statusDate);
129 sb.append("}");
130
131 return sb.toString();
132 }
133
134 @Override
135 public BlogsEntry toEntityModel() {
136 BlogsEntryImpl blogsEntryImpl = new BlogsEntryImpl();
137
138 if (uuid == null) {
139 blogsEntryImpl.setUuid(StringPool.BLANK);
140 }
141 else {
142 blogsEntryImpl.setUuid(uuid);
143 }
144
145 blogsEntryImpl.setEntryId(entryId);
146 blogsEntryImpl.setGroupId(groupId);
147 blogsEntryImpl.setCompanyId(companyId);
148 blogsEntryImpl.setUserId(userId);
149
150 if (userName == null) {
151 blogsEntryImpl.setUserName(StringPool.BLANK);
152 }
153 else {
154 blogsEntryImpl.setUserName(userName);
155 }
156
157 if (createDate == Long.MIN_VALUE) {
158 blogsEntryImpl.setCreateDate(null);
159 }
160 else {
161 blogsEntryImpl.setCreateDate(new Date(createDate));
162 }
163
164 if (modifiedDate == Long.MIN_VALUE) {
165 blogsEntryImpl.setModifiedDate(null);
166 }
167 else {
168 blogsEntryImpl.setModifiedDate(new Date(modifiedDate));
169 }
170
171 if (title == null) {
172 blogsEntryImpl.setTitle(StringPool.BLANK);
173 }
174 else {
175 blogsEntryImpl.setTitle(title);
176 }
177
178 if (subtitle == null) {
179 blogsEntryImpl.setSubtitle(StringPool.BLANK);
180 }
181 else {
182 blogsEntryImpl.setSubtitle(subtitle);
183 }
184
185 if (urlTitle == null) {
186 blogsEntryImpl.setUrlTitle(StringPool.BLANK);
187 }
188 else {
189 blogsEntryImpl.setUrlTitle(urlTitle);
190 }
191
192 if (description == null) {
193 blogsEntryImpl.setDescription(StringPool.BLANK);
194 }
195 else {
196 blogsEntryImpl.setDescription(description);
197 }
198
199 if (content == null) {
200 blogsEntryImpl.setContent(StringPool.BLANK);
201 }
202 else {
203 blogsEntryImpl.setContent(content);
204 }
205
206 if (displayDate == Long.MIN_VALUE) {
207 blogsEntryImpl.setDisplayDate(null);
208 }
209 else {
210 blogsEntryImpl.setDisplayDate(new Date(displayDate));
211 }
212
213 blogsEntryImpl.setAllowPingbacks(allowPingbacks);
214 blogsEntryImpl.setAllowTrackbacks(allowTrackbacks);
215
216 if (trackbacks == null) {
217 blogsEntryImpl.setTrackbacks(StringPool.BLANK);
218 }
219 else {
220 blogsEntryImpl.setTrackbacks(trackbacks);
221 }
222
223 if (coverImageCaption == null) {
224 blogsEntryImpl.setCoverImageCaption(StringPool.BLANK);
225 }
226 else {
227 blogsEntryImpl.setCoverImageCaption(coverImageCaption);
228 }
229
230 blogsEntryImpl.setCoverImageFileEntryId(coverImageFileEntryId);
231
232 if (coverImageURL == null) {
233 blogsEntryImpl.setCoverImageURL(StringPool.BLANK);
234 }
235 else {
236 blogsEntryImpl.setCoverImageURL(coverImageURL);
237 }
238
239 blogsEntryImpl.setSmallImage(smallImage);
240 blogsEntryImpl.setSmallImageFileEntryId(smallImageFileEntryId);
241 blogsEntryImpl.setSmallImageId(smallImageId);
242
243 if (smallImageURL == null) {
244 blogsEntryImpl.setSmallImageURL(StringPool.BLANK);
245 }
246 else {
247 blogsEntryImpl.setSmallImageURL(smallImageURL);
248 }
249
250 if (lastPublishDate == Long.MIN_VALUE) {
251 blogsEntryImpl.setLastPublishDate(null);
252 }
253 else {
254 blogsEntryImpl.setLastPublishDate(new Date(lastPublishDate));
255 }
256
257 blogsEntryImpl.setStatus(status);
258 blogsEntryImpl.setStatusByUserId(statusByUserId);
259
260 if (statusByUserName == null) {
261 blogsEntryImpl.setStatusByUserName(StringPool.BLANK);
262 }
263 else {
264 blogsEntryImpl.setStatusByUserName(statusByUserName);
265 }
266
267 if (statusDate == Long.MIN_VALUE) {
268 blogsEntryImpl.setStatusDate(null);
269 }
270 else {
271 blogsEntryImpl.setStatusDate(new Date(statusDate));
272 }
273
274 blogsEntryImpl.resetOriginalValues();
275
276 return blogsEntryImpl;
277 }
278
279 @Override
280 public void readExternal(ObjectInput objectInput) throws IOException {
281 uuid = objectInput.readUTF();
282
283 entryId = objectInput.readLong();
284
285 groupId = objectInput.readLong();
286
287 companyId = objectInput.readLong();
288
289 userId = objectInput.readLong();
290 userName = objectInput.readUTF();
291 createDate = objectInput.readLong();
292 modifiedDate = objectInput.readLong();
293 title = objectInput.readUTF();
294 subtitle = objectInput.readUTF();
295 urlTitle = objectInput.readUTF();
296 description = objectInput.readUTF();
297 content = objectInput.readUTF();
298 displayDate = objectInput.readLong();
299
300 allowPingbacks = objectInput.readBoolean();
301
302 allowTrackbacks = objectInput.readBoolean();
303 trackbacks = objectInput.readUTF();
304 coverImageCaption = objectInput.readUTF();
305
306 coverImageFileEntryId = objectInput.readLong();
307 coverImageURL = objectInput.readUTF();
308
309 smallImage = objectInput.readBoolean();
310
311 smallImageFileEntryId = objectInput.readLong();
312
313 smallImageId = objectInput.readLong();
314 smallImageURL = objectInput.readUTF();
315 lastPublishDate = objectInput.readLong();
316
317 status = objectInput.readInt();
318
319 statusByUserId = objectInput.readLong();
320 statusByUserName = objectInput.readUTF();
321 statusDate = objectInput.readLong();
322 }
323
324 @Override
325 public void writeExternal(ObjectOutput objectOutput)
326 throws IOException {
327 if (uuid == null) {
328 objectOutput.writeUTF(StringPool.BLANK);
329 }
330 else {
331 objectOutput.writeUTF(uuid);
332 }
333
334 objectOutput.writeLong(entryId);
335
336 objectOutput.writeLong(groupId);
337
338 objectOutput.writeLong(companyId);
339
340 objectOutput.writeLong(userId);
341
342 if (userName == null) {
343 objectOutput.writeUTF(StringPool.BLANK);
344 }
345 else {
346 objectOutput.writeUTF(userName);
347 }
348
349 objectOutput.writeLong(createDate);
350 objectOutput.writeLong(modifiedDate);
351
352 if (title == null) {
353 objectOutput.writeUTF(StringPool.BLANK);
354 }
355 else {
356 objectOutput.writeUTF(title);
357 }
358
359 if (subtitle == null) {
360 objectOutput.writeUTF(StringPool.BLANK);
361 }
362 else {
363 objectOutput.writeUTF(subtitle);
364 }
365
366 if (urlTitle == null) {
367 objectOutput.writeUTF(StringPool.BLANK);
368 }
369 else {
370 objectOutput.writeUTF(urlTitle);
371 }
372
373 if (description == null) {
374 objectOutput.writeUTF(StringPool.BLANK);
375 }
376 else {
377 objectOutput.writeUTF(description);
378 }
379
380 if (content == null) {
381 objectOutput.writeUTF(StringPool.BLANK);
382 }
383 else {
384 objectOutput.writeUTF(content);
385 }
386
387 objectOutput.writeLong(displayDate);
388
389 objectOutput.writeBoolean(allowPingbacks);
390
391 objectOutput.writeBoolean(allowTrackbacks);
392
393 if (trackbacks == null) {
394 objectOutput.writeUTF(StringPool.BLANK);
395 }
396 else {
397 objectOutput.writeUTF(trackbacks);
398 }
399
400 if (coverImageCaption == null) {
401 objectOutput.writeUTF(StringPool.BLANK);
402 }
403 else {
404 objectOutput.writeUTF(coverImageCaption);
405 }
406
407 objectOutput.writeLong(coverImageFileEntryId);
408
409 if (coverImageURL == null) {
410 objectOutput.writeUTF(StringPool.BLANK);
411 }
412 else {
413 objectOutput.writeUTF(coverImageURL);
414 }
415
416 objectOutput.writeBoolean(smallImage);
417
418 objectOutput.writeLong(smallImageFileEntryId);
419
420 objectOutput.writeLong(smallImageId);
421
422 if (smallImageURL == null) {
423 objectOutput.writeUTF(StringPool.BLANK);
424 }
425 else {
426 objectOutput.writeUTF(smallImageURL);
427 }
428
429 objectOutput.writeLong(lastPublishDate);
430
431 objectOutput.writeInt(status);
432
433 objectOutput.writeLong(statusByUserId);
434
435 if (statusByUserName == null) {
436 objectOutput.writeUTF(StringPool.BLANK);
437 }
438 else {
439 objectOutput.writeUTF(statusByUserName);
440 }
441
442 objectOutput.writeLong(statusDate);
443 }
444
445 public String uuid;
446 public long entryId;
447 public long groupId;
448 public long companyId;
449 public long userId;
450 public String userName;
451 public long createDate;
452 public long modifiedDate;
453 public String title;
454 public String subtitle;
455 public String urlTitle;
456 public String description;
457 public String content;
458 public long displayDate;
459 public boolean allowPingbacks;
460 public boolean allowTrackbacks;
461 public String trackbacks;
462 public String coverImageCaption;
463 public long coverImageFileEntryId;
464 public String coverImageURL;
465 public boolean smallImage;
466 public long smallImageFileEntryId;
467 public long smallImageId;
468 public String smallImageURL;
469 public long lastPublishDate;
470 public int status;
471 public long statusByUserId;
472 public String statusByUserName;
473 public long statusDate;
474 }