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.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            @Override
090            public DLFolder toEntityModel() {
091                    DLFolderImpl dlFolderImpl = new DLFolderImpl();
092    
093                    if (uuid == null) {
094                            dlFolderImpl.setUuid(StringPool.BLANK);
095                    }
096                    else {
097                            dlFolderImpl.setUuid(uuid);
098                    }
099    
100                    dlFolderImpl.setFolderId(folderId);
101                    dlFolderImpl.setGroupId(groupId);
102                    dlFolderImpl.setCompanyId(companyId);
103                    dlFolderImpl.setUserId(userId);
104    
105                    if (userName == null) {
106                            dlFolderImpl.setUserName(StringPool.BLANK);
107                    }
108                    else {
109                            dlFolderImpl.setUserName(userName);
110                    }
111    
112                    if (createDate == Long.MIN_VALUE) {
113                            dlFolderImpl.setCreateDate(null);
114                    }
115                    else {
116                            dlFolderImpl.setCreateDate(new Date(createDate));
117                    }
118    
119                    if (modifiedDate == Long.MIN_VALUE) {
120                            dlFolderImpl.setModifiedDate(null);
121                    }
122                    else {
123                            dlFolderImpl.setModifiedDate(new Date(modifiedDate));
124                    }
125    
126                    dlFolderImpl.setRepositoryId(repositoryId);
127                    dlFolderImpl.setMountPoint(mountPoint);
128                    dlFolderImpl.setParentFolderId(parentFolderId);
129    
130                    if (name == null) {
131                            dlFolderImpl.setName(StringPool.BLANK);
132                    }
133                    else {
134                            dlFolderImpl.setName(name);
135                    }
136    
137                    if (description == null) {
138                            dlFolderImpl.setDescription(StringPool.BLANK);
139                    }
140                    else {
141                            dlFolderImpl.setDescription(description);
142                    }
143    
144                    if (lastPostDate == Long.MIN_VALUE) {
145                            dlFolderImpl.setLastPostDate(null);
146                    }
147                    else {
148                            dlFolderImpl.setLastPostDate(new Date(lastPostDate));
149                    }
150    
151                    dlFolderImpl.setDefaultFileEntryTypeId(defaultFileEntryTypeId);
152                    dlFolderImpl.setHidden(hidden);
153                    dlFolderImpl.setOverrideFileEntryTypes(overrideFileEntryTypes);
154                    dlFolderImpl.setStatus(status);
155                    dlFolderImpl.setStatusByUserId(statusByUserId);
156    
157                    if (statusByUserName == null) {
158                            dlFolderImpl.setStatusByUserName(StringPool.BLANK);
159                    }
160                    else {
161                            dlFolderImpl.setStatusByUserName(statusByUserName);
162                    }
163    
164                    if (statusDate == Long.MIN_VALUE) {
165                            dlFolderImpl.setStatusDate(null);
166                    }
167                    else {
168                            dlFolderImpl.setStatusDate(new Date(statusDate));
169                    }
170    
171                    dlFolderImpl.resetOriginalValues();
172    
173                    return dlFolderImpl;
174            }
175    
176            @Override
177            public void readExternal(ObjectInput objectInput) throws IOException {
178                    uuid = objectInput.readUTF();
179                    folderId = objectInput.readLong();
180                    groupId = objectInput.readLong();
181                    companyId = objectInput.readLong();
182                    userId = objectInput.readLong();
183                    userName = objectInput.readUTF();
184                    createDate = objectInput.readLong();
185                    modifiedDate = objectInput.readLong();
186                    repositoryId = objectInput.readLong();
187                    mountPoint = objectInput.readBoolean();
188                    parentFolderId = objectInput.readLong();
189                    name = objectInput.readUTF();
190                    description = objectInput.readUTF();
191                    lastPostDate = objectInput.readLong();
192                    defaultFileEntryTypeId = objectInput.readLong();
193                    hidden = objectInput.readBoolean();
194                    overrideFileEntryTypes = objectInput.readBoolean();
195                    status = objectInput.readInt();
196                    statusByUserId = objectInput.readLong();
197                    statusByUserName = objectInput.readUTF();
198                    statusDate = objectInput.readLong();
199            }
200    
201            @Override
202            public void writeExternal(ObjectOutput objectOutput)
203                    throws IOException {
204                    if (uuid == null) {
205                            objectOutput.writeUTF(StringPool.BLANK);
206                    }
207                    else {
208                            objectOutput.writeUTF(uuid);
209                    }
210    
211                    objectOutput.writeLong(folderId);
212                    objectOutput.writeLong(groupId);
213                    objectOutput.writeLong(companyId);
214                    objectOutput.writeLong(userId);
215    
216                    if (userName == null) {
217                            objectOutput.writeUTF(StringPool.BLANK);
218                    }
219                    else {
220                            objectOutput.writeUTF(userName);
221                    }
222    
223                    objectOutput.writeLong(createDate);
224                    objectOutput.writeLong(modifiedDate);
225                    objectOutput.writeLong(repositoryId);
226                    objectOutput.writeBoolean(mountPoint);
227                    objectOutput.writeLong(parentFolderId);
228    
229                    if (name == null) {
230                            objectOutput.writeUTF(StringPool.BLANK);
231                    }
232                    else {
233                            objectOutput.writeUTF(name);
234                    }
235    
236                    if (description == null) {
237                            objectOutput.writeUTF(StringPool.BLANK);
238                    }
239                    else {
240                            objectOutput.writeUTF(description);
241                    }
242    
243                    objectOutput.writeLong(lastPostDate);
244                    objectOutput.writeLong(defaultFileEntryTypeId);
245                    objectOutput.writeBoolean(hidden);
246                    objectOutput.writeBoolean(overrideFileEntryTypes);
247                    objectOutput.writeInt(status);
248                    objectOutput.writeLong(statusByUserId);
249    
250                    if (statusByUserName == null) {
251                            objectOutput.writeUTF(StringPool.BLANK);
252                    }
253                    else {
254                            objectOutput.writeUTF(statusByUserName);
255                    }
256    
257                    objectOutput.writeLong(statusDate);
258            }
259    
260            public String uuid;
261            public long folderId;
262            public long groupId;
263            public long companyId;
264            public long userId;
265            public String userName;
266            public long createDate;
267            public long modifiedDate;
268            public long repositoryId;
269            public boolean mountPoint;
270            public long parentFolderId;
271            public String name;
272            public String description;
273            public long lastPostDate;
274            public long defaultFileEntryTypeId;
275            public boolean hidden;
276            public boolean overrideFileEntryTypes;
277            public int status;
278            public long statusByUserId;
279            public String statusByUserName;
280            public long statusDate;
281    }