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.document.library.kernel.model.DLFolder;
020    
021    import com.liferay.portal.kernel.model.CacheModel;
022    import com.liferay.portal.kernel.util.HashUtil;
023    import com.liferay.portal.kernel.util.StringBundler;
024    import com.liferay.portal.kernel.util.StringPool;
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    
227                    folderId = objectInput.readLong();
228    
229                    groupId = objectInput.readLong();
230    
231                    companyId = objectInput.readLong();
232    
233                    userId = objectInput.readLong();
234                    userName = objectInput.readUTF();
235                    createDate = objectInput.readLong();
236                    modifiedDate = objectInput.readLong();
237    
238                    repositoryId = objectInput.readLong();
239    
240                    mountPoint = objectInput.readBoolean();
241    
242                    parentFolderId = objectInput.readLong();
243                    treePath = objectInput.readUTF();
244                    name = objectInput.readUTF();
245                    description = objectInput.readUTF();
246                    lastPostDate = objectInput.readLong();
247    
248                    defaultFileEntryTypeId = objectInput.readLong();
249    
250                    hidden = objectInput.readBoolean();
251    
252                    restrictionType = objectInput.readInt();
253                    lastPublishDate = objectInput.readLong();
254    
255                    status = objectInput.readInt();
256    
257                    statusByUserId = objectInput.readLong();
258                    statusByUserName = objectInput.readUTF();
259                    statusDate = objectInput.readLong();
260            }
261    
262            @Override
263            public void writeExternal(ObjectOutput objectOutput)
264                    throws IOException {
265                    if (uuid == null) {
266                            objectOutput.writeUTF(StringPool.BLANK);
267                    }
268                    else {
269                            objectOutput.writeUTF(uuid);
270                    }
271    
272                    objectOutput.writeLong(folderId);
273    
274                    objectOutput.writeLong(groupId);
275    
276                    objectOutput.writeLong(companyId);
277    
278                    objectOutput.writeLong(userId);
279    
280                    if (userName == null) {
281                            objectOutput.writeUTF(StringPool.BLANK);
282                    }
283                    else {
284                            objectOutput.writeUTF(userName);
285                    }
286    
287                    objectOutput.writeLong(createDate);
288                    objectOutput.writeLong(modifiedDate);
289    
290                    objectOutput.writeLong(repositoryId);
291    
292                    objectOutput.writeBoolean(mountPoint);
293    
294                    objectOutput.writeLong(parentFolderId);
295    
296                    if (treePath == null) {
297                            objectOutput.writeUTF(StringPool.BLANK);
298                    }
299                    else {
300                            objectOutput.writeUTF(treePath);
301                    }
302    
303                    if (name == null) {
304                            objectOutput.writeUTF(StringPool.BLANK);
305                    }
306                    else {
307                            objectOutput.writeUTF(name);
308                    }
309    
310                    if (description == null) {
311                            objectOutput.writeUTF(StringPool.BLANK);
312                    }
313                    else {
314                            objectOutput.writeUTF(description);
315                    }
316    
317                    objectOutput.writeLong(lastPostDate);
318    
319                    objectOutput.writeLong(defaultFileEntryTypeId);
320    
321                    objectOutput.writeBoolean(hidden);
322    
323                    objectOutput.writeInt(restrictionType);
324                    objectOutput.writeLong(lastPublishDate);
325    
326                    objectOutput.writeInt(status);
327    
328                    objectOutput.writeLong(statusByUserId);
329    
330                    if (statusByUserName == null) {
331                            objectOutput.writeUTF(StringPool.BLANK);
332                    }
333                    else {
334                            objectOutput.writeUTF(statusByUserName);
335                    }
336    
337                    objectOutput.writeLong(statusDate);
338            }
339    
340            public String uuid;
341            public long folderId;
342            public long groupId;
343            public long companyId;
344            public long userId;
345            public String userName;
346            public long createDate;
347            public long modifiedDate;
348            public long repositoryId;
349            public boolean mountPoint;
350            public long parentFolderId;
351            public String treePath;
352            public String name;
353            public String description;
354            public long lastPostDate;
355            public long defaultFileEntryTypeId;
356            public boolean hidden;
357            public int restrictionType;
358            public long lastPublishDate;
359            public int status;
360            public long statusByUserId;
361            public String statusByUserName;
362            public long statusDate;
363    }