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