001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
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    /**
031     * The cache model class for representing JournalArticle in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see JournalArticle
035     * @generated
036     */
037    public class JournalArticleCacheModel implements CacheModel<JournalArticle>,
038            Externalizable {
039            @Override
040            public String toString() {
041                    StringBundler sb = new StringBundler(69);
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(", treePath=");
068                    sb.append(treePath);
069                    sb.append(", articleId=");
070                    sb.append(articleId);
071                    sb.append(", version=");
072                    sb.append(version);
073                    sb.append(", title=");
074                    sb.append(title);
075                    sb.append(", urlTitle=");
076                    sb.append(urlTitle);
077                    sb.append(", description=");
078                    sb.append(description);
079                    sb.append(", content=");
080                    sb.append(content);
081                    sb.append(", type=");
082                    sb.append(type);
083                    sb.append(", structureId=");
084                    sb.append(structureId);
085                    sb.append(", templateId=");
086                    sb.append(templateId);
087                    sb.append(", layoutUuid=");
088                    sb.append(layoutUuid);
089                    sb.append(", displayDate=");
090                    sb.append(displayDate);
091                    sb.append(", expirationDate=");
092                    sb.append(expirationDate);
093                    sb.append(", reviewDate=");
094                    sb.append(reviewDate);
095                    sb.append(", indexable=");
096                    sb.append(indexable);
097                    sb.append(", smallImage=");
098                    sb.append(smallImage);
099                    sb.append(", smallImageId=");
100                    sb.append(smallImageId);
101                    sb.append(", smallImageURL=");
102                    sb.append(smallImageURL);
103                    sb.append(", status=");
104                    sb.append(status);
105                    sb.append(", statusByUserId=");
106                    sb.append(statusByUserId);
107                    sb.append(", statusByUserName=");
108                    sb.append(statusByUserName);
109                    sb.append(", statusDate=");
110                    sb.append(statusDate);
111                    sb.append("}");
112    
113                    return sb.toString();
114            }
115    
116            @Override
117            public JournalArticle toEntityModel() {
118                    JournalArticleImpl journalArticleImpl = new JournalArticleImpl();
119    
120                    if (uuid == null) {
121                            journalArticleImpl.setUuid(StringPool.BLANK);
122                    }
123                    else {
124                            journalArticleImpl.setUuid(uuid);
125                    }
126    
127                    journalArticleImpl.setId(id);
128                    journalArticleImpl.setResourcePrimKey(resourcePrimKey);
129                    journalArticleImpl.setGroupId(groupId);
130                    journalArticleImpl.setCompanyId(companyId);
131                    journalArticleImpl.setUserId(userId);
132    
133                    if (userName == null) {
134                            journalArticleImpl.setUserName(StringPool.BLANK);
135                    }
136                    else {
137                            journalArticleImpl.setUserName(userName);
138                    }
139    
140                    if (createDate == Long.MIN_VALUE) {
141                            journalArticleImpl.setCreateDate(null);
142                    }
143                    else {
144                            journalArticleImpl.setCreateDate(new Date(createDate));
145                    }
146    
147                    if (modifiedDate == Long.MIN_VALUE) {
148                            journalArticleImpl.setModifiedDate(null);
149                    }
150                    else {
151                            journalArticleImpl.setModifiedDate(new Date(modifiedDate));
152                    }
153    
154                    journalArticleImpl.setFolderId(folderId);
155                    journalArticleImpl.setClassNameId(classNameId);
156                    journalArticleImpl.setClassPK(classPK);
157    
158                    if (treePath == null) {
159                            journalArticleImpl.setTreePath(StringPool.BLANK);
160                    }
161                    else {
162                            journalArticleImpl.setTreePath(treePath);
163                    }
164    
165                    if (articleId == null) {
166                            journalArticleImpl.setArticleId(StringPool.BLANK);
167                    }
168                    else {
169                            journalArticleImpl.setArticleId(articleId);
170                    }
171    
172                    journalArticleImpl.setVersion(version);
173    
174                    if (title == null) {
175                            journalArticleImpl.setTitle(StringPool.BLANK);
176                    }
177                    else {
178                            journalArticleImpl.setTitle(title);
179                    }
180    
181                    if (urlTitle == null) {
182                            journalArticleImpl.setUrlTitle(StringPool.BLANK);
183                    }
184                    else {
185                            journalArticleImpl.setUrlTitle(urlTitle);
186                    }
187    
188                    if (description == null) {
189                            journalArticleImpl.setDescription(StringPool.BLANK);
190                    }
191                    else {
192                            journalArticleImpl.setDescription(description);
193                    }
194    
195                    if (content == null) {
196                            journalArticleImpl.setContent(StringPool.BLANK);
197                    }
198                    else {
199                            journalArticleImpl.setContent(content);
200                    }
201    
202                    if (type == null) {
203                            journalArticleImpl.setType(StringPool.BLANK);
204                    }
205                    else {
206                            journalArticleImpl.setType(type);
207                    }
208    
209                    if (structureId == null) {
210                            journalArticleImpl.setStructureId(StringPool.BLANK);
211                    }
212                    else {
213                            journalArticleImpl.setStructureId(structureId);
214                    }
215    
216                    if (templateId == null) {
217                            journalArticleImpl.setTemplateId(StringPool.BLANK);
218                    }
219                    else {
220                            journalArticleImpl.setTemplateId(templateId);
221                    }
222    
223                    if (layoutUuid == null) {
224                            journalArticleImpl.setLayoutUuid(StringPool.BLANK);
225                    }
226                    else {
227                            journalArticleImpl.setLayoutUuid(layoutUuid);
228                    }
229    
230                    if (displayDate == Long.MIN_VALUE) {
231                            journalArticleImpl.setDisplayDate(null);
232                    }
233                    else {
234                            journalArticleImpl.setDisplayDate(new Date(displayDate));
235                    }
236    
237                    if (expirationDate == Long.MIN_VALUE) {
238                            journalArticleImpl.setExpirationDate(null);
239                    }
240                    else {
241                            journalArticleImpl.setExpirationDate(new Date(expirationDate));
242                    }
243    
244                    if (reviewDate == Long.MIN_VALUE) {
245                            journalArticleImpl.setReviewDate(null);
246                    }
247                    else {
248                            journalArticleImpl.setReviewDate(new Date(reviewDate));
249                    }
250    
251                    journalArticleImpl.setIndexable(indexable);
252                    journalArticleImpl.setSmallImage(smallImage);
253                    journalArticleImpl.setSmallImageId(smallImageId);
254    
255                    if (smallImageURL == null) {
256                            journalArticleImpl.setSmallImageURL(StringPool.BLANK);
257                    }
258                    else {
259                            journalArticleImpl.setSmallImageURL(smallImageURL);
260                    }
261    
262                    journalArticleImpl.setStatus(status);
263                    journalArticleImpl.setStatusByUserId(statusByUserId);
264    
265                    if (statusByUserName == null) {
266                            journalArticleImpl.setStatusByUserName(StringPool.BLANK);
267                    }
268                    else {
269                            journalArticleImpl.setStatusByUserName(statusByUserName);
270                    }
271    
272                    if (statusDate == Long.MIN_VALUE) {
273                            journalArticleImpl.setStatusDate(null);
274                    }
275                    else {
276                            journalArticleImpl.setStatusDate(new Date(statusDate));
277                    }
278    
279                    journalArticleImpl.resetOriginalValues();
280    
281                    return journalArticleImpl;
282            }
283    
284            @Override
285            public void readExternal(ObjectInput objectInput) throws IOException {
286                    uuid = objectInput.readUTF();
287                    id = objectInput.readLong();
288                    resourcePrimKey = objectInput.readLong();
289                    groupId = objectInput.readLong();
290                    companyId = objectInput.readLong();
291                    userId = objectInput.readLong();
292                    userName = objectInput.readUTF();
293                    createDate = objectInput.readLong();
294                    modifiedDate = objectInput.readLong();
295                    folderId = objectInput.readLong();
296                    classNameId = objectInput.readLong();
297                    classPK = objectInput.readLong();
298                    treePath = objectInput.readUTF();
299                    articleId = objectInput.readUTF();
300                    version = objectInput.readDouble();
301                    title = objectInput.readUTF();
302                    urlTitle = objectInput.readUTF();
303                    description = objectInput.readUTF();
304                    content = objectInput.readUTF();
305                    type = objectInput.readUTF();
306                    structureId = objectInput.readUTF();
307                    templateId = objectInput.readUTF();
308                    layoutUuid = objectInput.readUTF();
309                    displayDate = objectInput.readLong();
310                    expirationDate = objectInput.readLong();
311                    reviewDate = objectInput.readLong();
312                    indexable = objectInput.readBoolean();
313                    smallImage = objectInput.readBoolean();
314                    smallImageId = objectInput.readLong();
315                    smallImageURL = objectInput.readUTF();
316                    status = objectInput.readInt();
317                    statusByUserId = objectInput.readLong();
318                    statusByUserName = objectInput.readUTF();
319                    statusDate = objectInput.readLong();
320            }
321    
322            @Override
323            public void writeExternal(ObjectOutput objectOutput)
324                    throws IOException {
325                    if (uuid == null) {
326                            objectOutput.writeUTF(StringPool.BLANK);
327                    }
328                    else {
329                            objectOutput.writeUTF(uuid);
330                    }
331    
332                    objectOutput.writeLong(id);
333                    objectOutput.writeLong(resourcePrimKey);
334                    objectOutput.writeLong(groupId);
335                    objectOutput.writeLong(companyId);
336                    objectOutput.writeLong(userId);
337    
338                    if (userName == null) {
339                            objectOutput.writeUTF(StringPool.BLANK);
340                    }
341                    else {
342                            objectOutput.writeUTF(userName);
343                    }
344    
345                    objectOutput.writeLong(createDate);
346                    objectOutput.writeLong(modifiedDate);
347                    objectOutput.writeLong(folderId);
348                    objectOutput.writeLong(classNameId);
349                    objectOutput.writeLong(classPK);
350    
351                    if (treePath == null) {
352                            objectOutput.writeUTF(StringPool.BLANK);
353                    }
354                    else {
355                            objectOutput.writeUTF(treePath);
356                    }
357    
358                    if (articleId == null) {
359                            objectOutput.writeUTF(StringPool.BLANK);
360                    }
361                    else {
362                            objectOutput.writeUTF(articleId);
363                    }
364    
365                    objectOutput.writeDouble(version);
366    
367                    if (title == null) {
368                            objectOutput.writeUTF(StringPool.BLANK);
369                    }
370                    else {
371                            objectOutput.writeUTF(title);
372                    }
373    
374                    if (urlTitle == null) {
375                            objectOutput.writeUTF(StringPool.BLANK);
376                    }
377                    else {
378                            objectOutput.writeUTF(urlTitle);
379                    }
380    
381                    if (description == null) {
382                            objectOutput.writeUTF(StringPool.BLANK);
383                    }
384                    else {
385                            objectOutput.writeUTF(description);
386                    }
387    
388                    if (content == null) {
389                            objectOutput.writeUTF(StringPool.BLANK);
390                    }
391                    else {
392                            objectOutput.writeUTF(content);
393                    }
394    
395                    if (type == null) {
396                            objectOutput.writeUTF(StringPool.BLANK);
397                    }
398                    else {
399                            objectOutput.writeUTF(type);
400                    }
401    
402                    if (structureId == null) {
403                            objectOutput.writeUTF(StringPool.BLANK);
404                    }
405                    else {
406                            objectOutput.writeUTF(structureId);
407                    }
408    
409                    if (templateId == null) {
410                            objectOutput.writeUTF(StringPool.BLANK);
411                    }
412                    else {
413                            objectOutput.writeUTF(templateId);
414                    }
415    
416                    if (layoutUuid == null) {
417                            objectOutput.writeUTF(StringPool.BLANK);
418                    }
419                    else {
420                            objectOutput.writeUTF(layoutUuid);
421                    }
422    
423                    objectOutput.writeLong(displayDate);
424                    objectOutput.writeLong(expirationDate);
425                    objectOutput.writeLong(reviewDate);
426                    objectOutput.writeBoolean(indexable);
427                    objectOutput.writeBoolean(smallImage);
428                    objectOutput.writeLong(smallImageId);
429    
430                    if (smallImageURL == null) {
431                            objectOutput.writeUTF(StringPool.BLANK);
432                    }
433                    else {
434                            objectOutput.writeUTF(smallImageURL);
435                    }
436    
437                    objectOutput.writeInt(status);
438                    objectOutput.writeLong(statusByUserId);
439    
440                    if (statusByUserName == null) {
441                            objectOutput.writeUTF(StringPool.BLANK);
442                    }
443                    else {
444                            objectOutput.writeUTF(statusByUserName);
445                    }
446    
447                    objectOutput.writeLong(statusDate);
448            }
449    
450            public String uuid;
451            public long id;
452            public long resourcePrimKey;
453            public long groupId;
454            public long companyId;
455            public long userId;
456            public String userName;
457            public long createDate;
458            public long modifiedDate;
459            public long folderId;
460            public long classNameId;
461            public long classPK;
462            public String treePath;
463            public String articleId;
464            public double version;
465            public String title;
466            public String urlTitle;
467            public String description;
468            public String content;
469            public String type;
470            public String structureId;
471            public String templateId;
472            public String layoutUuid;
473            public long displayDate;
474            public long expirationDate;
475            public long reviewDate;
476            public boolean indexable;
477            public boolean smallImage;
478            public long smallImageId;
479            public String smallImageURL;
480            public int status;
481            public long statusByUserId;
482            public String statusByUserName;
483            public long statusDate;
484    }