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(19);
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("}");
089    
090                    return sb.toString();
091            }
092    
093            @Override
094            public MBBan toEntityModel() {
095                    MBBanImpl mbBanImpl = new MBBanImpl();
096    
097                    if (uuid == null) {
098                            mbBanImpl.setUuid(StringPool.BLANK);
099                    }
100                    else {
101                            mbBanImpl.setUuid(uuid);
102                    }
103    
104                    mbBanImpl.setBanId(banId);
105                    mbBanImpl.setGroupId(groupId);
106                    mbBanImpl.setCompanyId(companyId);
107                    mbBanImpl.setUserId(userId);
108    
109                    if (userName == null) {
110                            mbBanImpl.setUserName(StringPool.BLANK);
111                    }
112                    else {
113                            mbBanImpl.setUserName(userName);
114                    }
115    
116                    if (createDate == Long.MIN_VALUE) {
117                            mbBanImpl.setCreateDate(null);
118                    }
119                    else {
120                            mbBanImpl.setCreateDate(new Date(createDate));
121                    }
122    
123                    if (modifiedDate == Long.MIN_VALUE) {
124                            mbBanImpl.setModifiedDate(null);
125                    }
126                    else {
127                            mbBanImpl.setModifiedDate(new Date(modifiedDate));
128                    }
129    
130                    mbBanImpl.setBanUserId(banUserId);
131    
132                    mbBanImpl.resetOriginalValues();
133    
134                    return mbBanImpl;
135            }
136    
137            @Override
138            public void readExternal(ObjectInput objectInput) throws IOException {
139                    uuid = objectInput.readUTF();
140                    banId = objectInput.readLong();
141                    groupId = objectInput.readLong();
142                    companyId = objectInput.readLong();
143                    userId = objectInput.readLong();
144                    userName = objectInput.readUTF();
145                    createDate = objectInput.readLong();
146                    modifiedDate = objectInput.readLong();
147                    banUserId = objectInput.readLong();
148            }
149    
150            @Override
151            public void writeExternal(ObjectOutput objectOutput)
152                    throws IOException {
153                    if (uuid == null) {
154                            objectOutput.writeUTF(StringPool.BLANK);
155                    }
156                    else {
157                            objectOutput.writeUTF(uuid);
158                    }
159    
160                    objectOutput.writeLong(banId);
161                    objectOutput.writeLong(groupId);
162                    objectOutput.writeLong(companyId);
163                    objectOutput.writeLong(userId);
164    
165                    if (userName == null) {
166                            objectOutput.writeUTF(StringPool.BLANK);
167                    }
168                    else {
169                            objectOutput.writeUTF(userName);
170                    }
171    
172                    objectOutput.writeLong(createDate);
173                    objectOutput.writeLong(modifiedDate);
174                    objectOutput.writeLong(banUserId);
175            }
176    
177            public String uuid;
178            public long banId;
179            public long groupId;
180            public long companyId;
181            public long userId;
182            public String userName;
183            public long createDate;
184            public long modifiedDate;
185            public long banUserId;
186    }