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