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