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