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.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.CacheModel;
022    
023    import com.liferay.portlet.blogs.model.BlogsEntry;
024    
025    import java.io.Externalizable;
026    import java.io.IOException;
027    import java.io.ObjectInput;
028    import java.io.ObjectOutput;
029    
030    import java.util.Date;
031    
032    /**
033     * The cache model class for representing BlogsEntry in entity cache.
034     *
035     * @author Brian Wing Shun Chan
036     * @see BlogsEntry
037     * @generated
038     */
039    @ProviderType
040    public class BlogsEntryCacheModel implements CacheModel<BlogsEntry>,
041            Externalizable {
042            @Override
043            public String toString() {
044                    StringBundler sb = new StringBundler(51);
045    
046                    sb.append("{uuid=");
047                    sb.append(uuid);
048                    sb.append(", entryId=");
049                    sb.append(entryId);
050                    sb.append(", groupId=");
051                    sb.append(groupId);
052                    sb.append(", companyId=");
053                    sb.append(companyId);
054                    sb.append(", userId=");
055                    sb.append(userId);
056                    sb.append(", userName=");
057                    sb.append(userName);
058                    sb.append(", createDate=");
059                    sb.append(createDate);
060                    sb.append(", modifiedDate=");
061                    sb.append(modifiedDate);
062                    sb.append(", title=");
063                    sb.append(title);
064                    sb.append(", subtitle=");
065                    sb.append(subtitle);
066                    sb.append(", urlTitle=");
067                    sb.append(urlTitle);
068                    sb.append(", description=");
069                    sb.append(description);
070                    sb.append(", content=");
071                    sb.append(content);
072                    sb.append(", displayDate=");
073                    sb.append(displayDate);
074                    sb.append(", allowPingbacks=");
075                    sb.append(allowPingbacks);
076                    sb.append(", allowTrackbacks=");
077                    sb.append(allowTrackbacks);
078                    sb.append(", trackbacks=");
079                    sb.append(trackbacks);
080                    sb.append(", smallImage=");
081                    sb.append(smallImage);
082                    sb.append(", smallImageFileEntryId=");
083                    sb.append(smallImageFileEntryId);
084                    sb.append(", smallImageId=");
085                    sb.append(smallImageId);
086                    sb.append(", smallImageURL=");
087                    sb.append(smallImageURL);
088                    sb.append(", status=");
089                    sb.append(status);
090                    sb.append(", statusByUserId=");
091                    sb.append(statusByUserId);
092                    sb.append(", statusByUserName=");
093                    sb.append(statusByUserName);
094                    sb.append(", statusDate=");
095                    sb.append(statusDate);
096                    sb.append("}");
097    
098                    return sb.toString();
099            }
100    
101            @Override
102            public BlogsEntry toEntityModel() {
103                    BlogsEntryImpl blogsEntryImpl = new BlogsEntryImpl();
104    
105                    if (uuid == null) {
106                            blogsEntryImpl.setUuid(StringPool.BLANK);
107                    }
108                    else {
109                            blogsEntryImpl.setUuid(uuid);
110                    }
111    
112                    blogsEntryImpl.setEntryId(entryId);
113                    blogsEntryImpl.setGroupId(groupId);
114                    blogsEntryImpl.setCompanyId(companyId);
115                    blogsEntryImpl.setUserId(userId);
116    
117                    if (userName == null) {
118                            blogsEntryImpl.setUserName(StringPool.BLANK);
119                    }
120                    else {
121                            blogsEntryImpl.setUserName(userName);
122                    }
123    
124                    if (createDate == Long.MIN_VALUE) {
125                            blogsEntryImpl.setCreateDate(null);
126                    }
127                    else {
128                            blogsEntryImpl.setCreateDate(new Date(createDate));
129                    }
130    
131                    if (modifiedDate == Long.MIN_VALUE) {
132                            blogsEntryImpl.setModifiedDate(null);
133                    }
134                    else {
135                            blogsEntryImpl.setModifiedDate(new Date(modifiedDate));
136                    }
137    
138                    if (title == null) {
139                            blogsEntryImpl.setTitle(StringPool.BLANK);
140                    }
141                    else {
142                            blogsEntryImpl.setTitle(title);
143                    }
144    
145                    if (subtitle == null) {
146                            blogsEntryImpl.setSubtitle(StringPool.BLANK);
147                    }
148                    else {
149                            blogsEntryImpl.setSubtitle(subtitle);
150                    }
151    
152                    if (urlTitle == null) {
153                            blogsEntryImpl.setUrlTitle(StringPool.BLANK);
154                    }
155                    else {
156                            blogsEntryImpl.setUrlTitle(urlTitle);
157                    }
158    
159                    if (description == null) {
160                            blogsEntryImpl.setDescription(StringPool.BLANK);
161                    }
162                    else {
163                            blogsEntryImpl.setDescription(description);
164                    }
165    
166                    if (content == null) {
167                            blogsEntryImpl.setContent(StringPool.BLANK);
168                    }
169                    else {
170                            blogsEntryImpl.setContent(content);
171                    }
172    
173                    if (displayDate == Long.MIN_VALUE) {
174                            blogsEntryImpl.setDisplayDate(null);
175                    }
176                    else {
177                            blogsEntryImpl.setDisplayDate(new Date(displayDate));
178                    }
179    
180                    blogsEntryImpl.setAllowPingbacks(allowPingbacks);
181                    blogsEntryImpl.setAllowTrackbacks(allowTrackbacks);
182    
183                    if (trackbacks == null) {
184                            blogsEntryImpl.setTrackbacks(StringPool.BLANK);
185                    }
186                    else {
187                            blogsEntryImpl.setTrackbacks(trackbacks);
188                    }
189    
190                    blogsEntryImpl.setSmallImage(smallImage);
191                    blogsEntryImpl.setSmallImageFileEntryId(smallImageFileEntryId);
192                    blogsEntryImpl.setSmallImageId(smallImageId);
193    
194                    if (smallImageURL == null) {
195                            blogsEntryImpl.setSmallImageURL(StringPool.BLANK);
196                    }
197                    else {
198                            blogsEntryImpl.setSmallImageURL(smallImageURL);
199                    }
200    
201                    blogsEntryImpl.setStatus(status);
202                    blogsEntryImpl.setStatusByUserId(statusByUserId);
203    
204                    if (statusByUserName == null) {
205                            blogsEntryImpl.setStatusByUserName(StringPool.BLANK);
206                    }
207                    else {
208                            blogsEntryImpl.setStatusByUserName(statusByUserName);
209                    }
210    
211                    if (statusDate == Long.MIN_VALUE) {
212                            blogsEntryImpl.setStatusDate(null);
213                    }
214                    else {
215                            blogsEntryImpl.setStatusDate(new Date(statusDate));
216                    }
217    
218                    blogsEntryImpl.resetOriginalValues();
219    
220                    return blogsEntryImpl;
221            }
222    
223            @Override
224            public void readExternal(ObjectInput objectInput) throws IOException {
225                    uuid = objectInput.readUTF();
226                    entryId = objectInput.readLong();
227                    groupId = objectInput.readLong();
228                    companyId = objectInput.readLong();
229                    userId = objectInput.readLong();
230                    userName = objectInput.readUTF();
231                    createDate = objectInput.readLong();
232                    modifiedDate = objectInput.readLong();
233                    title = objectInput.readUTF();
234                    subtitle = objectInput.readUTF();
235                    urlTitle = objectInput.readUTF();
236                    description = objectInput.readUTF();
237                    content = objectInput.readUTF();
238                    displayDate = objectInput.readLong();
239                    allowPingbacks = objectInput.readBoolean();
240                    allowTrackbacks = objectInput.readBoolean();
241                    trackbacks = objectInput.readUTF();
242                    smallImage = objectInput.readBoolean();
243                    smallImageFileEntryId = objectInput.readLong();
244                    smallImageId = objectInput.readLong();
245                    smallImageURL = objectInput.readUTF();
246                    status = objectInput.readInt();
247                    statusByUserId = objectInput.readLong();
248                    statusByUserName = objectInput.readUTF();
249                    statusDate = objectInput.readLong();
250            }
251    
252            @Override
253            public void writeExternal(ObjectOutput objectOutput)
254                    throws IOException {
255                    if (uuid == null) {
256                            objectOutput.writeUTF(StringPool.BLANK);
257                    }
258                    else {
259                            objectOutput.writeUTF(uuid);
260                    }
261    
262                    objectOutput.writeLong(entryId);
263                    objectOutput.writeLong(groupId);
264                    objectOutput.writeLong(companyId);
265                    objectOutput.writeLong(userId);
266    
267                    if (userName == null) {
268                            objectOutput.writeUTF(StringPool.BLANK);
269                    }
270                    else {
271                            objectOutput.writeUTF(userName);
272                    }
273    
274                    objectOutput.writeLong(createDate);
275                    objectOutput.writeLong(modifiedDate);
276    
277                    if (title == null) {
278                            objectOutput.writeUTF(StringPool.BLANK);
279                    }
280                    else {
281                            objectOutput.writeUTF(title);
282                    }
283    
284                    if (subtitle == null) {
285                            objectOutput.writeUTF(StringPool.BLANK);
286                    }
287                    else {
288                            objectOutput.writeUTF(subtitle);
289                    }
290    
291                    if (urlTitle == null) {
292                            objectOutput.writeUTF(StringPool.BLANK);
293                    }
294                    else {
295                            objectOutput.writeUTF(urlTitle);
296                    }
297    
298                    if (description == null) {
299                            objectOutput.writeUTF(StringPool.BLANK);
300                    }
301                    else {
302                            objectOutput.writeUTF(description);
303                    }
304    
305                    if (content == null) {
306                            objectOutput.writeUTF(StringPool.BLANK);
307                    }
308                    else {
309                            objectOutput.writeUTF(content);
310                    }
311    
312                    objectOutput.writeLong(displayDate);
313                    objectOutput.writeBoolean(allowPingbacks);
314                    objectOutput.writeBoolean(allowTrackbacks);
315    
316                    if (trackbacks == null) {
317                            objectOutput.writeUTF(StringPool.BLANK);
318                    }
319                    else {
320                            objectOutput.writeUTF(trackbacks);
321                    }
322    
323                    objectOutput.writeBoolean(smallImage);
324                    objectOutput.writeLong(smallImageFileEntryId);
325                    objectOutput.writeLong(smallImageId);
326    
327                    if (smallImageURL == null) {
328                            objectOutput.writeUTF(StringPool.BLANK);
329                    }
330                    else {
331                            objectOutput.writeUTF(smallImageURL);
332                    }
333    
334                    objectOutput.writeInt(status);
335                    objectOutput.writeLong(statusByUserId);
336    
337                    if (statusByUserName == null) {
338                            objectOutput.writeUTF(StringPool.BLANK);
339                    }
340                    else {
341                            objectOutput.writeUTF(statusByUserName);
342                    }
343    
344                    objectOutput.writeLong(statusDate);
345            }
346    
347            public String uuid;
348            public long entryId;
349            public long groupId;
350            public long companyId;
351            public long userId;
352            public String userName;
353            public long createDate;
354            public long modifiedDate;
355            public String title;
356            public String subtitle;
357            public String urlTitle;
358            public String description;
359            public String content;
360            public long displayDate;
361            public boolean allowPingbacks;
362            public boolean allowTrackbacks;
363            public String trackbacks;
364            public boolean smallImage;
365            public long smallImageFileEntryId;
366            public long smallImageId;
367            public String smallImageURL;
368            public int status;
369            public long statusByUserId;
370            public String statusByUserName;
371            public long statusDate;
372    }