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(23);
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("}");
094    
095                    return sb.toString();
096            }
097    
098            @Override
099            public DLFileEntryType toEntityModel() {
100                    DLFileEntryTypeImpl dlFileEntryTypeImpl = new DLFileEntryTypeImpl();
101    
102                    if (uuid == null) {
103                            dlFileEntryTypeImpl.setUuid(StringPool.BLANK);
104                    }
105                    else {
106                            dlFileEntryTypeImpl.setUuid(uuid);
107                    }
108    
109                    dlFileEntryTypeImpl.setFileEntryTypeId(fileEntryTypeId);
110                    dlFileEntryTypeImpl.setGroupId(groupId);
111                    dlFileEntryTypeImpl.setCompanyId(companyId);
112                    dlFileEntryTypeImpl.setUserId(userId);
113    
114                    if (userName == null) {
115                            dlFileEntryTypeImpl.setUserName(StringPool.BLANK);
116                    }
117                    else {
118                            dlFileEntryTypeImpl.setUserName(userName);
119                    }
120    
121                    if (createDate == Long.MIN_VALUE) {
122                            dlFileEntryTypeImpl.setCreateDate(null);
123                    }
124                    else {
125                            dlFileEntryTypeImpl.setCreateDate(new Date(createDate));
126                    }
127    
128                    if (modifiedDate == Long.MIN_VALUE) {
129                            dlFileEntryTypeImpl.setModifiedDate(null);
130                    }
131                    else {
132                            dlFileEntryTypeImpl.setModifiedDate(new Date(modifiedDate));
133                    }
134    
135                    if (fileEntryTypeKey == null) {
136                            dlFileEntryTypeImpl.setFileEntryTypeKey(StringPool.BLANK);
137                    }
138                    else {
139                            dlFileEntryTypeImpl.setFileEntryTypeKey(fileEntryTypeKey);
140                    }
141    
142                    if (name == null) {
143                            dlFileEntryTypeImpl.setName(StringPool.BLANK);
144                    }
145                    else {
146                            dlFileEntryTypeImpl.setName(name);
147                    }
148    
149                    if (description == null) {
150                            dlFileEntryTypeImpl.setDescription(StringPool.BLANK);
151                    }
152                    else {
153                            dlFileEntryTypeImpl.setDescription(description);
154                    }
155    
156                    dlFileEntryTypeImpl.resetOriginalValues();
157    
158                    return dlFileEntryTypeImpl;
159            }
160    
161            @Override
162            public void readExternal(ObjectInput objectInput) throws IOException {
163                    uuid = objectInput.readUTF();
164                    fileEntryTypeId = objectInput.readLong();
165                    groupId = objectInput.readLong();
166                    companyId = objectInput.readLong();
167                    userId = objectInput.readLong();
168                    userName = objectInput.readUTF();
169                    createDate = objectInput.readLong();
170                    modifiedDate = objectInput.readLong();
171                    fileEntryTypeKey = objectInput.readUTF();
172                    name = objectInput.readUTF();
173                    description = objectInput.readUTF();
174            }
175    
176            @Override
177            public void writeExternal(ObjectOutput objectOutput)
178                    throws IOException {
179                    if (uuid == null) {
180                            objectOutput.writeUTF(StringPool.BLANK);
181                    }
182                    else {
183                            objectOutput.writeUTF(uuid);
184                    }
185    
186                    objectOutput.writeLong(fileEntryTypeId);
187                    objectOutput.writeLong(groupId);
188                    objectOutput.writeLong(companyId);
189                    objectOutput.writeLong(userId);
190    
191                    if (userName == null) {
192                            objectOutput.writeUTF(StringPool.BLANK);
193                    }
194                    else {
195                            objectOutput.writeUTF(userName);
196                    }
197    
198                    objectOutput.writeLong(createDate);
199                    objectOutput.writeLong(modifiedDate);
200    
201                    if (fileEntryTypeKey == null) {
202                            objectOutput.writeUTF(StringPool.BLANK);
203                    }
204                    else {
205                            objectOutput.writeUTF(fileEntryTypeKey);
206                    }
207    
208                    if (name == null) {
209                            objectOutput.writeUTF(StringPool.BLANK);
210                    }
211                    else {
212                            objectOutput.writeUTF(name);
213                    }
214    
215                    if (description == null) {
216                            objectOutput.writeUTF(StringPool.BLANK);
217                    }
218                    else {
219                            objectOutput.writeUTF(description);
220                    }
221            }
222    
223            public String uuid;
224            public long fileEntryTypeId;
225            public long groupId;
226            public long companyId;
227            public long userId;
228            public String userName;
229            public long createDate;
230            public long modifiedDate;
231            public String fileEntryTypeKey;
232            public String name;
233            public String description;
234    }