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