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