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.documentlibrary.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.documentlibrary.model.DLFileEntry;
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 DLFileEntry in entity cache.
035     *
036     * @author Brian Wing Shun Chan
037     * @see DLFileEntry
038     * @generated
039     */
040    @ProviderType
041    public class DLFileEntryCacheModel implements CacheModel<DLFileEntry>,
042            Externalizable {
043            @Override
044            public boolean equals(Object obj) {
045                    if (this == obj) {
046                            return true;
047                    }
048    
049                    if (!(obj instanceof DLFileEntryCacheModel)) {
050                            return false;
051                    }
052    
053                    DLFileEntryCacheModel dlFileEntryCacheModel = (DLFileEntryCacheModel)obj;
054    
055                    if (fileEntryId == dlFileEntryCacheModel.fileEntryId) {
056                            return true;
057                    }
058    
059                    return false;
060            }
061    
062            @Override
063            public int hashCode() {
064                    return HashUtil.hash(0, fileEntryId);
065            }
066    
067            @Override
068            public String toString() {
069                    StringBundler sb = new StringBundler(61);
070    
071                    sb.append("{uuid=");
072                    sb.append(uuid);
073                    sb.append(", fileEntryId=");
074                    sb.append(fileEntryId);
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(", classNameId=");
088                    sb.append(classNameId);
089                    sb.append(", classPK=");
090                    sb.append(classPK);
091                    sb.append(", repositoryId=");
092                    sb.append(repositoryId);
093                    sb.append(", folderId=");
094                    sb.append(folderId);
095                    sb.append(", treePath=");
096                    sb.append(treePath);
097                    sb.append(", name=");
098                    sb.append(name);
099                    sb.append(", fileName=");
100                    sb.append(fileName);
101                    sb.append(", extension=");
102                    sb.append(extension);
103                    sb.append(", mimeType=");
104                    sb.append(mimeType);
105                    sb.append(", title=");
106                    sb.append(title);
107                    sb.append(", description=");
108                    sb.append(description);
109                    sb.append(", extraSettings=");
110                    sb.append(extraSettings);
111                    sb.append(", fileEntryTypeId=");
112                    sb.append(fileEntryTypeId);
113                    sb.append(", version=");
114                    sb.append(version);
115                    sb.append(", size=");
116                    sb.append(size);
117                    sb.append(", readCount=");
118                    sb.append(readCount);
119                    sb.append(", smallImageId=");
120                    sb.append(smallImageId);
121                    sb.append(", largeImageId=");
122                    sb.append(largeImageId);
123                    sb.append(", custom1ImageId=");
124                    sb.append(custom1ImageId);
125                    sb.append(", custom2ImageId=");
126                    sb.append(custom2ImageId);
127                    sb.append(", manualCheckInRequired=");
128                    sb.append(manualCheckInRequired);
129                    sb.append(", lastPublishDate=");
130                    sb.append(lastPublishDate);
131                    sb.append("}");
132    
133                    return sb.toString();
134            }
135    
136            @Override
137            public DLFileEntry toEntityModel() {
138                    DLFileEntryImpl dlFileEntryImpl = new DLFileEntryImpl();
139    
140                    if (uuid == null) {
141                            dlFileEntryImpl.setUuid(StringPool.BLANK);
142                    }
143                    else {
144                            dlFileEntryImpl.setUuid(uuid);
145                    }
146    
147                    dlFileEntryImpl.setFileEntryId(fileEntryId);
148                    dlFileEntryImpl.setGroupId(groupId);
149                    dlFileEntryImpl.setCompanyId(companyId);
150                    dlFileEntryImpl.setUserId(userId);
151    
152                    if (userName == null) {
153                            dlFileEntryImpl.setUserName(StringPool.BLANK);
154                    }
155                    else {
156                            dlFileEntryImpl.setUserName(userName);
157                    }
158    
159                    if (createDate == Long.MIN_VALUE) {
160                            dlFileEntryImpl.setCreateDate(null);
161                    }
162                    else {
163                            dlFileEntryImpl.setCreateDate(new Date(createDate));
164                    }
165    
166                    if (modifiedDate == Long.MIN_VALUE) {
167                            dlFileEntryImpl.setModifiedDate(null);
168                    }
169                    else {
170                            dlFileEntryImpl.setModifiedDate(new Date(modifiedDate));
171                    }
172    
173                    dlFileEntryImpl.setClassNameId(classNameId);
174                    dlFileEntryImpl.setClassPK(classPK);
175                    dlFileEntryImpl.setRepositoryId(repositoryId);
176                    dlFileEntryImpl.setFolderId(folderId);
177    
178                    if (treePath == null) {
179                            dlFileEntryImpl.setTreePath(StringPool.BLANK);
180                    }
181                    else {
182                            dlFileEntryImpl.setTreePath(treePath);
183                    }
184    
185                    if (name == null) {
186                            dlFileEntryImpl.setName(StringPool.BLANK);
187                    }
188                    else {
189                            dlFileEntryImpl.setName(name);
190                    }
191    
192                    if (fileName == null) {
193                            dlFileEntryImpl.setFileName(StringPool.BLANK);
194                    }
195                    else {
196                            dlFileEntryImpl.setFileName(fileName);
197                    }
198    
199                    if (extension == null) {
200                            dlFileEntryImpl.setExtension(StringPool.BLANK);
201                    }
202                    else {
203                            dlFileEntryImpl.setExtension(extension);
204                    }
205    
206                    if (mimeType == null) {
207                            dlFileEntryImpl.setMimeType(StringPool.BLANK);
208                    }
209                    else {
210                            dlFileEntryImpl.setMimeType(mimeType);
211                    }
212    
213                    if (title == null) {
214                            dlFileEntryImpl.setTitle(StringPool.BLANK);
215                    }
216                    else {
217                            dlFileEntryImpl.setTitle(title);
218                    }
219    
220                    if (description == null) {
221                            dlFileEntryImpl.setDescription(StringPool.BLANK);
222                    }
223                    else {
224                            dlFileEntryImpl.setDescription(description);
225                    }
226    
227                    if (extraSettings == null) {
228                            dlFileEntryImpl.setExtraSettings(StringPool.BLANK);
229                    }
230                    else {
231                            dlFileEntryImpl.setExtraSettings(extraSettings);
232                    }
233    
234                    dlFileEntryImpl.setFileEntryTypeId(fileEntryTypeId);
235    
236                    if (version == null) {
237                            dlFileEntryImpl.setVersion(StringPool.BLANK);
238                    }
239                    else {
240                            dlFileEntryImpl.setVersion(version);
241                    }
242    
243                    dlFileEntryImpl.setSize(size);
244                    dlFileEntryImpl.setReadCount(readCount);
245                    dlFileEntryImpl.setSmallImageId(smallImageId);
246                    dlFileEntryImpl.setLargeImageId(largeImageId);
247                    dlFileEntryImpl.setCustom1ImageId(custom1ImageId);
248                    dlFileEntryImpl.setCustom2ImageId(custom2ImageId);
249                    dlFileEntryImpl.setManualCheckInRequired(manualCheckInRequired);
250    
251                    if (lastPublishDate == Long.MIN_VALUE) {
252                            dlFileEntryImpl.setLastPublishDate(null);
253                    }
254                    else {
255                            dlFileEntryImpl.setLastPublishDate(new Date(lastPublishDate));
256                    }
257    
258                    dlFileEntryImpl.resetOriginalValues();
259    
260                    return dlFileEntryImpl;
261            }
262    
263            @Override
264            public void readExternal(ObjectInput objectInput) throws IOException {
265                    uuid = objectInput.readUTF();
266                    fileEntryId = objectInput.readLong();
267                    groupId = objectInput.readLong();
268                    companyId = objectInput.readLong();
269                    userId = objectInput.readLong();
270                    userName = objectInput.readUTF();
271                    createDate = objectInput.readLong();
272                    modifiedDate = objectInput.readLong();
273                    classNameId = objectInput.readLong();
274                    classPK = objectInput.readLong();
275                    repositoryId = objectInput.readLong();
276                    folderId = objectInput.readLong();
277                    treePath = objectInput.readUTF();
278                    name = objectInput.readUTF();
279                    fileName = objectInput.readUTF();
280                    extension = objectInput.readUTF();
281                    mimeType = objectInput.readUTF();
282                    title = objectInput.readUTF();
283                    description = objectInput.readUTF();
284                    extraSettings = objectInput.readUTF();
285                    fileEntryTypeId = objectInput.readLong();
286                    version = objectInput.readUTF();
287                    size = objectInput.readLong();
288                    readCount = objectInput.readInt();
289                    smallImageId = objectInput.readLong();
290                    largeImageId = objectInput.readLong();
291                    custom1ImageId = objectInput.readLong();
292                    custom2ImageId = objectInput.readLong();
293                    manualCheckInRequired = objectInput.readBoolean();
294                    lastPublishDate = objectInput.readLong();
295            }
296    
297            @Override
298            public void writeExternal(ObjectOutput objectOutput)
299                    throws IOException {
300                    if (uuid == null) {
301                            objectOutput.writeUTF(StringPool.BLANK);
302                    }
303                    else {
304                            objectOutput.writeUTF(uuid);
305                    }
306    
307                    objectOutput.writeLong(fileEntryId);
308                    objectOutput.writeLong(groupId);
309                    objectOutput.writeLong(companyId);
310                    objectOutput.writeLong(userId);
311    
312                    if (userName == null) {
313                            objectOutput.writeUTF(StringPool.BLANK);
314                    }
315                    else {
316                            objectOutput.writeUTF(userName);
317                    }
318    
319                    objectOutput.writeLong(createDate);
320                    objectOutput.writeLong(modifiedDate);
321                    objectOutput.writeLong(classNameId);
322                    objectOutput.writeLong(classPK);
323                    objectOutput.writeLong(repositoryId);
324                    objectOutput.writeLong(folderId);
325    
326                    if (treePath == null) {
327                            objectOutput.writeUTF(StringPool.BLANK);
328                    }
329                    else {
330                            objectOutput.writeUTF(treePath);
331                    }
332    
333                    if (name == null) {
334                            objectOutput.writeUTF(StringPool.BLANK);
335                    }
336                    else {
337                            objectOutput.writeUTF(name);
338                    }
339    
340                    if (fileName == null) {
341                            objectOutput.writeUTF(StringPool.BLANK);
342                    }
343                    else {
344                            objectOutput.writeUTF(fileName);
345                    }
346    
347                    if (extension == null) {
348                            objectOutput.writeUTF(StringPool.BLANK);
349                    }
350                    else {
351                            objectOutput.writeUTF(extension);
352                    }
353    
354                    if (mimeType == null) {
355                            objectOutput.writeUTF(StringPool.BLANK);
356                    }
357                    else {
358                            objectOutput.writeUTF(mimeType);
359                    }
360    
361                    if (title == null) {
362                            objectOutput.writeUTF(StringPool.BLANK);
363                    }
364                    else {
365                            objectOutput.writeUTF(title);
366                    }
367    
368                    if (description == null) {
369                            objectOutput.writeUTF(StringPool.BLANK);
370                    }
371                    else {
372                            objectOutput.writeUTF(description);
373                    }
374    
375                    if (extraSettings == null) {
376                            objectOutput.writeUTF(StringPool.BLANK);
377                    }
378                    else {
379                            objectOutput.writeUTF(extraSettings);
380                    }
381    
382                    objectOutput.writeLong(fileEntryTypeId);
383    
384                    if (version == null) {
385                            objectOutput.writeUTF(StringPool.BLANK);
386                    }
387                    else {
388                            objectOutput.writeUTF(version);
389                    }
390    
391                    objectOutput.writeLong(size);
392                    objectOutput.writeInt(readCount);
393                    objectOutput.writeLong(smallImageId);
394                    objectOutput.writeLong(largeImageId);
395                    objectOutput.writeLong(custom1ImageId);
396                    objectOutput.writeLong(custom2ImageId);
397                    objectOutput.writeBoolean(manualCheckInRequired);
398                    objectOutput.writeLong(lastPublishDate);
399            }
400    
401            public String uuid;
402            public long fileEntryId;
403            public long groupId;
404            public long companyId;
405            public long userId;
406            public String userName;
407            public long createDate;
408            public long modifiedDate;
409            public long classNameId;
410            public long classPK;
411            public long repositoryId;
412            public long folderId;
413            public String treePath;
414            public String name;
415            public String fileName;
416            public String extension;
417            public String mimeType;
418            public String title;
419            public String description;
420            public String extraSettings;
421            public long fileEntryTypeId;
422            public String version;
423            public long size;
424            public int readCount;
425            public long smallImageId;
426            public long largeImageId;
427            public long custom1ImageId;
428            public long custom2ImageId;
429            public boolean manualCheckInRequired;
430            public long lastPublishDate;
431    }