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