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.DLFolder;
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 DLFolder in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see DLFolder
035     * @generated
036     */
037    public class DLFolderCacheModel implements CacheModel<DLFolder>, Externalizable {
038            @Override
039            public String toString() {
040                    StringBundler sb = new StringBundler(43);
041    
042                    sb.append("{uuid=");
043                    sb.append(uuid);
044                    sb.append(", folderId=");
045                    sb.append(folderId);
046                    sb.append(", groupId=");
047                    sb.append(groupId);
048                    sb.append(", companyId=");
049                    sb.append(companyId);
050                    sb.append(", userId=");
051                    sb.append(userId);
052                    sb.append(", userName=");
053                    sb.append(userName);
054                    sb.append(", createDate=");
055                    sb.append(createDate);
056                    sb.append(", modifiedDate=");
057                    sb.append(modifiedDate);
058                    sb.append(", repositoryId=");
059                    sb.append(repositoryId);
060                    sb.append(", mountPoint=");
061                    sb.append(mountPoint);
062                    sb.append(", parentFolderId=");
063                    sb.append(parentFolderId);
064                    sb.append(", name=");
065                    sb.append(name);
066                    sb.append(", description=");
067                    sb.append(description);
068                    sb.append(", lastPostDate=");
069                    sb.append(lastPostDate);
070                    sb.append(", defaultFileEntryTypeId=");
071                    sb.append(defaultFileEntryTypeId);
072                    sb.append(", hidden=");
073                    sb.append(hidden);
074                    sb.append(", overrideFileEntryTypes=");
075                    sb.append(overrideFileEntryTypes);
076                    sb.append(", status=");
077                    sb.append(status);
078                    sb.append(", statusByUserId=");
079                    sb.append(statusByUserId);
080                    sb.append(", statusByUserName=");
081                    sb.append(statusByUserName);
082                    sb.append(", statusDate=");
083                    sb.append(statusDate);
084                    sb.append("}");
085    
086                    return sb.toString();
087            }
088    
089            public DLFolder toEntityModel() {
090                    DLFolderImpl dlFolderImpl = new DLFolderImpl();
091    
092                    if (uuid == null) {
093                            dlFolderImpl.setUuid(StringPool.BLANK);
094                    }
095                    else {
096                            dlFolderImpl.setUuid(uuid);
097                    }
098    
099                    dlFolderImpl.setFolderId(folderId);
100                    dlFolderImpl.setGroupId(groupId);
101                    dlFolderImpl.setCompanyId(companyId);
102                    dlFolderImpl.setUserId(userId);
103    
104                    if (userName == null) {
105                            dlFolderImpl.setUserName(StringPool.BLANK);
106                    }
107                    else {
108                            dlFolderImpl.setUserName(userName);
109                    }
110    
111                    if (createDate == Long.MIN_VALUE) {
112                            dlFolderImpl.setCreateDate(null);
113                    }
114                    else {
115                            dlFolderImpl.setCreateDate(new Date(createDate));
116                    }
117    
118                    if (modifiedDate == Long.MIN_VALUE) {
119                            dlFolderImpl.setModifiedDate(null);
120                    }
121                    else {
122                            dlFolderImpl.setModifiedDate(new Date(modifiedDate));
123                    }
124    
125                    dlFolderImpl.setRepositoryId(repositoryId);
126                    dlFolderImpl.setMountPoint(mountPoint);
127                    dlFolderImpl.setParentFolderId(parentFolderId);
128    
129                    if (name == null) {
130                            dlFolderImpl.setName(StringPool.BLANK);
131                    }
132                    else {
133                            dlFolderImpl.setName(name);
134                    }
135    
136                    if (description == null) {
137                            dlFolderImpl.setDescription(StringPool.BLANK);
138                    }
139                    else {
140                            dlFolderImpl.setDescription(description);
141                    }
142    
143                    if (lastPostDate == Long.MIN_VALUE) {
144                            dlFolderImpl.setLastPostDate(null);
145                    }
146                    else {
147                            dlFolderImpl.setLastPostDate(new Date(lastPostDate));
148                    }
149    
150                    dlFolderImpl.setDefaultFileEntryTypeId(defaultFileEntryTypeId);
151                    dlFolderImpl.setHidden(hidden);
152                    dlFolderImpl.setOverrideFileEntryTypes(overrideFileEntryTypes);
153                    dlFolderImpl.setStatus(status);
154                    dlFolderImpl.setStatusByUserId(statusByUserId);
155    
156                    if (statusByUserName == null) {
157                            dlFolderImpl.setStatusByUserName(StringPool.BLANK);
158                    }
159                    else {
160                            dlFolderImpl.setStatusByUserName(statusByUserName);
161                    }
162    
163                    if (statusDate == Long.MIN_VALUE) {
164                            dlFolderImpl.setStatusDate(null);
165                    }
166                    else {
167                            dlFolderImpl.setStatusDate(new Date(statusDate));
168                    }
169    
170                    dlFolderImpl.resetOriginalValues();
171    
172                    return dlFolderImpl;
173            }
174    
175            public void readExternal(ObjectInput objectInput) throws IOException {
176                    uuid = objectInput.readUTF();
177                    folderId = objectInput.readLong();
178                    groupId = objectInput.readLong();
179                    companyId = objectInput.readLong();
180                    userId = objectInput.readLong();
181                    userName = objectInput.readUTF();
182                    createDate = objectInput.readLong();
183                    modifiedDate = objectInput.readLong();
184                    repositoryId = objectInput.readLong();
185                    mountPoint = objectInput.readBoolean();
186                    parentFolderId = objectInput.readLong();
187                    name = objectInput.readUTF();
188                    description = objectInput.readUTF();
189                    lastPostDate = objectInput.readLong();
190                    defaultFileEntryTypeId = objectInput.readLong();
191                    hidden = objectInput.readBoolean();
192                    overrideFileEntryTypes = objectInput.readBoolean();
193                    status = objectInput.readInt();
194                    statusByUserId = objectInput.readLong();
195                    statusByUserName = objectInput.readUTF();
196                    statusDate = objectInput.readLong();
197            }
198    
199            public void writeExternal(ObjectOutput objectOutput)
200                    throws IOException {
201                    if (uuid == null) {
202                            objectOutput.writeUTF(StringPool.BLANK);
203                    }
204                    else {
205                            objectOutput.writeUTF(uuid);
206                    }
207    
208                    objectOutput.writeLong(folderId);
209                    objectOutput.writeLong(groupId);
210                    objectOutput.writeLong(companyId);
211                    objectOutput.writeLong(userId);
212    
213                    if (userName == null) {
214                            objectOutput.writeUTF(StringPool.BLANK);
215                    }
216                    else {
217                            objectOutput.writeUTF(userName);
218                    }
219    
220                    objectOutput.writeLong(createDate);
221                    objectOutput.writeLong(modifiedDate);
222                    objectOutput.writeLong(repositoryId);
223                    objectOutput.writeBoolean(mountPoint);
224                    objectOutput.writeLong(parentFolderId);
225    
226                    if (name == null) {
227                            objectOutput.writeUTF(StringPool.BLANK);
228                    }
229                    else {
230                            objectOutput.writeUTF(name);
231                    }
232    
233                    if (description == null) {
234                            objectOutput.writeUTF(StringPool.BLANK);
235                    }
236                    else {
237                            objectOutput.writeUTF(description);
238                    }
239    
240                    objectOutput.writeLong(lastPostDate);
241                    objectOutput.writeLong(defaultFileEntryTypeId);
242                    objectOutput.writeBoolean(hidden);
243                    objectOutput.writeBoolean(overrideFileEntryTypes);
244                    objectOutput.writeInt(status);
245                    objectOutput.writeLong(statusByUserId);
246    
247                    if (statusByUserName == null) {
248                            objectOutput.writeUTF(StringPool.BLANK);
249                    }
250                    else {
251                            objectOutput.writeUTF(statusByUserName);
252                    }
253    
254                    objectOutput.writeLong(statusDate);
255            }
256    
257            public String uuid;
258            public long folderId;
259            public long groupId;
260            public long companyId;
261            public long userId;
262            public String userName;
263            public long createDate;
264            public long modifiedDate;
265            public long repositoryId;
266            public boolean mountPoint;
267            public long parentFolderId;
268            public String name;
269            public String description;
270            public long lastPostDate;
271            public long defaultFileEntryTypeId;
272            public boolean hidden;
273            public boolean overrideFileEntryTypes;
274            public int status;
275            public long statusByUserId;
276            public String statusByUserName;
277            public long statusDate;
278    }