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