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.asset.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.asset.model.AssetEntry;
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 AssetEntry in entity cache.
034     *
035     * @author Brian Wing Shun Chan
036     * @see AssetEntry
037     * @generated
038     */
039    @ProviderType
040    public class AssetEntryCacheModel implements CacheModel<AssetEntry>,
041            Externalizable {
042            @Override
043            public String toString() {
044                    StringBundler sb = new StringBundler(53);
045    
046                    sb.append("{entryId=");
047                    sb.append(entryId);
048                    sb.append(", groupId=");
049                    sb.append(groupId);
050                    sb.append(", companyId=");
051                    sb.append(companyId);
052                    sb.append(", userId=");
053                    sb.append(userId);
054                    sb.append(", userName=");
055                    sb.append(userName);
056                    sb.append(", createDate=");
057                    sb.append(createDate);
058                    sb.append(", modifiedDate=");
059                    sb.append(modifiedDate);
060                    sb.append(", classNameId=");
061                    sb.append(classNameId);
062                    sb.append(", classPK=");
063                    sb.append(classPK);
064                    sb.append(", classUuid=");
065                    sb.append(classUuid);
066                    sb.append(", classTypeId=");
067                    sb.append(classTypeId);
068                    sb.append(", visible=");
069                    sb.append(visible);
070                    sb.append(", startDate=");
071                    sb.append(startDate);
072                    sb.append(", endDate=");
073                    sb.append(endDate);
074                    sb.append(", publishDate=");
075                    sb.append(publishDate);
076                    sb.append(", expirationDate=");
077                    sb.append(expirationDate);
078                    sb.append(", mimeType=");
079                    sb.append(mimeType);
080                    sb.append(", title=");
081                    sb.append(title);
082                    sb.append(", description=");
083                    sb.append(description);
084                    sb.append(", summary=");
085                    sb.append(summary);
086                    sb.append(", url=");
087                    sb.append(url);
088                    sb.append(", layoutUuid=");
089                    sb.append(layoutUuid);
090                    sb.append(", height=");
091                    sb.append(height);
092                    sb.append(", width=");
093                    sb.append(width);
094                    sb.append(", priority=");
095                    sb.append(priority);
096                    sb.append(", viewCount=");
097                    sb.append(viewCount);
098                    sb.append("}");
099    
100                    return sb.toString();
101            }
102    
103            @Override
104            public AssetEntry toEntityModel() {
105                    AssetEntryImpl assetEntryImpl = new AssetEntryImpl();
106    
107                    assetEntryImpl.setEntryId(entryId);
108                    assetEntryImpl.setGroupId(groupId);
109                    assetEntryImpl.setCompanyId(companyId);
110                    assetEntryImpl.setUserId(userId);
111    
112                    if (userName == null) {
113                            assetEntryImpl.setUserName(StringPool.BLANK);
114                    }
115                    else {
116                            assetEntryImpl.setUserName(userName);
117                    }
118    
119                    if (createDate == Long.MIN_VALUE) {
120                            assetEntryImpl.setCreateDate(null);
121                    }
122                    else {
123                            assetEntryImpl.setCreateDate(new Date(createDate));
124                    }
125    
126                    if (modifiedDate == Long.MIN_VALUE) {
127                            assetEntryImpl.setModifiedDate(null);
128                    }
129                    else {
130                            assetEntryImpl.setModifiedDate(new Date(modifiedDate));
131                    }
132    
133                    assetEntryImpl.setClassNameId(classNameId);
134                    assetEntryImpl.setClassPK(classPK);
135    
136                    if (classUuid == null) {
137                            assetEntryImpl.setClassUuid(StringPool.BLANK);
138                    }
139                    else {
140                            assetEntryImpl.setClassUuid(classUuid);
141                    }
142    
143                    assetEntryImpl.setClassTypeId(classTypeId);
144                    assetEntryImpl.setVisible(visible);
145    
146                    if (startDate == Long.MIN_VALUE) {
147                            assetEntryImpl.setStartDate(null);
148                    }
149                    else {
150                            assetEntryImpl.setStartDate(new Date(startDate));
151                    }
152    
153                    if (endDate == Long.MIN_VALUE) {
154                            assetEntryImpl.setEndDate(null);
155                    }
156                    else {
157                            assetEntryImpl.setEndDate(new Date(endDate));
158                    }
159    
160                    if (publishDate == Long.MIN_VALUE) {
161                            assetEntryImpl.setPublishDate(null);
162                    }
163                    else {
164                            assetEntryImpl.setPublishDate(new Date(publishDate));
165                    }
166    
167                    if (expirationDate == Long.MIN_VALUE) {
168                            assetEntryImpl.setExpirationDate(null);
169                    }
170                    else {
171                            assetEntryImpl.setExpirationDate(new Date(expirationDate));
172                    }
173    
174                    if (mimeType == null) {
175                            assetEntryImpl.setMimeType(StringPool.BLANK);
176                    }
177                    else {
178                            assetEntryImpl.setMimeType(mimeType);
179                    }
180    
181                    if (title == null) {
182                            assetEntryImpl.setTitle(StringPool.BLANK);
183                    }
184                    else {
185                            assetEntryImpl.setTitle(title);
186                    }
187    
188                    if (description == null) {
189                            assetEntryImpl.setDescription(StringPool.BLANK);
190                    }
191                    else {
192                            assetEntryImpl.setDescription(description);
193                    }
194    
195                    if (summary == null) {
196                            assetEntryImpl.setSummary(StringPool.BLANK);
197                    }
198                    else {
199                            assetEntryImpl.setSummary(summary);
200                    }
201    
202                    if (url == null) {
203                            assetEntryImpl.setUrl(StringPool.BLANK);
204                    }
205                    else {
206                            assetEntryImpl.setUrl(url);
207                    }
208    
209                    if (layoutUuid == null) {
210                            assetEntryImpl.setLayoutUuid(StringPool.BLANK);
211                    }
212                    else {
213                            assetEntryImpl.setLayoutUuid(layoutUuid);
214                    }
215    
216                    assetEntryImpl.setHeight(height);
217                    assetEntryImpl.setWidth(width);
218                    assetEntryImpl.setPriority(priority);
219                    assetEntryImpl.setViewCount(viewCount);
220    
221                    assetEntryImpl.resetOriginalValues();
222    
223                    return assetEntryImpl;
224            }
225    
226            @Override
227            public void readExternal(ObjectInput objectInput) throws IOException {
228                    entryId = 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                    classNameId = objectInput.readLong();
236                    classPK = objectInput.readLong();
237                    classUuid = objectInput.readUTF();
238                    classTypeId = objectInput.readLong();
239                    visible = objectInput.readBoolean();
240                    startDate = objectInput.readLong();
241                    endDate = objectInput.readLong();
242                    publishDate = objectInput.readLong();
243                    expirationDate = objectInput.readLong();
244                    mimeType = objectInput.readUTF();
245                    title = objectInput.readUTF();
246                    description = objectInput.readUTF();
247                    summary = objectInput.readUTF();
248                    url = objectInput.readUTF();
249                    layoutUuid = objectInput.readUTF();
250                    height = objectInput.readInt();
251                    width = objectInput.readInt();
252                    priority = objectInput.readDouble();
253                    viewCount = objectInput.readInt();
254            }
255    
256            @Override
257            public void writeExternal(ObjectOutput objectOutput)
258                    throws IOException {
259                    objectOutput.writeLong(entryId);
260                    objectOutput.writeLong(groupId);
261                    objectOutput.writeLong(companyId);
262                    objectOutput.writeLong(userId);
263    
264                    if (userName == null) {
265                            objectOutput.writeUTF(StringPool.BLANK);
266                    }
267                    else {
268                            objectOutput.writeUTF(userName);
269                    }
270    
271                    objectOutput.writeLong(createDate);
272                    objectOutput.writeLong(modifiedDate);
273                    objectOutput.writeLong(classNameId);
274                    objectOutput.writeLong(classPK);
275    
276                    if (classUuid == null) {
277                            objectOutput.writeUTF(StringPool.BLANK);
278                    }
279                    else {
280                            objectOutput.writeUTF(classUuid);
281                    }
282    
283                    objectOutput.writeLong(classTypeId);
284                    objectOutput.writeBoolean(visible);
285                    objectOutput.writeLong(startDate);
286                    objectOutput.writeLong(endDate);
287                    objectOutput.writeLong(publishDate);
288                    objectOutput.writeLong(expirationDate);
289    
290                    if (mimeType == null) {
291                            objectOutput.writeUTF(StringPool.BLANK);
292                    }
293                    else {
294                            objectOutput.writeUTF(mimeType);
295                    }
296    
297                    if (title == null) {
298                            objectOutput.writeUTF(StringPool.BLANK);
299                    }
300                    else {
301                            objectOutput.writeUTF(title);
302                    }
303    
304                    if (description == null) {
305                            objectOutput.writeUTF(StringPool.BLANK);
306                    }
307                    else {
308                            objectOutput.writeUTF(description);
309                    }
310    
311                    if (summary == null) {
312                            objectOutput.writeUTF(StringPool.BLANK);
313                    }
314                    else {
315                            objectOutput.writeUTF(summary);
316                    }
317    
318                    if (url == null) {
319                            objectOutput.writeUTF(StringPool.BLANK);
320                    }
321                    else {
322                            objectOutput.writeUTF(url);
323                    }
324    
325                    if (layoutUuid == null) {
326                            objectOutput.writeUTF(StringPool.BLANK);
327                    }
328                    else {
329                            objectOutput.writeUTF(layoutUuid);
330                    }
331    
332                    objectOutput.writeInt(height);
333                    objectOutput.writeInt(width);
334                    objectOutput.writeDouble(priority);
335                    objectOutput.writeInt(viewCount);
336            }
337    
338            public long entryId;
339            public long groupId;
340            public long companyId;
341            public long userId;
342            public String userName;
343            public long createDate;
344            public long modifiedDate;
345            public long classNameId;
346            public long classPK;
347            public String classUuid;
348            public long classTypeId;
349            public boolean visible;
350            public long startDate;
351            public long endDate;
352            public long publishDate;
353            public long expirationDate;
354            public String mimeType;
355            public String title;
356            public String description;
357            public String summary;
358            public String url;
359            public String layoutUuid;
360            public int height;
361            public int width;
362            public double priority;
363            public int viewCount;
364    }