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.DLFileVersion;
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                    fileVersionId = objectInput.readLong();
280                    groupId = objectInput.readLong();
281                    companyId = objectInput.readLong();
282                    userId = objectInput.readLong();
283                    userName = objectInput.readUTF();
284                    createDate = objectInput.readLong();
285                    modifiedDate = objectInput.readLong();
286                    repositoryId = objectInput.readLong();
287                    folderId = objectInput.readLong();
288                    fileEntryId = objectInput.readLong();
289                    treePath = objectInput.readUTF();
290                    fileName = objectInput.readUTF();
291                    extension = objectInput.readUTF();
292                    mimeType = objectInput.readUTF();
293                    title = objectInput.readUTF();
294                    description = objectInput.readUTF();
295                    changeLog = objectInput.readUTF();
296                    extraSettings = objectInput.readUTF();
297                    fileEntryTypeId = objectInput.readLong();
298                    version = objectInput.readUTF();
299                    size = objectInput.readLong();
300                    checksum = objectInput.readUTF();
301                    lastPublishDate = objectInput.readLong();
302                    status = objectInput.readInt();
303                    statusByUserId = objectInput.readLong();
304                    statusByUserName = objectInput.readUTF();
305                    statusDate = objectInput.readLong();
306            }
307    
308            @Override
309            public void writeExternal(ObjectOutput objectOutput)
310                    throws IOException {
311                    if (uuid == null) {
312                            objectOutput.writeUTF(StringPool.BLANK);
313                    }
314                    else {
315                            objectOutput.writeUTF(uuid);
316                    }
317    
318                    objectOutput.writeLong(fileVersionId);
319                    objectOutput.writeLong(groupId);
320                    objectOutput.writeLong(companyId);
321                    objectOutput.writeLong(userId);
322    
323                    if (userName == null) {
324                            objectOutput.writeUTF(StringPool.BLANK);
325                    }
326                    else {
327                            objectOutput.writeUTF(userName);
328                    }
329    
330                    objectOutput.writeLong(createDate);
331                    objectOutput.writeLong(modifiedDate);
332                    objectOutput.writeLong(repositoryId);
333                    objectOutput.writeLong(folderId);
334                    objectOutput.writeLong(fileEntryId);
335    
336                    if (treePath == null) {
337                            objectOutput.writeUTF(StringPool.BLANK);
338                    }
339                    else {
340                            objectOutput.writeUTF(treePath);
341                    }
342    
343                    if (fileName == null) {
344                            objectOutput.writeUTF(StringPool.BLANK);
345                    }
346                    else {
347                            objectOutput.writeUTF(fileName);
348                    }
349    
350                    if (extension == null) {
351                            objectOutput.writeUTF(StringPool.BLANK);
352                    }
353                    else {
354                            objectOutput.writeUTF(extension);
355                    }
356    
357                    if (mimeType == null) {
358                            objectOutput.writeUTF(StringPool.BLANK);
359                    }
360                    else {
361                            objectOutput.writeUTF(mimeType);
362                    }
363    
364                    if (title == null) {
365                            objectOutput.writeUTF(StringPool.BLANK);
366                    }
367                    else {
368                            objectOutput.writeUTF(title);
369                    }
370    
371                    if (description == null) {
372                            objectOutput.writeUTF(StringPool.BLANK);
373                    }
374                    else {
375                            objectOutput.writeUTF(description);
376                    }
377    
378                    if (changeLog == null) {
379                            objectOutput.writeUTF(StringPool.BLANK);
380                    }
381                    else {
382                            objectOutput.writeUTF(changeLog);
383                    }
384    
385                    if (extraSettings == null) {
386                            objectOutput.writeUTF(StringPool.BLANK);
387                    }
388                    else {
389                            objectOutput.writeUTF(extraSettings);
390                    }
391    
392                    objectOutput.writeLong(fileEntryTypeId);
393    
394                    if (version == null) {
395                            objectOutput.writeUTF(StringPool.BLANK);
396                    }
397                    else {
398                            objectOutput.writeUTF(version);
399                    }
400    
401                    objectOutput.writeLong(size);
402    
403                    if (checksum == null) {
404                            objectOutput.writeUTF(StringPool.BLANK);
405                    }
406                    else {
407                            objectOutput.writeUTF(checksum);
408                    }
409    
410                    objectOutput.writeLong(lastPublishDate);
411                    objectOutput.writeInt(status);
412                    objectOutput.writeLong(statusByUserId);
413    
414                    if (statusByUserName == null) {
415                            objectOutput.writeUTF(StringPool.BLANK);
416                    }
417                    else {
418                            objectOutput.writeUTF(statusByUserName);
419                    }
420    
421                    objectOutput.writeLong(statusDate);
422            }
423    
424            public String uuid;
425            public long fileVersionId;
426            public long groupId;
427            public long companyId;
428            public long userId;
429            public String userName;
430            public long createDate;
431            public long modifiedDate;
432            public long repositoryId;
433            public long folderId;
434            public long fileEntryId;
435            public String treePath;
436            public String fileName;
437            public String extension;
438            public String mimeType;
439            public String title;
440            public String description;
441            public String changeLog;
442            public String extraSettings;
443            public long fileEntryTypeId;
444            public String version;
445            public long size;
446            public String checksum;
447            public long lastPublishDate;
448            public int status;
449            public long statusByUserId;
450            public String statusByUserName;
451            public long statusDate;
452    }