001
014
015 package com.liferay.portal.model.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.model.CacheModel;
020 import com.liferay.portal.kernel.model.EmailAddress;
021 import com.liferay.portal.kernel.model.MVCCModel;
022 import com.liferay.portal.kernel.util.HashUtil;
023 import com.liferay.portal.kernel.util.StringBundler;
024 import com.liferay.portal.kernel.util.StringPool;
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
040 @ProviderType
041 public class EmailAddressCacheModel implements CacheModel<EmailAddress>,
042 Externalizable, MVCCModel {
043 @Override
044 public boolean equals(Object obj) {
045 if (this == obj) {
046 return true;
047 }
048
049 if (!(obj instanceof EmailAddressCacheModel)) {
050 return false;
051 }
052
053 EmailAddressCacheModel emailAddressCacheModel = (EmailAddressCacheModel)obj;
054
055 if ((emailAddressId == emailAddressCacheModel.emailAddressId) &&
056 (mvccVersion == emailAddressCacheModel.mvccVersion)) {
057 return true;
058 }
059
060 return false;
061 }
062
063 @Override
064 public int hashCode() {
065 int hashCode = HashUtil.hash(0, emailAddressId);
066
067 return HashUtil.hash(hashCode, mvccVersion);
068 }
069
070 @Override
071 public long getMvccVersion() {
072 return mvccVersion;
073 }
074
075 @Override
076 public void setMvccVersion(long mvccVersion) {
077 this.mvccVersion = mvccVersion;
078 }
079
080 @Override
081 public String toString() {
082 StringBundler sb = new StringBundler(27);
083
084 sb.append("{mvccVersion=");
085 sb.append(mvccVersion);
086 sb.append(", uuid=");
087 sb.append(uuid);
088 sb.append(", emailAddressId=");
089 sb.append(emailAddressId);
090 sb.append(", companyId=");
091 sb.append(companyId);
092 sb.append(", userId=");
093 sb.append(userId);
094 sb.append(", userName=");
095 sb.append(userName);
096 sb.append(", createDate=");
097 sb.append(createDate);
098 sb.append(", modifiedDate=");
099 sb.append(modifiedDate);
100 sb.append(", classNameId=");
101 sb.append(classNameId);
102 sb.append(", classPK=");
103 sb.append(classPK);
104 sb.append(", address=");
105 sb.append(address);
106 sb.append(", typeId=");
107 sb.append(typeId);
108 sb.append(", primary=");
109 sb.append(primary);
110 sb.append("}");
111
112 return sb.toString();
113 }
114
115 @Override
116 public EmailAddress toEntityModel() {
117 EmailAddressImpl emailAddressImpl = new EmailAddressImpl();
118
119 emailAddressImpl.setMvccVersion(mvccVersion);
120
121 if (uuid == null) {
122 emailAddressImpl.setUuid(StringPool.BLANK);
123 }
124 else {
125 emailAddressImpl.setUuid(uuid);
126 }
127
128 emailAddressImpl.setEmailAddressId(emailAddressId);
129 emailAddressImpl.setCompanyId(companyId);
130 emailAddressImpl.setUserId(userId);
131
132 if (userName == null) {
133 emailAddressImpl.setUserName(StringPool.BLANK);
134 }
135 else {
136 emailAddressImpl.setUserName(userName);
137 }
138
139 if (createDate == Long.MIN_VALUE) {
140 emailAddressImpl.setCreateDate(null);
141 }
142 else {
143 emailAddressImpl.setCreateDate(new Date(createDate));
144 }
145
146 if (modifiedDate == Long.MIN_VALUE) {
147 emailAddressImpl.setModifiedDate(null);
148 }
149 else {
150 emailAddressImpl.setModifiedDate(new Date(modifiedDate));
151 }
152
153 emailAddressImpl.setClassNameId(classNameId);
154 emailAddressImpl.setClassPK(classPK);
155
156 if (address == null) {
157 emailAddressImpl.setAddress(StringPool.BLANK);
158 }
159 else {
160 emailAddressImpl.setAddress(address);
161 }
162
163 emailAddressImpl.setTypeId(typeId);
164 emailAddressImpl.setPrimary(primary);
165
166 emailAddressImpl.resetOriginalValues();
167
168 return emailAddressImpl;
169 }
170
171 @Override
172 public void readExternal(ObjectInput objectInput) throws IOException {
173 mvccVersion = objectInput.readLong();
174 uuid = objectInput.readUTF();
175
176 emailAddressId = objectInput.readLong();
177
178 companyId = objectInput.readLong();
179
180 userId = objectInput.readLong();
181 userName = objectInput.readUTF();
182 createDate = objectInput.readLong();
183 modifiedDate = objectInput.readLong();
184
185 classNameId = objectInput.readLong();
186
187 classPK = objectInput.readLong();
188 address = objectInput.readUTF();
189
190 typeId = objectInput.readLong();
191
192 primary = objectInput.readBoolean();
193 }
194
195 @Override
196 public void writeExternal(ObjectOutput objectOutput)
197 throws IOException {
198 objectOutput.writeLong(mvccVersion);
199
200 if (uuid == null) {
201 objectOutput.writeUTF(StringPool.BLANK);
202 }
203 else {
204 objectOutput.writeUTF(uuid);
205 }
206
207 objectOutput.writeLong(emailAddressId);
208
209 objectOutput.writeLong(companyId);
210
211 objectOutput.writeLong(userId);
212
213 if (userName == null) {
214 objectOutput.writeUTF(StringPool.BLANK);
215 }
216 else {
217 objectOutput.writeUTF(userName);
218 }
219
220 objectOutput.writeLong(createDate);
221 objectOutput.writeLong(modifiedDate);
222
223 objectOutput.writeLong(classNameId);
224
225 objectOutput.writeLong(classPK);
226
227 if (address == null) {
228 objectOutput.writeUTF(StringPool.BLANK);
229 }
230 else {
231 objectOutput.writeUTF(address);
232 }
233
234 objectOutput.writeLong(typeId);
235
236 objectOutput.writeBoolean(primary);
237 }
238
239 public long mvccVersion;
240 public String uuid;
241 public long emailAddressId;
242 public long companyId;
243 public long userId;
244 public String userName;
245 public long createDate;
246 public long modifiedDate;
247 public long classNameId;
248 public long classPK;
249 public String address;
250 public long typeId;
251 public boolean primary;
252 }