001    /**
002     * Copyright (c) 2000-2013 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 com.liferay.portal.kernel.util.StringBundler;
018    import com.liferay.portal.kernel.util.StringPool;
019    import com.liferay.portal.model.CacheModel;
020    
021    import com.liferay.portlet.documentlibrary.model.DLFileVersion;
022    
023    import java.io.Externalizable;
024    import java.io.IOException;
025    import java.io.ObjectInput;
026    import java.io.ObjectOutput;
027    
028    import java.util.Date;
029    
030    /**
031     * The cache model class for representing DLFileVersion in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see DLFileVersion
035     * @generated
036     */
037    public class DLFileVersionCacheModel implements CacheModel<DLFileVersion>,
038            Externalizable {
039            @Override
040            public String toString() {
041                    StringBundler sb = new StringBundler(51);
042    
043                    sb.append("{uuid=");
044                    sb.append(uuid);
045                    sb.append(", fileVersionId=");
046                    sb.append(fileVersionId);
047                    sb.append(", groupId=");
048                    sb.append(groupId);
049                    sb.append(", companyId=");
050                    sb.append(companyId);
051                    sb.append(", userId=");
052                    sb.append(userId);
053                    sb.append(", userName=");
054                    sb.append(userName);
055                    sb.append(", createDate=");
056                    sb.append(createDate);
057                    sb.append(", modifiedDate=");
058                    sb.append(modifiedDate);
059                    sb.append(", repositoryId=");
060                    sb.append(repositoryId);
061                    sb.append(", folderId=");
062                    sb.append(folderId);
063                    sb.append(", fileEntryId=");
064                    sb.append(fileEntryId);
065                    sb.append(", extension=");
066                    sb.append(extension);
067                    sb.append(", mimeType=");
068                    sb.append(mimeType);
069                    sb.append(", title=");
070                    sb.append(title);
071                    sb.append(", description=");
072                    sb.append(description);
073                    sb.append(", changeLog=");
074                    sb.append(changeLog);
075                    sb.append(", extraSettings=");
076                    sb.append(extraSettings);
077                    sb.append(", fileEntryTypeId=");
078                    sb.append(fileEntryTypeId);
079                    sb.append(", version=");
080                    sb.append(version);
081                    sb.append(", size=");
082                    sb.append(size);
083                    sb.append(", checksum=");
084                    sb.append(checksum);
085                    sb.append(", status=");
086                    sb.append(status);
087                    sb.append(", statusByUserId=");
088                    sb.append(statusByUserId);
089                    sb.append(", statusByUserName=");
090                    sb.append(statusByUserName);
091                    sb.append(", statusDate=");
092                    sb.append(statusDate);
093                    sb.append("}");
094    
095                    return sb.toString();
096            }
097    
098            @Override
099            public DLFileVersion toEntityModel() {
100                    DLFileVersionImpl dlFileVersionImpl = new DLFileVersionImpl();
101    
102                    if (uuid == null) {
103                            dlFileVersionImpl.setUuid(StringPool.BLANK);
104                    }
105                    else {
106                            dlFileVersionImpl.setUuid(uuid);
107                    }
108    
109                    dlFileVersionImpl.setFileVersionId(fileVersionId);
110                    dlFileVersionImpl.setGroupId(groupId);
111                    dlFileVersionImpl.setCompanyId(companyId);
112                    dlFileVersionImpl.setUserId(userId);
113    
114                    if (userName == null) {
115                            dlFileVersionImpl.setUserName(StringPool.BLANK);
116                    }
117                    else {
118                            dlFileVersionImpl.setUserName(userName);
119                    }
120    
121                    if (createDate == Long.MIN_VALUE) {
122                            dlFileVersionImpl.setCreateDate(null);
123                    }
124                    else {
125                            dlFileVersionImpl.setCreateDate(new Date(createDate));
126                    }
127    
128                    if (modifiedDate == Long.MIN_VALUE) {
129                            dlFileVersionImpl.setModifiedDate(null);
130                    }
131                    else {
132                            dlFileVersionImpl.setModifiedDate(new Date(modifiedDate));
133                    }
134    
135                    dlFileVersionImpl.setRepositoryId(repositoryId);
136                    dlFileVersionImpl.setFolderId(folderId);
137                    dlFileVersionImpl.setFileEntryId(fileEntryId);
138    
139                    if (extension == null) {
140                            dlFileVersionImpl.setExtension(StringPool.BLANK);
141                    }
142                    else {
143                            dlFileVersionImpl.setExtension(extension);
144                    }
145    
146                    if (mimeType == null) {
147                            dlFileVersionImpl.setMimeType(StringPool.BLANK);
148                    }
149                    else {
150                            dlFileVersionImpl.setMimeType(mimeType);
151                    }
152    
153                    if (title == null) {
154                            dlFileVersionImpl.setTitle(StringPool.BLANK);
155                    }
156                    else {
157                            dlFileVersionImpl.setTitle(title);
158                    }
159    
160                    if (description == null) {
161                            dlFileVersionImpl.setDescription(StringPool.BLANK);
162                    }
163                    else {
164                            dlFileVersionImpl.setDescription(description);
165                    }
166    
167                    if (changeLog == null) {
168                            dlFileVersionImpl.setChangeLog(StringPool.BLANK);
169                    }
170                    else {
171                            dlFileVersionImpl.setChangeLog(changeLog);
172                    }
173    
174                    if (extraSettings == null) {
175                            dlFileVersionImpl.setExtraSettings(StringPool.BLANK);
176                    }
177                    else {
178                            dlFileVersionImpl.setExtraSettings(extraSettings);
179                    }
180    
181                    dlFileVersionImpl.setFileEntryTypeId(fileEntryTypeId);
182    
183                    if (version == null) {
184                            dlFileVersionImpl.setVersion(StringPool.BLANK);
185                    }
186                    else {
187                            dlFileVersionImpl.setVersion(version);
188                    }
189    
190                    dlFileVersionImpl.setSize(size);
191    
192                    if (checksum == null) {
193                            dlFileVersionImpl.setChecksum(StringPool.BLANK);
194                    }
195                    else {
196                            dlFileVersionImpl.setChecksum(checksum);
197                    }
198    
199                    dlFileVersionImpl.setStatus(status);
200                    dlFileVersionImpl.setStatusByUserId(statusByUserId);
201    
202                    if (statusByUserName == null) {
203                            dlFileVersionImpl.setStatusByUserName(StringPool.BLANK);
204                    }
205                    else {
206                            dlFileVersionImpl.setStatusByUserName(statusByUserName);
207                    }
208    
209                    if (statusDate == Long.MIN_VALUE) {
210                            dlFileVersionImpl.setStatusDate(null);
211                    }
212                    else {
213                            dlFileVersionImpl.setStatusDate(new Date(statusDate));
214                    }
215    
216                    dlFileVersionImpl.resetOriginalValues();
217    
218                    return dlFileVersionImpl;
219            }
220    
221            @Override
222            public void readExternal(ObjectInput objectInput) throws IOException {
223                    uuid = objectInput.readUTF();
224                    fileVersionId = objectInput.readLong();
225                    groupId = objectInput.readLong();
226                    companyId = objectInput.readLong();
227                    userId = objectInput.readLong();
228                    userName = objectInput.readUTF();
229                    createDate = objectInput.readLong();
230                    modifiedDate = objectInput.readLong();
231                    repositoryId = objectInput.readLong();
232                    folderId = objectInput.readLong();
233                    fileEntryId = objectInput.readLong();
234                    extension = objectInput.readUTF();
235                    mimeType = objectInput.readUTF();
236                    title = objectInput.readUTF();
237                    description = objectInput.readUTF();
238                    changeLog = objectInput.readUTF();
239                    extraSettings = objectInput.readUTF();
240                    fileEntryTypeId = objectInput.readLong();
241                    version = objectInput.readUTF();
242                    size = objectInput.readLong();
243                    checksum = objectInput.readUTF();
244                    status = objectInput.readInt();
245                    statusByUserId = objectInput.readLong();
246                    statusByUserName = objectInput.readUTF();
247                    statusDate = objectInput.readLong();
248            }
249    
250            @Override
251            public void writeExternal(ObjectOutput objectOutput)
252                    throws IOException {
253                    if (uuid == null) {
254                            objectOutput.writeUTF(StringPool.BLANK);
255                    }
256                    else {
257                            objectOutput.writeUTF(uuid);
258                    }
259    
260                    objectOutput.writeLong(fileVersionId);
261                    objectOutput.writeLong(groupId);
262                    objectOutput.writeLong(companyId);
263                    objectOutput.writeLong(userId);
264    
265                    if (userName == null) {
266                            objectOutput.writeUTF(StringPool.BLANK);
267                    }
268                    else {
269                            objectOutput.writeUTF(userName);
270                    }
271    
272                    objectOutput.writeLong(createDate);
273                    objectOutput.writeLong(modifiedDate);
274                    objectOutput.writeLong(repositoryId);
275                    objectOutput.writeLong(folderId);
276                    objectOutput.writeLong(fileEntryId);
277    
278                    if (extension == null) {
279                            objectOutput.writeUTF(StringPool.BLANK);
280                    }
281                    else {
282                            objectOutput.writeUTF(extension);
283                    }
284    
285                    if (mimeType == null) {
286                            objectOutput.writeUTF(StringPool.BLANK);
287                    }
288                    else {
289                            objectOutput.writeUTF(mimeType);
290                    }
291    
292                    if (title == null) {
293                            objectOutput.writeUTF(StringPool.BLANK);
294                    }
295                    else {
296                            objectOutput.writeUTF(title);
297                    }
298    
299                    if (description == null) {
300                            objectOutput.writeUTF(StringPool.BLANK);
301                    }
302                    else {
303                            objectOutput.writeUTF(description);
304                    }
305    
306                    if (changeLog == null) {
307                            objectOutput.writeUTF(StringPool.BLANK);
308                    }
309                    else {
310                            objectOutput.writeUTF(changeLog);
311                    }
312    
313                    if (extraSettings == null) {
314                            objectOutput.writeUTF(StringPool.BLANK);
315                    }
316                    else {
317                            objectOutput.writeUTF(extraSettings);
318                    }
319    
320                    objectOutput.writeLong(fileEntryTypeId);
321    
322                    if (version == null) {
323                            objectOutput.writeUTF(StringPool.BLANK);
324                    }
325                    else {
326                            objectOutput.writeUTF(version);
327                    }
328    
329                    objectOutput.writeLong(size);
330    
331                    if (checksum == null) {
332                            objectOutput.writeUTF(StringPool.BLANK);
333                    }
334                    else {
335                            objectOutput.writeUTF(checksum);
336                    }
337    
338                    objectOutput.writeInt(status);
339                    objectOutput.writeLong(statusByUserId);
340    
341                    if (statusByUserName == null) {
342                            objectOutput.writeUTF(StringPool.BLANK);
343                    }
344                    else {
345                            objectOutput.writeUTF(statusByUserName);
346                    }
347    
348                    objectOutput.writeLong(statusDate);
349            }
350    
351            public String uuid;
352            public long fileVersionId;
353            public long groupId;
354            public long companyId;
355            public long userId;
356            public String userName;
357            public long createDate;
358            public long modifiedDate;
359            public long repositoryId;
360            public long folderId;
361            public long fileEntryId;
362            public String extension;
363            public String mimeType;
364            public String title;
365            public String description;
366            public String changeLog;
367            public String extraSettings;
368            public long fileEntryTypeId;
369            public String version;
370            public long size;
371            public String checksum;
372            public int status;
373            public long statusByUserId;
374            public String statusByUserName;
375            public long statusDate;
376    }