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