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