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