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.blogs.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.blogs.model.BlogsEntry;
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 BlogsEntry in entity cache.
035     *
036     * @author Brian Wing Shun Chan
037     * @see BlogsEntry
038     * @generated
039     */
040    @ProviderType
041    public class BlogsEntryCacheModel implements CacheModel<BlogsEntry>,
042            Externalizable {
043            @Override
044            public boolean equals(Object obj) {
045                    if (this == obj) {
046                            return true;
047                    }
048    
049                    if (!(obj instanceof BlogsEntryCacheModel)) {
050                            return false;
051                    }
052    
053                    BlogsEntryCacheModel blogsEntryCacheModel = (BlogsEntryCacheModel)obj;
054    
055                    if (entryId == blogsEntryCacheModel.entryId) {
056                            return true;
057                    }
058    
059                    return false;
060            }
061    
062            @Override
063            public int hashCode() {
064                    return HashUtil.hash(0, entryId);
065            }
066    
067            @Override
068            public String toString() {
069                    StringBundler sb = new StringBundler(59);
070    
071                    sb.append("{uuid=");
072                    sb.append(uuid);
073                    sb.append(", entryId=");
074                    sb.append(entryId);
075                    sb.append(", groupId=");
076                    sb.append(groupId);
077                    sb.append(", companyId=");
078                    sb.append(companyId);
079                    sb.append(", userId=");
080                    sb.append(userId);
081                    sb.append(", userName=");
082                    sb.append(userName);
083                    sb.append(", createDate=");
084                    sb.append(createDate);
085                    sb.append(", modifiedDate=");
086                    sb.append(modifiedDate);
087                    sb.append(", title=");
088                    sb.append(title);
089                    sb.append(", subtitle=");
090                    sb.append(subtitle);
091                    sb.append(", urlTitle=");
092                    sb.append(urlTitle);
093                    sb.append(", description=");
094                    sb.append(description);
095                    sb.append(", content=");
096                    sb.append(content);
097                    sb.append(", displayDate=");
098                    sb.append(displayDate);
099                    sb.append(", allowPingbacks=");
100                    sb.append(allowPingbacks);
101                    sb.append(", allowTrackbacks=");
102                    sb.append(allowTrackbacks);
103                    sb.append(", trackbacks=");
104                    sb.append(trackbacks);
105                    sb.append(", coverImageCaption=");
106                    sb.append(coverImageCaption);
107                    sb.append(", coverImageFileEntryId=");
108                    sb.append(coverImageFileEntryId);
109                    sb.append(", coverImageURL=");
110                    sb.append(coverImageURL);
111                    sb.append(", smallImage=");
112                    sb.append(smallImage);
113                    sb.append(", smallImageFileEntryId=");
114                    sb.append(smallImageFileEntryId);
115                    sb.append(", smallImageId=");
116                    sb.append(smallImageId);
117                    sb.append(", smallImageURL=");
118                    sb.append(smallImageURL);
119                    sb.append(", lastPublishDate=");
120                    sb.append(lastPublishDate);
121                    sb.append(", status=");
122                    sb.append(status);
123                    sb.append(", statusByUserId=");
124                    sb.append(statusByUserId);
125                    sb.append(", statusByUserName=");
126                    sb.append(statusByUserName);
127                    sb.append(", statusDate=");
128                    sb.append(statusDate);
129                    sb.append("}");
130    
131                    return sb.toString();
132            }
133    
134            @Override
135            public BlogsEntry toEntityModel() {
136                    BlogsEntryImpl blogsEntryImpl = new BlogsEntryImpl();
137    
138                    if (uuid == null) {
139                            blogsEntryImpl.setUuid(StringPool.BLANK);
140                    }
141                    else {
142                            blogsEntryImpl.setUuid(uuid);
143                    }
144    
145                    blogsEntryImpl.setEntryId(entryId);
146                    blogsEntryImpl.setGroupId(groupId);
147                    blogsEntryImpl.setCompanyId(companyId);
148                    blogsEntryImpl.setUserId(userId);
149    
150                    if (userName == null) {
151                            blogsEntryImpl.setUserName(StringPool.BLANK);
152                    }
153                    else {
154                            blogsEntryImpl.setUserName(userName);
155                    }
156    
157                    if (createDate == Long.MIN_VALUE) {
158                            blogsEntryImpl.setCreateDate(null);
159                    }
160                    else {
161                            blogsEntryImpl.setCreateDate(new Date(createDate));
162                    }
163    
164                    if (modifiedDate == Long.MIN_VALUE) {
165                            blogsEntryImpl.setModifiedDate(null);
166                    }
167                    else {
168                            blogsEntryImpl.setModifiedDate(new Date(modifiedDate));
169                    }
170    
171                    if (title == null) {
172                            blogsEntryImpl.setTitle(StringPool.BLANK);
173                    }
174                    else {
175                            blogsEntryImpl.setTitle(title);
176                    }
177    
178                    if (subtitle == null) {
179                            blogsEntryImpl.setSubtitle(StringPool.BLANK);
180                    }
181                    else {
182                            blogsEntryImpl.setSubtitle(subtitle);
183                    }
184    
185                    if (urlTitle == null) {
186                            blogsEntryImpl.setUrlTitle(StringPool.BLANK);
187                    }
188                    else {
189                            blogsEntryImpl.setUrlTitle(urlTitle);
190                    }
191    
192                    if (description == null) {
193                            blogsEntryImpl.setDescription(StringPool.BLANK);
194                    }
195                    else {
196                            blogsEntryImpl.setDescription(description);
197                    }
198    
199                    if (content == null) {
200                            blogsEntryImpl.setContent(StringPool.BLANK);
201                    }
202                    else {
203                            blogsEntryImpl.setContent(content);
204                    }
205    
206                    if (displayDate == Long.MIN_VALUE) {
207                            blogsEntryImpl.setDisplayDate(null);
208                    }
209                    else {
210                            blogsEntryImpl.setDisplayDate(new Date(displayDate));
211                    }
212    
213                    blogsEntryImpl.setAllowPingbacks(allowPingbacks);
214                    blogsEntryImpl.setAllowTrackbacks(allowTrackbacks);
215    
216                    if (trackbacks == null) {
217                            blogsEntryImpl.setTrackbacks(StringPool.BLANK);
218                    }
219                    else {
220                            blogsEntryImpl.setTrackbacks(trackbacks);
221                    }
222    
223                    if (coverImageCaption == null) {
224                            blogsEntryImpl.setCoverImageCaption(StringPool.BLANK);
225                    }
226                    else {
227                            blogsEntryImpl.setCoverImageCaption(coverImageCaption);
228                    }
229    
230                    blogsEntryImpl.setCoverImageFileEntryId(coverImageFileEntryId);
231    
232                    if (coverImageURL == null) {
233                            blogsEntryImpl.setCoverImageURL(StringPool.BLANK);
234                    }
235                    else {
236                            blogsEntryImpl.setCoverImageURL(coverImageURL);
237                    }
238    
239                    blogsEntryImpl.setSmallImage(smallImage);
240                    blogsEntryImpl.setSmallImageFileEntryId(smallImageFileEntryId);
241                    blogsEntryImpl.setSmallImageId(smallImageId);
242    
243                    if (smallImageURL == null) {
244                            blogsEntryImpl.setSmallImageURL(StringPool.BLANK);
245                    }
246                    else {
247                            blogsEntryImpl.setSmallImageURL(smallImageURL);
248                    }
249    
250                    if (lastPublishDate == Long.MIN_VALUE) {
251                            blogsEntryImpl.setLastPublishDate(null);
252                    }
253                    else {
254                            blogsEntryImpl.setLastPublishDate(new Date(lastPublishDate));
255                    }
256    
257                    blogsEntryImpl.setStatus(status);
258                    blogsEntryImpl.setStatusByUserId(statusByUserId);
259    
260                    if (statusByUserName == null) {
261                            blogsEntryImpl.setStatusByUserName(StringPool.BLANK);
262                    }
263                    else {
264                            blogsEntryImpl.setStatusByUserName(statusByUserName);
265                    }
266    
267                    if (statusDate == Long.MIN_VALUE) {
268                            blogsEntryImpl.setStatusDate(null);
269                    }
270                    else {
271                            blogsEntryImpl.setStatusDate(new Date(statusDate));
272                    }
273    
274                    blogsEntryImpl.resetOriginalValues();
275    
276                    return blogsEntryImpl;
277            }
278    
279            @Override
280            public void readExternal(ObjectInput objectInput) throws IOException {
281                    uuid = objectInput.readUTF();
282                    entryId = objectInput.readLong();
283                    groupId = objectInput.readLong();
284                    companyId = objectInput.readLong();
285                    userId = objectInput.readLong();
286                    userName = objectInput.readUTF();
287                    createDate = objectInput.readLong();
288                    modifiedDate = objectInput.readLong();
289                    title = objectInput.readUTF();
290                    subtitle = objectInput.readUTF();
291                    urlTitle = objectInput.readUTF();
292                    description = objectInput.readUTF();
293                    content = objectInput.readUTF();
294                    displayDate = objectInput.readLong();
295                    allowPingbacks = objectInput.readBoolean();
296                    allowTrackbacks = objectInput.readBoolean();
297                    trackbacks = objectInput.readUTF();
298                    coverImageCaption = objectInput.readUTF();
299                    coverImageFileEntryId = objectInput.readLong();
300                    coverImageURL = objectInput.readUTF();
301                    smallImage = objectInput.readBoolean();
302                    smallImageFileEntryId = objectInput.readLong();
303                    smallImageId = objectInput.readLong();
304                    smallImageURL = objectInput.readUTF();
305                    lastPublishDate = objectInput.readLong();
306                    status = objectInput.readInt();
307                    statusByUserId = objectInput.readLong();
308                    statusByUserName = objectInput.readUTF();
309                    statusDate = objectInput.readLong();
310            }
311    
312            @Override
313            public void writeExternal(ObjectOutput objectOutput)
314                    throws IOException {
315                    if (uuid == null) {
316                            objectOutput.writeUTF(StringPool.BLANK);
317                    }
318                    else {
319                            objectOutput.writeUTF(uuid);
320                    }
321    
322                    objectOutput.writeLong(entryId);
323                    objectOutput.writeLong(groupId);
324                    objectOutput.writeLong(companyId);
325                    objectOutput.writeLong(userId);
326    
327                    if (userName == null) {
328                            objectOutput.writeUTF(StringPool.BLANK);
329                    }
330                    else {
331                            objectOutput.writeUTF(userName);
332                    }
333    
334                    objectOutput.writeLong(createDate);
335                    objectOutput.writeLong(modifiedDate);
336    
337                    if (title == null) {
338                            objectOutput.writeUTF(StringPool.BLANK);
339                    }
340                    else {
341                            objectOutput.writeUTF(title);
342                    }
343    
344                    if (subtitle == null) {
345                            objectOutput.writeUTF(StringPool.BLANK);
346                    }
347                    else {
348                            objectOutput.writeUTF(subtitle);
349                    }
350    
351                    if (urlTitle == null) {
352                            objectOutput.writeUTF(StringPool.BLANK);
353                    }
354                    else {
355                            objectOutput.writeUTF(urlTitle);
356                    }
357    
358                    if (description == null) {
359                            objectOutput.writeUTF(StringPool.BLANK);
360                    }
361                    else {
362                            objectOutput.writeUTF(description);
363                    }
364    
365                    if (content == null) {
366                            objectOutput.writeUTF(StringPool.BLANK);
367                    }
368                    else {
369                            objectOutput.writeUTF(content);
370                    }
371    
372                    objectOutput.writeLong(displayDate);
373                    objectOutput.writeBoolean(allowPingbacks);
374                    objectOutput.writeBoolean(allowTrackbacks);
375    
376                    if (trackbacks == null) {
377                            objectOutput.writeUTF(StringPool.BLANK);
378                    }
379                    else {
380                            objectOutput.writeUTF(trackbacks);
381                    }
382    
383                    if (coverImageCaption == null) {
384                            objectOutput.writeUTF(StringPool.BLANK);
385                    }
386                    else {
387                            objectOutput.writeUTF(coverImageCaption);
388                    }
389    
390                    objectOutput.writeLong(coverImageFileEntryId);
391    
392                    if (coverImageURL == null) {
393                            objectOutput.writeUTF(StringPool.BLANK);
394                    }
395                    else {
396                            objectOutput.writeUTF(coverImageURL);
397                    }
398    
399                    objectOutput.writeBoolean(smallImage);
400                    objectOutput.writeLong(smallImageFileEntryId);
401                    objectOutput.writeLong(smallImageId);
402    
403                    if (smallImageURL == null) {
404                            objectOutput.writeUTF(StringPool.BLANK);
405                    }
406                    else {
407                            objectOutput.writeUTF(smallImageURL);
408                    }
409    
410                    objectOutput.writeLong(lastPublishDate);
411                    objectOutput.writeInt(status);
412                    objectOutput.writeLong(statusByUserId);
413    
414                    if (statusByUserName == null) {
415                            objectOutput.writeUTF(StringPool.BLANK);
416                    }
417                    else {
418                            objectOutput.writeUTF(statusByUserName);
419                    }
420    
421                    objectOutput.writeLong(statusDate);
422            }
423    
424            public String uuid;
425            public long entryId;
426            public long groupId;
427            public long companyId;
428            public long userId;
429            public String userName;
430            public long createDate;
431            public long modifiedDate;
432            public String title;
433            public String subtitle;
434            public String urlTitle;
435            public String description;
436            public String content;
437            public long displayDate;
438            public boolean allowPingbacks;
439            public boolean allowTrackbacks;
440            public String trackbacks;
441            public String coverImageCaption;
442            public long coverImageFileEntryId;
443            public String coverImageURL;
444            public boolean smallImage;
445            public long smallImageFileEntryId;
446            public long smallImageId;
447            public String smallImageURL;
448            public long lastPublishDate;
449            public int status;
450            public long statusByUserId;
451            public String statusByUserName;
452            public long statusDate;
453    }