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.messageboards.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.messageboards.model.MBBan;
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 MBBan in entity cache.
035     *
036     * @author Brian Wing Shun Chan
037     * @see MBBan
038     * @generated
039     */
040    @ProviderType
041    public class MBBanCacheModel implements CacheModel<MBBan>, Externalizable {
042            @Override
043            public boolean equals(Object obj) {
044                    if (this == obj) {
045                            return true;
046                    }
047    
048                    if (!(obj instanceof MBBanCacheModel)) {
049                            return false;
050                    }
051    
052                    MBBanCacheModel mbBanCacheModel = (MBBanCacheModel)obj;
053    
054                    if (banId == mbBanCacheModel.banId) {
055                            return true;
056                    }
057    
058                    return false;
059            }
060    
061            @Override
062            public int hashCode() {
063                    return HashUtil.hash(0, banId);
064            }
065    
066            @Override
067            public String toString() {
068                    StringBundler sb = new StringBundler(21);
069    
070                    sb.append("{uuid=");
071                    sb.append(uuid);
072                    sb.append(", banId=");
073                    sb.append(banId);
074                    sb.append(", groupId=");
075                    sb.append(groupId);
076                    sb.append(", companyId=");
077                    sb.append(companyId);
078                    sb.append(", userId=");
079                    sb.append(userId);
080                    sb.append(", userName=");
081                    sb.append(userName);
082                    sb.append(", createDate=");
083                    sb.append(createDate);
084                    sb.append(", modifiedDate=");
085                    sb.append(modifiedDate);
086                    sb.append(", banUserId=");
087                    sb.append(banUserId);
088                    sb.append(", lastPublishDate=");
089                    sb.append(lastPublishDate);
090                    sb.append("}");
091    
092                    return sb.toString();
093            }
094    
095            @Override
096            public MBBan toEntityModel() {
097                    MBBanImpl mbBanImpl = new MBBanImpl();
098    
099                    if (uuid == null) {
100                            mbBanImpl.setUuid(StringPool.BLANK);
101                    }
102                    else {
103                            mbBanImpl.setUuid(uuid);
104                    }
105    
106                    mbBanImpl.setBanId(banId);
107                    mbBanImpl.setGroupId(groupId);
108                    mbBanImpl.setCompanyId(companyId);
109                    mbBanImpl.setUserId(userId);
110    
111                    if (userName == null) {
112                            mbBanImpl.setUserName(StringPool.BLANK);
113                    }
114                    else {
115                            mbBanImpl.setUserName(userName);
116                    }
117    
118                    if (createDate == Long.MIN_VALUE) {
119                            mbBanImpl.setCreateDate(null);
120                    }
121                    else {
122                            mbBanImpl.setCreateDate(new Date(createDate));
123                    }
124    
125                    if (modifiedDate == Long.MIN_VALUE) {
126                            mbBanImpl.setModifiedDate(null);
127                    }
128                    else {
129                            mbBanImpl.setModifiedDate(new Date(modifiedDate));
130                    }
131    
132                    mbBanImpl.setBanUserId(banUserId);
133    
134                    if (lastPublishDate == Long.MIN_VALUE) {
135                            mbBanImpl.setLastPublishDate(null);
136                    }
137                    else {
138                            mbBanImpl.setLastPublishDate(new Date(lastPublishDate));
139                    }
140    
141                    mbBanImpl.resetOriginalValues();
142    
143                    return mbBanImpl;
144            }
145    
146            @Override
147            public void readExternal(ObjectInput objectInput) throws IOException {
148                    uuid = objectInput.readUTF();
149                    banId = objectInput.readLong();
150                    groupId = objectInput.readLong();
151                    companyId = objectInput.readLong();
152                    userId = objectInput.readLong();
153                    userName = objectInput.readUTF();
154                    createDate = objectInput.readLong();
155                    modifiedDate = objectInput.readLong();
156                    banUserId = objectInput.readLong();
157                    lastPublishDate = objectInput.readLong();
158            }
159    
160            @Override
161            public void writeExternal(ObjectOutput objectOutput)
162                    throws IOException {
163                    if (uuid == null) {
164                            objectOutput.writeUTF(StringPool.BLANK);
165                    }
166                    else {
167                            objectOutput.writeUTF(uuid);
168                    }
169    
170                    objectOutput.writeLong(banId);
171                    objectOutput.writeLong(groupId);
172                    objectOutput.writeLong(companyId);
173                    objectOutput.writeLong(userId);
174    
175                    if (userName == null) {
176                            objectOutput.writeUTF(StringPool.BLANK);
177                    }
178                    else {
179                            objectOutput.writeUTF(userName);
180                    }
181    
182                    objectOutput.writeLong(createDate);
183                    objectOutput.writeLong(modifiedDate);
184                    objectOutput.writeLong(banUserId);
185                    objectOutput.writeLong(lastPublishDate);
186            }
187    
188            public String uuid;
189            public long banId;
190            public long groupId;
191            public long companyId;
192            public long userId;
193            public String userName;
194            public long createDate;
195            public long modifiedDate;
196            public long banUserId;
197            public long lastPublishDate;
198    }