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