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.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.CacheModel;
022    import com.liferay.portal.model.MVCCModel;
023    import com.liferay.portal.model.Team;
024    
025    import java.io.Externalizable;
026    import java.io.IOException;
027    import java.io.ObjectInput;
028    import java.io.ObjectOutput;
029    
030    import java.util.Date;
031    
032    /**
033     * The cache model class for representing Team in entity cache.
034     *
035     * @author Brian Wing Shun Chan
036     * @see Team
037     * @generated
038     */
039    @ProviderType
040    public class TeamCacheModel implements CacheModel<Team>, Externalizable,
041            MVCCModel {
042            @Override
043            public long getMvccVersion() {
044                    return mvccVersion;
045            }
046    
047            @Override
048            public void setMvccVersion(long mvccVersion) {
049                    this.mvccVersion = mvccVersion;
050            }
051    
052            @Override
053            public String toString() {
054                    StringBundler sb = new StringBundler(21);
055    
056                    sb.append("{mvccVersion=");
057                    sb.append(mvccVersion);
058                    sb.append(", teamId=");
059                    sb.append(teamId);
060                    sb.append(", companyId=");
061                    sb.append(companyId);
062                    sb.append(", userId=");
063                    sb.append(userId);
064                    sb.append(", userName=");
065                    sb.append(userName);
066                    sb.append(", createDate=");
067                    sb.append(createDate);
068                    sb.append(", modifiedDate=");
069                    sb.append(modifiedDate);
070                    sb.append(", groupId=");
071                    sb.append(groupId);
072                    sb.append(", name=");
073                    sb.append(name);
074                    sb.append(", description=");
075                    sb.append(description);
076                    sb.append("}");
077    
078                    return sb.toString();
079            }
080    
081            @Override
082            public Team toEntityModel() {
083                    TeamImpl teamImpl = new TeamImpl();
084    
085                    teamImpl.setMvccVersion(mvccVersion);
086                    teamImpl.setTeamId(teamId);
087                    teamImpl.setCompanyId(companyId);
088                    teamImpl.setUserId(userId);
089    
090                    if (userName == null) {
091                            teamImpl.setUserName(StringPool.BLANK);
092                    }
093                    else {
094                            teamImpl.setUserName(userName);
095                    }
096    
097                    if (createDate == Long.MIN_VALUE) {
098                            teamImpl.setCreateDate(null);
099                    }
100                    else {
101                            teamImpl.setCreateDate(new Date(createDate));
102                    }
103    
104                    if (modifiedDate == Long.MIN_VALUE) {
105                            teamImpl.setModifiedDate(null);
106                    }
107                    else {
108                            teamImpl.setModifiedDate(new Date(modifiedDate));
109                    }
110    
111                    teamImpl.setGroupId(groupId);
112    
113                    if (name == null) {
114                            teamImpl.setName(StringPool.BLANK);
115                    }
116                    else {
117                            teamImpl.setName(name);
118                    }
119    
120                    if (description == null) {
121                            teamImpl.setDescription(StringPool.BLANK);
122                    }
123                    else {
124                            teamImpl.setDescription(description);
125                    }
126    
127                    teamImpl.resetOriginalValues();
128    
129                    return teamImpl;
130            }
131    
132            @Override
133            public void readExternal(ObjectInput objectInput) throws IOException {
134                    mvccVersion = objectInput.readLong();
135                    teamId = objectInput.readLong();
136                    companyId = objectInput.readLong();
137                    userId = objectInput.readLong();
138                    userName = objectInput.readUTF();
139                    createDate = objectInput.readLong();
140                    modifiedDate = objectInput.readLong();
141                    groupId = objectInput.readLong();
142                    name = objectInput.readUTF();
143                    description = objectInput.readUTF();
144            }
145    
146            @Override
147            public void writeExternal(ObjectOutput objectOutput)
148                    throws IOException {
149                    objectOutput.writeLong(mvccVersion);
150                    objectOutput.writeLong(teamId);
151                    objectOutput.writeLong(companyId);
152                    objectOutput.writeLong(userId);
153    
154                    if (userName == null) {
155                            objectOutput.writeUTF(StringPool.BLANK);
156                    }
157                    else {
158                            objectOutput.writeUTF(userName);
159                    }
160    
161                    objectOutput.writeLong(createDate);
162                    objectOutput.writeLong(modifiedDate);
163                    objectOutput.writeLong(groupId);
164    
165                    if (name == null) {
166                            objectOutput.writeUTF(StringPool.BLANK);
167                    }
168                    else {
169                            objectOutput.writeUTF(name);
170                    }
171    
172                    if (description == null) {
173                            objectOutput.writeUTF(StringPool.BLANK);
174                    }
175                    else {
176                            objectOutput.writeUTF(description);
177                    }
178            }
179    
180            public long mvccVersion;
181            public long teamId;
182            public long companyId;
183            public long userId;
184            public String userName;
185            public long createDate;
186            public long modifiedDate;
187            public long groupId;
188            public String name;
189            public String description;
190    }