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