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.DLFileEntryType;
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 DLFileEntryType in entity cache.
035     *
036     * @author Brian Wing Shun Chan
037     * @see DLFileEntryType
038     * @generated
039     */
040    @ProviderType
041    public class DLFileEntryTypeCacheModel implements CacheModel<DLFileEntryType>,
042            Externalizable {
043            @Override
044            public boolean equals(Object obj) {
045                    if (this == obj) {
046                            return true;
047                    }
048    
049                    if (!(obj instanceof DLFileEntryTypeCacheModel)) {
050                            return false;
051                    }
052    
053                    DLFileEntryTypeCacheModel dlFileEntryTypeCacheModel = (DLFileEntryTypeCacheModel)obj;
054    
055                    if (fileEntryTypeId == dlFileEntryTypeCacheModel.fileEntryTypeId) {
056                            return true;
057                    }
058    
059                    return false;
060            }
061    
062            @Override
063            public int hashCode() {
064                    return HashUtil.hash(0, fileEntryTypeId);
065            }
066    
067            @Override
068            public String toString() {
069                    StringBundler sb = new StringBundler(25);
070    
071                    sb.append("{uuid=");
072                    sb.append(uuid);
073                    sb.append(", fileEntryTypeId=");
074                    sb.append(fileEntryTypeId);
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(", fileEntryTypeKey=");
088                    sb.append(fileEntryTypeKey);
089                    sb.append(", name=");
090                    sb.append(name);
091                    sb.append(", description=");
092                    sb.append(description);
093                    sb.append(", lastPublishDate=");
094                    sb.append(lastPublishDate);
095                    sb.append("}");
096    
097                    return sb.toString();
098            }
099    
100            @Override
101            public DLFileEntryType toEntityModel() {
102                    DLFileEntryTypeImpl dlFileEntryTypeImpl = new DLFileEntryTypeImpl();
103    
104                    if (uuid == null) {
105                            dlFileEntryTypeImpl.setUuid(StringPool.BLANK);
106                    }
107                    else {
108                            dlFileEntryTypeImpl.setUuid(uuid);
109                    }
110    
111                    dlFileEntryTypeImpl.setFileEntryTypeId(fileEntryTypeId);
112                    dlFileEntryTypeImpl.setGroupId(groupId);
113                    dlFileEntryTypeImpl.setCompanyId(companyId);
114                    dlFileEntryTypeImpl.setUserId(userId);
115    
116                    if (userName == null) {
117                            dlFileEntryTypeImpl.setUserName(StringPool.BLANK);
118                    }
119                    else {
120                            dlFileEntryTypeImpl.setUserName(userName);
121                    }
122    
123                    if (createDate == Long.MIN_VALUE) {
124                            dlFileEntryTypeImpl.setCreateDate(null);
125                    }
126                    else {
127                            dlFileEntryTypeImpl.setCreateDate(new Date(createDate));
128                    }
129    
130                    if (modifiedDate == Long.MIN_VALUE) {
131                            dlFileEntryTypeImpl.setModifiedDate(null);
132                    }
133                    else {
134                            dlFileEntryTypeImpl.setModifiedDate(new Date(modifiedDate));
135                    }
136    
137                    if (fileEntryTypeKey == null) {
138                            dlFileEntryTypeImpl.setFileEntryTypeKey(StringPool.BLANK);
139                    }
140                    else {
141                            dlFileEntryTypeImpl.setFileEntryTypeKey(fileEntryTypeKey);
142                    }
143    
144                    if (name == null) {
145                            dlFileEntryTypeImpl.setName(StringPool.BLANK);
146                    }
147                    else {
148                            dlFileEntryTypeImpl.setName(name);
149                    }
150    
151                    if (description == null) {
152                            dlFileEntryTypeImpl.setDescription(StringPool.BLANK);
153                    }
154                    else {
155                            dlFileEntryTypeImpl.setDescription(description);
156                    }
157    
158                    if (lastPublishDate == Long.MIN_VALUE) {
159                            dlFileEntryTypeImpl.setLastPublishDate(null);
160                    }
161                    else {
162                            dlFileEntryTypeImpl.setLastPublishDate(new Date(lastPublishDate));
163                    }
164    
165                    dlFileEntryTypeImpl.resetOriginalValues();
166    
167                    return dlFileEntryTypeImpl;
168            }
169    
170            @Override
171            public void readExternal(ObjectInput objectInput) throws IOException {
172                    uuid = objectInput.readUTF();
173                    fileEntryTypeId = objectInput.readLong();
174                    groupId = objectInput.readLong();
175                    companyId = objectInput.readLong();
176                    userId = objectInput.readLong();
177                    userName = objectInput.readUTF();
178                    createDate = objectInput.readLong();
179                    modifiedDate = objectInput.readLong();
180                    fileEntryTypeKey = objectInput.readUTF();
181                    name = objectInput.readUTF();
182                    description = objectInput.readUTF();
183                    lastPublishDate = objectInput.readLong();
184            }
185    
186            @Override
187            public void writeExternal(ObjectOutput objectOutput)
188                    throws IOException {
189                    if (uuid == null) {
190                            objectOutput.writeUTF(StringPool.BLANK);
191                    }
192                    else {
193                            objectOutput.writeUTF(uuid);
194                    }
195    
196                    objectOutput.writeLong(fileEntryTypeId);
197                    objectOutput.writeLong(groupId);
198                    objectOutput.writeLong(companyId);
199                    objectOutput.writeLong(userId);
200    
201                    if (userName == null) {
202                            objectOutput.writeUTF(StringPool.BLANK);
203                    }
204                    else {
205                            objectOutput.writeUTF(userName);
206                    }
207    
208                    objectOutput.writeLong(createDate);
209                    objectOutput.writeLong(modifiedDate);
210    
211                    if (fileEntryTypeKey == null) {
212                            objectOutput.writeUTF(StringPool.BLANK);
213                    }
214                    else {
215                            objectOutput.writeUTF(fileEntryTypeKey);
216                    }
217    
218                    if (name == null) {
219                            objectOutput.writeUTF(StringPool.BLANK);
220                    }
221                    else {
222                            objectOutput.writeUTF(name);
223                    }
224    
225                    if (description == null) {
226                            objectOutput.writeUTF(StringPool.BLANK);
227                    }
228                    else {
229                            objectOutput.writeUTF(description);
230                    }
231    
232                    objectOutput.writeLong(lastPublishDate);
233            }
234    
235            public String uuid;
236            public long fileEntryTypeId;
237            public long groupId;
238            public long companyId;
239            public long userId;
240            public String userName;
241            public long createDate;
242            public long modifiedDate;
243            public String fileEntryTypeKey;
244            public String name;
245            public String description;
246            public long lastPublishDate;
247    }