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.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.CacheModel;
022    
023    import com.liferay.portlet.journal.model.JournalFeed;
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 JournalFeed in entity cache.
034     *
035     * @author Brian Wing Shun Chan
036     * @see JournalFeed
037     * @generated
038     */
039    @ProviderType
040    public class JournalFeedCacheModel implements CacheModel<JournalFeed>,
041            Externalizable {
042            @Override
043            public String toString() {
044                    StringBundler sb = new StringBundler(45);
045    
046                    sb.append("{uuid=");
047                    sb.append(uuid);
048                    sb.append(", id=");
049                    sb.append(id);
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(", feedId=");
063                    sb.append(feedId);
064                    sb.append(", name=");
065                    sb.append(name);
066                    sb.append(", description=");
067                    sb.append(description);
068                    sb.append(", DDMStructureKey=");
069                    sb.append(DDMStructureKey);
070                    sb.append(", DDMTemplateKey=");
071                    sb.append(DDMTemplateKey);
072                    sb.append(", DDMRendererTemplateKey=");
073                    sb.append(DDMRendererTemplateKey);
074                    sb.append(", delta=");
075                    sb.append(delta);
076                    sb.append(", orderByCol=");
077                    sb.append(orderByCol);
078                    sb.append(", orderByType=");
079                    sb.append(orderByType);
080                    sb.append(", targetLayoutFriendlyUrl=");
081                    sb.append(targetLayoutFriendlyUrl);
082                    sb.append(", targetPortletId=");
083                    sb.append(targetPortletId);
084                    sb.append(", contentField=");
085                    sb.append(contentField);
086                    sb.append(", feedFormat=");
087                    sb.append(feedFormat);
088                    sb.append(", feedVersion=");
089                    sb.append(feedVersion);
090                    sb.append("}");
091    
092                    return sb.toString();
093            }
094    
095            @Override
096            public JournalFeed toEntityModel() {
097                    JournalFeedImpl journalFeedImpl = new JournalFeedImpl();
098    
099                    if (uuid == null) {
100                            journalFeedImpl.setUuid(StringPool.BLANK);
101                    }
102                    else {
103                            journalFeedImpl.setUuid(uuid);
104                    }
105    
106                    journalFeedImpl.setId(id);
107                    journalFeedImpl.setGroupId(groupId);
108                    journalFeedImpl.setCompanyId(companyId);
109                    journalFeedImpl.setUserId(userId);
110    
111                    if (userName == null) {
112                            journalFeedImpl.setUserName(StringPool.BLANK);
113                    }
114                    else {
115                            journalFeedImpl.setUserName(userName);
116                    }
117    
118                    if (createDate == Long.MIN_VALUE) {
119                            journalFeedImpl.setCreateDate(null);
120                    }
121                    else {
122                            journalFeedImpl.setCreateDate(new Date(createDate));
123                    }
124    
125                    if (modifiedDate == Long.MIN_VALUE) {
126                            journalFeedImpl.setModifiedDate(null);
127                    }
128                    else {
129                            journalFeedImpl.setModifiedDate(new Date(modifiedDate));
130                    }
131    
132                    if (feedId == null) {
133                            journalFeedImpl.setFeedId(StringPool.BLANK);
134                    }
135                    else {
136                            journalFeedImpl.setFeedId(feedId);
137                    }
138    
139                    if (name == null) {
140                            journalFeedImpl.setName(StringPool.BLANK);
141                    }
142                    else {
143                            journalFeedImpl.setName(name);
144                    }
145    
146                    if (description == null) {
147                            journalFeedImpl.setDescription(StringPool.BLANK);
148                    }
149                    else {
150                            journalFeedImpl.setDescription(description);
151                    }
152    
153                    if (DDMStructureKey == null) {
154                            journalFeedImpl.setDDMStructureKey(StringPool.BLANK);
155                    }
156                    else {
157                            journalFeedImpl.setDDMStructureKey(DDMStructureKey);
158                    }
159    
160                    if (DDMTemplateKey == null) {
161                            journalFeedImpl.setDDMTemplateKey(StringPool.BLANK);
162                    }
163                    else {
164                            journalFeedImpl.setDDMTemplateKey(DDMTemplateKey);
165                    }
166    
167                    if (DDMRendererTemplateKey == null) {
168                            journalFeedImpl.setDDMRendererTemplateKey(StringPool.BLANK);
169                    }
170                    else {
171                            journalFeedImpl.setDDMRendererTemplateKey(DDMRendererTemplateKey);
172                    }
173    
174                    journalFeedImpl.setDelta(delta);
175    
176                    if (orderByCol == null) {
177                            journalFeedImpl.setOrderByCol(StringPool.BLANK);
178                    }
179                    else {
180                            journalFeedImpl.setOrderByCol(orderByCol);
181                    }
182    
183                    if (orderByType == null) {
184                            journalFeedImpl.setOrderByType(StringPool.BLANK);
185                    }
186                    else {
187                            journalFeedImpl.setOrderByType(orderByType);
188                    }
189    
190                    if (targetLayoutFriendlyUrl == null) {
191                            journalFeedImpl.setTargetLayoutFriendlyUrl(StringPool.BLANK);
192                    }
193                    else {
194                            journalFeedImpl.setTargetLayoutFriendlyUrl(targetLayoutFriendlyUrl);
195                    }
196    
197                    if (targetPortletId == null) {
198                            journalFeedImpl.setTargetPortletId(StringPool.BLANK);
199                    }
200                    else {
201                            journalFeedImpl.setTargetPortletId(targetPortletId);
202                    }
203    
204                    if (contentField == null) {
205                            journalFeedImpl.setContentField(StringPool.BLANK);
206                    }
207                    else {
208                            journalFeedImpl.setContentField(contentField);
209                    }
210    
211                    if (feedFormat == null) {
212                            journalFeedImpl.setFeedFormat(StringPool.BLANK);
213                    }
214                    else {
215                            journalFeedImpl.setFeedFormat(feedFormat);
216                    }
217    
218                    journalFeedImpl.setFeedVersion(feedVersion);
219    
220                    journalFeedImpl.resetOriginalValues();
221    
222                    return journalFeedImpl;
223            }
224    
225            @Override
226            public void readExternal(ObjectInput objectInput) throws IOException {
227                    uuid = objectInput.readUTF();
228                    id = objectInput.readLong();
229                    groupId = objectInput.readLong();
230                    companyId = objectInput.readLong();
231                    userId = objectInput.readLong();
232                    userName = objectInput.readUTF();
233                    createDate = objectInput.readLong();
234                    modifiedDate = objectInput.readLong();
235                    feedId = objectInput.readUTF();
236                    name = objectInput.readUTF();
237                    description = objectInput.readUTF();
238                    DDMStructureKey = objectInput.readUTF();
239                    DDMTemplateKey = objectInput.readUTF();
240                    DDMRendererTemplateKey = objectInput.readUTF();
241                    delta = objectInput.readInt();
242                    orderByCol = objectInput.readUTF();
243                    orderByType = objectInput.readUTF();
244                    targetLayoutFriendlyUrl = objectInput.readUTF();
245                    targetPortletId = objectInput.readUTF();
246                    contentField = objectInput.readUTF();
247                    feedFormat = objectInput.readUTF();
248                    feedVersion = objectInput.readDouble();
249            }
250    
251            @Override
252            public void writeExternal(ObjectOutput objectOutput)
253                    throws IOException {
254                    if (uuid == null) {
255                            objectOutput.writeUTF(StringPool.BLANK);
256                    }
257                    else {
258                            objectOutput.writeUTF(uuid);
259                    }
260    
261                    objectOutput.writeLong(id);
262                    objectOutput.writeLong(groupId);
263                    objectOutput.writeLong(companyId);
264                    objectOutput.writeLong(userId);
265    
266                    if (userName == null) {
267                            objectOutput.writeUTF(StringPool.BLANK);
268                    }
269                    else {
270                            objectOutput.writeUTF(userName);
271                    }
272    
273                    objectOutput.writeLong(createDate);
274                    objectOutput.writeLong(modifiedDate);
275    
276                    if (feedId == null) {
277                            objectOutput.writeUTF(StringPool.BLANK);
278                    }
279                    else {
280                            objectOutput.writeUTF(feedId);
281                    }
282    
283                    if (name == null) {
284                            objectOutput.writeUTF(StringPool.BLANK);
285                    }
286                    else {
287                            objectOutput.writeUTF(name);
288                    }
289    
290                    if (description == null) {
291                            objectOutput.writeUTF(StringPool.BLANK);
292                    }
293                    else {
294                            objectOutput.writeUTF(description);
295                    }
296    
297                    if (DDMStructureKey == null) {
298                            objectOutput.writeUTF(StringPool.BLANK);
299                    }
300                    else {
301                            objectOutput.writeUTF(DDMStructureKey);
302                    }
303    
304                    if (DDMTemplateKey == null) {
305                            objectOutput.writeUTF(StringPool.BLANK);
306                    }
307                    else {
308                            objectOutput.writeUTF(DDMTemplateKey);
309                    }
310    
311                    if (DDMRendererTemplateKey == null) {
312                            objectOutput.writeUTF(StringPool.BLANK);
313                    }
314                    else {
315                            objectOutput.writeUTF(DDMRendererTemplateKey);
316                    }
317    
318                    objectOutput.writeInt(delta);
319    
320                    if (orderByCol == null) {
321                            objectOutput.writeUTF(StringPool.BLANK);
322                    }
323                    else {
324                            objectOutput.writeUTF(orderByCol);
325                    }
326    
327                    if (orderByType == null) {
328                            objectOutput.writeUTF(StringPool.BLANK);
329                    }
330                    else {
331                            objectOutput.writeUTF(orderByType);
332                    }
333    
334                    if (targetLayoutFriendlyUrl == null) {
335                            objectOutput.writeUTF(StringPool.BLANK);
336                    }
337                    else {
338                            objectOutput.writeUTF(targetLayoutFriendlyUrl);
339                    }
340    
341                    if (targetPortletId == null) {
342                            objectOutput.writeUTF(StringPool.BLANK);
343                    }
344                    else {
345                            objectOutput.writeUTF(targetPortletId);
346                    }
347    
348                    if (contentField == null) {
349                            objectOutput.writeUTF(StringPool.BLANK);
350                    }
351                    else {
352                            objectOutput.writeUTF(contentField);
353                    }
354    
355                    if (feedFormat == null) {
356                            objectOutput.writeUTF(StringPool.BLANK);
357                    }
358                    else {
359                            objectOutput.writeUTF(feedFormat);
360                    }
361    
362                    objectOutput.writeDouble(feedVersion);
363            }
364    
365            public String uuid;
366            public long id;
367            public long groupId;
368            public long companyId;
369            public long userId;
370            public String userName;
371            public long createDate;
372            public long modifiedDate;
373            public String feedId;
374            public String name;
375            public String description;
376            public String DDMStructureKey;
377            public String DDMTemplateKey;
378            public String DDMRendererTemplateKey;
379            public int delta;
380            public String orderByCol;
381            public String orderByType;
382            public String targetLayoutFriendlyUrl;
383            public String targetPortletId;
384            public String contentField;
385            public String feedFormat;
386            public double feedVersion;
387    }