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