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