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