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            @Override
065            public Team toEntityModel() {
066                    TeamImpl teamImpl = new TeamImpl();
067    
068                    teamImpl.setTeamId(teamId);
069                    teamImpl.setCompanyId(companyId);
070                    teamImpl.setUserId(userId);
071    
072                    if (userName == null) {
073                            teamImpl.setUserName(StringPool.BLANK);
074                    }
075                    else {
076                            teamImpl.setUserName(userName);
077                    }
078    
079                    if (createDate == Long.MIN_VALUE) {
080                            teamImpl.setCreateDate(null);
081                    }
082                    else {
083                            teamImpl.setCreateDate(new Date(createDate));
084                    }
085    
086                    if (modifiedDate == Long.MIN_VALUE) {
087                            teamImpl.setModifiedDate(null);
088                    }
089                    else {
090                            teamImpl.setModifiedDate(new Date(modifiedDate));
091                    }
092    
093                    teamImpl.setGroupId(groupId);
094    
095                    if (name == null) {
096                            teamImpl.setName(StringPool.BLANK);
097                    }
098                    else {
099                            teamImpl.setName(name);
100                    }
101    
102                    if (description == null) {
103                            teamImpl.setDescription(StringPool.BLANK);
104                    }
105                    else {
106                            teamImpl.setDescription(description);
107                    }
108    
109                    teamImpl.resetOriginalValues();
110    
111                    return teamImpl;
112            }
113    
114            @Override
115            public void readExternal(ObjectInput objectInput) throws IOException {
116                    teamId = objectInput.readLong();
117                    companyId = objectInput.readLong();
118                    userId = objectInput.readLong();
119                    userName = objectInput.readUTF();
120                    createDate = objectInput.readLong();
121                    modifiedDate = objectInput.readLong();
122                    groupId = objectInput.readLong();
123                    name = objectInput.readUTF();
124                    description = objectInput.readUTF();
125            }
126    
127            @Override
128            public void writeExternal(ObjectOutput objectOutput)
129                    throws IOException {
130                    objectOutput.writeLong(teamId);
131                    objectOutput.writeLong(companyId);
132                    objectOutput.writeLong(userId);
133    
134                    if (userName == null) {
135                            objectOutput.writeUTF(StringPool.BLANK);
136                    }
137                    else {
138                            objectOutput.writeUTF(userName);
139                    }
140    
141                    objectOutput.writeLong(createDate);
142                    objectOutput.writeLong(modifiedDate);
143                    objectOutput.writeLong(groupId);
144    
145                    if (name == null) {
146                            objectOutput.writeUTF(StringPool.BLANK);
147                    }
148                    else {
149                            objectOutput.writeUTF(name);
150                    }
151    
152                    if (description == null) {
153                            objectOutput.writeUTF(StringPool.BLANK);
154                    }
155                    else {
156                            objectOutput.writeUTF(description);
157                    }
158            }
159    
160            public long teamId;
161            public long companyId;
162            public long userId;
163            public String userName;
164            public long createDate;
165            public long modifiedDate;
166            public long groupId;
167            public String name;
168            public String description;
169    }