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(55);
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(", status=");
118                    sb.append(status);
119                    sb.append(", statusByUserId=");
120                    sb.append(statusByUserId);
121                    sb.append(", statusByUserName=");
122                    sb.append(statusByUserName);
123                    sb.append(", statusDate=");
124                    sb.append(statusDate);
125                    sb.append("}");
126    
127                    return sb.toString();
128            }
129    
130            @Override
131            public DLFileVersion toEntityModel() {
132                    DLFileVersionImpl dlFileVersionImpl = new DLFileVersionImpl();
133    
134                    if (uuid == null) {
135                            dlFileVersionImpl.setUuid(StringPool.BLANK);
136                    }
137                    else {
138                            dlFileVersionImpl.setUuid(uuid);
139                    }
140    
141                    dlFileVersionImpl.setFileVersionId(fileVersionId);
142                    dlFileVersionImpl.setGroupId(groupId);
143                    dlFileVersionImpl.setCompanyId(companyId);
144                    dlFileVersionImpl.setUserId(userId);
145    
146                    if (userName == null) {
147                            dlFileVersionImpl.setUserName(StringPool.BLANK);
148                    }
149                    else {
150                            dlFileVersionImpl.setUserName(userName);
151                    }
152    
153                    if (createDate == Long.MIN_VALUE) {
154                            dlFileVersionImpl.setCreateDate(null);
155                    }
156                    else {
157                            dlFileVersionImpl.setCreateDate(new Date(createDate));
158                    }
159    
160                    if (modifiedDate == Long.MIN_VALUE) {
161                            dlFileVersionImpl.setModifiedDate(null);
162                    }
163                    else {
164                            dlFileVersionImpl.setModifiedDate(new Date(modifiedDate));
165                    }
166    
167                    dlFileVersionImpl.setRepositoryId(repositoryId);
168                    dlFileVersionImpl.setFolderId(folderId);
169                    dlFileVersionImpl.setFileEntryId(fileEntryId);
170    
171                    if (treePath == null) {
172                            dlFileVersionImpl.setTreePath(StringPool.BLANK);
173                    }
174                    else {
175                            dlFileVersionImpl.setTreePath(treePath);
176                    }
177    
178                    if (fileName == null) {
179                            dlFileVersionImpl.setFileName(StringPool.BLANK);
180                    }
181                    else {
182                            dlFileVersionImpl.setFileName(fileName);
183                    }
184    
185                    if (extension == null) {
186                            dlFileVersionImpl.setExtension(StringPool.BLANK);
187                    }
188                    else {
189                            dlFileVersionImpl.setExtension(extension);
190                    }
191    
192                    if (mimeType == null) {
193                            dlFileVersionImpl.setMimeType(StringPool.BLANK);
194                    }
195                    else {
196                            dlFileVersionImpl.setMimeType(mimeType);
197                    }
198    
199                    if (title == null) {
200                            dlFileVersionImpl.setTitle(StringPool.BLANK);
201                    }
202                    else {
203                            dlFileVersionImpl.setTitle(title);
204                    }
205    
206                    if (description == null) {
207                            dlFileVersionImpl.setDescription(StringPool.BLANK);
208                    }
209                    else {
210                            dlFileVersionImpl.setDescription(description);
211                    }
212    
213                    if (changeLog == null) {
214                            dlFileVersionImpl.setChangeLog(StringPool.BLANK);
215                    }
216                    else {
217                            dlFileVersionImpl.setChangeLog(changeLog);
218                    }
219    
220                    if (extraSettings == null) {
221                            dlFileVersionImpl.setExtraSettings(StringPool.BLANK);
222                    }
223                    else {
224                            dlFileVersionImpl.setExtraSettings(extraSettings);
225                    }
226    
227                    dlFileVersionImpl.setFileEntryTypeId(fileEntryTypeId);
228    
229                    if (version == null) {
230                            dlFileVersionImpl.setVersion(StringPool.BLANK);
231                    }
232                    else {
233                            dlFileVersionImpl.setVersion(version);
234                    }
235    
236                    dlFileVersionImpl.setSize(size);
237    
238                    if (checksum == null) {
239                            dlFileVersionImpl.setChecksum(StringPool.BLANK);
240                    }
241                    else {
242                            dlFileVersionImpl.setChecksum(checksum);
243                    }
244    
245                    dlFileVersionImpl.setStatus(status);
246                    dlFileVersionImpl.setStatusByUserId(statusByUserId);
247    
248                    if (statusByUserName == null) {
249                            dlFileVersionImpl.setStatusByUserName(StringPool.BLANK);
250                    }
251                    else {
252                            dlFileVersionImpl.setStatusByUserName(statusByUserName);
253                    }
254    
255                    if (statusDate == Long.MIN_VALUE) {
256                            dlFileVersionImpl.setStatusDate(null);
257                    }
258                    else {
259                            dlFileVersionImpl.setStatusDate(new Date(statusDate));
260                    }
261    
262                    dlFileVersionImpl.resetOriginalValues();
263    
264                    return dlFileVersionImpl;
265            }
266    
267            @Override
268            public void readExternal(ObjectInput objectInput) throws IOException {
269                    uuid = objectInput.readUTF();
270                    fileVersionId = objectInput.readLong();
271                    groupId = objectInput.readLong();
272                    companyId = objectInput.readLong();
273                    userId = objectInput.readLong();
274                    userName = objectInput.readUTF();
275                    createDate = objectInput.readLong();
276                    modifiedDate = objectInput.readLong();
277                    repositoryId = objectInput.readLong();
278                    folderId = objectInput.readLong();
279                    fileEntryId = objectInput.readLong();
280                    treePath = objectInput.readUTF();
281                    fileName = objectInput.readUTF();
282                    extension = objectInput.readUTF();
283                    mimeType = objectInput.readUTF();
284                    title = objectInput.readUTF();
285                    description = objectInput.readUTF();
286                    changeLog = objectInput.readUTF();
287                    extraSettings = objectInput.readUTF();
288                    fileEntryTypeId = objectInput.readLong();
289                    version = objectInput.readUTF();
290                    size = objectInput.readLong();
291                    checksum = objectInput.readUTF();
292                    status = objectInput.readInt();
293                    statusByUserId = objectInput.readLong();
294                    statusByUserName = objectInput.readUTF();
295                    statusDate = objectInput.readLong();
296            }
297    
298            @Override
299            public void writeExternal(ObjectOutput objectOutput)
300                    throws IOException {
301                    if (uuid == null) {
302                            objectOutput.writeUTF(StringPool.BLANK);
303                    }
304                    else {
305                            objectOutput.writeUTF(uuid);
306                    }
307    
308                    objectOutput.writeLong(fileVersionId);
309                    objectOutput.writeLong(groupId);
310                    objectOutput.writeLong(companyId);
311                    objectOutput.writeLong(userId);
312    
313                    if (userName == null) {
314                            objectOutput.writeUTF(StringPool.BLANK);
315                    }
316                    else {
317                            objectOutput.writeUTF(userName);
318                    }
319    
320                    objectOutput.writeLong(createDate);
321                    objectOutput.writeLong(modifiedDate);
322                    objectOutput.writeLong(repositoryId);
323                    objectOutput.writeLong(folderId);
324                    objectOutput.writeLong(fileEntryId);
325    
326                    if (treePath == null) {
327                            objectOutput.writeUTF(StringPool.BLANK);
328                    }
329                    else {
330                            objectOutput.writeUTF(treePath);
331                    }
332    
333                    if (fileName == null) {
334                            objectOutput.writeUTF(StringPool.BLANK);
335                    }
336                    else {
337                            objectOutput.writeUTF(fileName);
338                    }
339    
340                    if (extension == null) {
341                            objectOutput.writeUTF(StringPool.BLANK);
342                    }
343                    else {
344                            objectOutput.writeUTF(extension);
345                    }
346    
347                    if (mimeType == null) {
348                            objectOutput.writeUTF(StringPool.BLANK);
349                    }
350                    else {
351                            objectOutput.writeUTF(mimeType);
352                    }
353    
354                    if (title == null) {
355                            objectOutput.writeUTF(StringPool.BLANK);
356                    }
357                    else {
358                            objectOutput.writeUTF(title);
359                    }
360    
361                    if (description == null) {
362                            objectOutput.writeUTF(StringPool.BLANK);
363                    }
364                    else {
365                            objectOutput.writeUTF(description);
366                    }
367    
368                    if (changeLog == null) {
369                            objectOutput.writeUTF(StringPool.BLANK);
370                    }
371                    else {
372                            objectOutput.writeUTF(changeLog);
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    
393                    if (checksum == null) {
394                            objectOutput.writeUTF(StringPool.BLANK);
395                    }
396                    else {
397                            objectOutput.writeUTF(checksum);
398                    }
399    
400                    objectOutput.writeInt(status);
401                    objectOutput.writeLong(statusByUserId);
402    
403                    if (statusByUserName == null) {
404                            objectOutput.writeUTF(StringPool.BLANK);
405                    }
406                    else {
407                            objectOutput.writeUTF(statusByUserName);
408                    }
409    
410                    objectOutput.writeLong(statusDate);
411            }
412    
413            public String uuid;
414            public long fileVersionId;
415            public long groupId;
416            public long companyId;
417            public long userId;
418            public String userName;
419            public long createDate;
420            public long modifiedDate;
421            public long repositoryId;
422            public long folderId;
423            public long fileEntryId;
424            public String treePath;
425            public String fileName;
426            public String extension;
427            public String mimeType;
428            public String title;
429            public String description;
430            public String changeLog;
431            public String extraSettings;
432            public long fileEntryTypeId;
433            public String version;
434            public long size;
435            public String checksum;
436            public int status;
437            public long statusByUserId;
438            public String statusByUserName;
439            public long statusDate;
440    }