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