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.DLFileShortcut;
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                    fileShortcutId = objectInput.readLong();
195                    groupId = objectInput.readLong();
196                    companyId = objectInput.readLong();
197                    userId = objectInput.readLong();
198                    userName = objectInput.readUTF();
199                    createDate = objectInput.readLong();
200                    modifiedDate = objectInput.readLong();
201                    repositoryId = objectInput.readLong();
202                    folderId = objectInput.readLong();
203                    toFileEntryId = objectInput.readLong();
204                    treePath = objectInput.readUTF();
205                    active = objectInput.readBoolean();
206                    lastPublishDate = objectInput.readLong();
207                    status = objectInput.readInt();
208                    statusByUserId = objectInput.readLong();
209                    statusByUserName = objectInput.readUTF();
210                    statusDate = objectInput.readLong();
211            }
212    
213            @Override
214            public void writeExternal(ObjectOutput objectOutput)
215                    throws IOException {
216                    if (uuid == null) {
217                            objectOutput.writeUTF(StringPool.BLANK);
218                    }
219                    else {
220                            objectOutput.writeUTF(uuid);
221                    }
222    
223                    objectOutput.writeLong(fileShortcutId);
224                    objectOutput.writeLong(groupId);
225                    objectOutput.writeLong(companyId);
226                    objectOutput.writeLong(userId);
227    
228                    if (userName == null) {
229                            objectOutput.writeUTF(StringPool.BLANK);
230                    }
231                    else {
232                            objectOutput.writeUTF(userName);
233                    }
234    
235                    objectOutput.writeLong(createDate);
236                    objectOutput.writeLong(modifiedDate);
237                    objectOutput.writeLong(repositoryId);
238                    objectOutput.writeLong(folderId);
239                    objectOutput.writeLong(toFileEntryId);
240    
241                    if (treePath == null) {
242                            objectOutput.writeUTF(StringPool.BLANK);
243                    }
244                    else {
245                            objectOutput.writeUTF(treePath);
246                    }
247    
248                    objectOutput.writeBoolean(active);
249                    objectOutput.writeLong(lastPublishDate);
250                    objectOutput.writeInt(status);
251                    objectOutput.writeLong(statusByUserId);
252    
253                    if (statusByUserName == null) {
254                            objectOutput.writeUTF(StringPool.BLANK);
255                    }
256                    else {
257                            objectOutput.writeUTF(statusByUserName);
258                    }
259    
260                    objectOutput.writeLong(statusDate);
261            }
262    
263            public String uuid;
264            public long fileShortcutId;
265            public long groupId;
266            public long companyId;
267            public long userId;
268            public String userName;
269            public long createDate;
270            public long modifiedDate;
271            public long repositoryId;
272            public long folderId;
273            public long toFileEntryId;
274            public String treePath;
275            public boolean active;
276            public long lastPublishDate;
277            public int status;
278            public long statusByUserId;
279            public String statusByUserName;
280            public long statusDate;
281    }