1
22
23 package com.liferay.portal.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.DateUtil;
27 import com.liferay.portal.kernel.util.GetterUtil;
28 import com.liferay.portal.kernel.util.HtmlUtil;
29 import com.liferay.portal.model.EmailAddress;
30 import com.liferay.portal.model.EmailAddressSoap;
31 import com.liferay.portal.util.PortalUtil;
32 import com.liferay.portal.util.PropsUtil;
33
34 import java.io.Serializable;
35
36 import java.lang.reflect.Proxy;
37
38 import java.sql.Types;
39
40 import java.util.ArrayList;
41 import java.util.Date;
42 import java.util.List;
43
44
64 public class EmailAddressModelImpl extends BaseModelImpl {
65 public static final String TABLE_NAME = "EmailAddress";
66 public static final Object[][] TABLE_COLUMNS = {
67 { "emailAddressId", new Integer(Types.BIGINT) },
68
69
70 { "companyId", new Integer(Types.BIGINT) },
71
72
73 { "userId", new Integer(Types.BIGINT) },
74
75
76 { "userName", new Integer(Types.VARCHAR) },
77
78
79 { "createDate", new Integer(Types.TIMESTAMP) },
80
81
82 { "modifiedDate", new Integer(Types.TIMESTAMP) },
83
84
85 { "classNameId", new Integer(Types.BIGINT) },
86
87
88 { "classPK", new Integer(Types.BIGINT) },
89
90
91 { "address", new Integer(Types.VARCHAR) },
92
93
94 { "typeId", new Integer(Types.INTEGER) },
95
96
97 { "primary_", new Integer(Types.BOOLEAN) }
98 };
99 public static final String TABLE_SQL_CREATE = "create table EmailAddress (emailAddressId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK LONG,address VARCHAR(75) null,typeId INTEGER,primary_ BOOLEAN)";
100 public static final String TABLE_SQL_DROP = "drop table EmailAddress";
101 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
102 "value.object.finder.cache.enabled.com.liferay.portal.model.EmailAddress"),
103 true);
104
105 public static EmailAddress toModel(EmailAddressSoap soapModel) {
106 EmailAddress model = new EmailAddressImpl();
107
108 model.setEmailAddressId(soapModel.getEmailAddressId());
109 model.setCompanyId(soapModel.getCompanyId());
110 model.setUserId(soapModel.getUserId());
111 model.setUserName(soapModel.getUserName());
112 model.setCreateDate(soapModel.getCreateDate());
113 model.setModifiedDate(soapModel.getModifiedDate());
114 model.setClassNameId(soapModel.getClassNameId());
115 model.setClassPK(soapModel.getClassPK());
116 model.setAddress(soapModel.getAddress());
117 model.setTypeId(soapModel.getTypeId());
118 model.setPrimary(soapModel.getPrimary());
119
120 return model;
121 }
122
123 public static List<EmailAddress> toModels(EmailAddressSoap[] soapModels) {
124 List<EmailAddress> models = new ArrayList<EmailAddress>(soapModels.length);
125
126 for (EmailAddressSoap soapModel : soapModels) {
127 models.add(toModel(soapModel));
128 }
129
130 return models;
131 }
132
133 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
134 "lock.expiration.time.com.liferay.portal.model.EmailAddress"));
135
136 public EmailAddressModelImpl() {
137 }
138
139 public long getPrimaryKey() {
140 return _emailAddressId;
141 }
142
143 public void setPrimaryKey(long pk) {
144 setEmailAddressId(pk);
145 }
146
147 public Serializable getPrimaryKeyObj() {
148 return new Long(_emailAddressId);
149 }
150
151 public long getEmailAddressId() {
152 return _emailAddressId;
153 }
154
155 public void setEmailAddressId(long emailAddressId) {
156 if (emailAddressId != _emailAddressId) {
157 _emailAddressId = emailAddressId;
158 }
159 }
160
161 public long getCompanyId() {
162 return _companyId;
163 }
164
165 public void setCompanyId(long companyId) {
166 if (companyId != _companyId) {
167 _companyId = companyId;
168 }
169 }
170
171 public long getUserId() {
172 return _userId;
173 }
174
175 public void setUserId(long userId) {
176 if (userId != _userId) {
177 _userId = userId;
178 }
179 }
180
181 public String getUserName() {
182 return GetterUtil.getString(_userName);
183 }
184
185 public void setUserName(String userName) {
186 if (((userName == null) && (_userName != null)) ||
187 ((userName != null) && (_userName == null)) ||
188 ((userName != null) && (_userName != null) &&
189 !userName.equals(_userName))) {
190 _userName = userName;
191 }
192 }
193
194 public Date getCreateDate() {
195 return _createDate;
196 }
197
198 public void setCreateDate(Date createDate) {
199 if (((createDate == null) && (_createDate != null)) ||
200 ((createDate != null) && (_createDate == null)) ||
201 ((createDate != null) && (_createDate != null) &&
202 !createDate.equals(_createDate))) {
203 _createDate = createDate;
204 }
205 }
206
207 public Date getModifiedDate() {
208 return _modifiedDate;
209 }
210
211 public void setModifiedDate(Date modifiedDate) {
212 if (((modifiedDate == null) && (_modifiedDate != null)) ||
213 ((modifiedDate != null) && (_modifiedDate == null)) ||
214 ((modifiedDate != null) && (_modifiedDate != null) &&
215 !modifiedDate.equals(_modifiedDate))) {
216 _modifiedDate = modifiedDate;
217 }
218 }
219
220 public String getClassName() {
221 return PortalUtil.getClassName(getClassNameId());
222 }
223
224 public long getClassNameId() {
225 return _classNameId;
226 }
227
228 public void setClassNameId(long classNameId) {
229 if (classNameId != _classNameId) {
230 _classNameId = classNameId;
231 }
232 }
233
234 public long getClassPK() {
235 return _classPK;
236 }
237
238 public void setClassPK(long classPK) {
239 if (classPK != _classPK) {
240 _classPK = classPK;
241 }
242 }
243
244 public String getAddress() {
245 return GetterUtil.getString(_address);
246 }
247
248 public void setAddress(String address) {
249 if (((address == null) && (_address != null)) ||
250 ((address != null) && (_address == null)) ||
251 ((address != null) && (_address != null) &&
252 !address.equals(_address))) {
253 _address = address;
254 }
255 }
256
257 public int getTypeId() {
258 return _typeId;
259 }
260
261 public void setTypeId(int typeId) {
262 if (typeId != _typeId) {
263 _typeId = typeId;
264 }
265 }
266
267 public boolean getPrimary() {
268 return _primary;
269 }
270
271 public boolean isPrimary() {
272 return _primary;
273 }
274
275 public void setPrimary(boolean primary) {
276 if (primary != _primary) {
277 _primary = primary;
278 }
279 }
280
281 public EmailAddress toEscapedModel() {
282 if (isEscapedModel()) {
283 return (EmailAddress)this;
284 }
285 else {
286 EmailAddress model = new EmailAddressImpl();
287
288 model.setEscapedModel(true);
289
290 model.setEmailAddressId(getEmailAddressId());
291 model.setCompanyId(getCompanyId());
292 model.setUserId(getUserId());
293 model.setUserName(HtmlUtil.escape(getUserName()));
294 model.setCreateDate(getCreateDate());
295 model.setModifiedDate(getModifiedDate());
296 model.setClassNameId(getClassNameId());
297 model.setClassPK(getClassPK());
298 model.setAddress(HtmlUtil.escape(getAddress()));
299 model.setTypeId(getTypeId());
300 model.setPrimary(getPrimary());
301
302 model = (EmailAddress)Proxy.newProxyInstance(EmailAddress.class.getClassLoader(),
303 new Class[] { EmailAddress.class },
304 new ReadOnlyBeanHandler(model));
305
306 return model;
307 }
308 }
309
310 public Object clone() {
311 EmailAddressImpl clone = new EmailAddressImpl();
312
313 clone.setEmailAddressId(getEmailAddressId());
314 clone.setCompanyId(getCompanyId());
315 clone.setUserId(getUserId());
316 clone.setUserName(getUserName());
317 clone.setCreateDate(getCreateDate());
318 clone.setModifiedDate(getModifiedDate());
319 clone.setClassNameId(getClassNameId());
320 clone.setClassPK(getClassPK());
321 clone.setAddress(getAddress());
322 clone.setTypeId(getTypeId());
323 clone.setPrimary(getPrimary());
324
325 return clone;
326 }
327
328 public int compareTo(Object obj) {
329 if (obj == null) {
330 return -1;
331 }
332
333 EmailAddressImpl emailAddress = (EmailAddressImpl)obj;
334
335 int value = 0;
336
337 value = DateUtil.compareTo(getCreateDate(), emailAddress.getCreateDate());
338
339 if (value != 0) {
340 return value;
341 }
342
343 return 0;
344 }
345
346 public boolean equals(Object obj) {
347 if (obj == null) {
348 return false;
349 }
350
351 EmailAddressImpl emailAddress = null;
352
353 try {
354 emailAddress = (EmailAddressImpl)obj;
355 }
356 catch (ClassCastException cce) {
357 return false;
358 }
359
360 long pk = emailAddress.getPrimaryKey();
361
362 if (getPrimaryKey() == pk) {
363 return true;
364 }
365 else {
366 return false;
367 }
368 }
369
370 public int hashCode() {
371 return (int)getPrimaryKey();
372 }
373
374 private long _emailAddressId;
375 private long _companyId;
376 private long _userId;
377 private String _userName;
378 private Date _createDate;
379 private Date _modifiedDate;
380 private long _classNameId;
381 private long _classPK;
382 private String _address;
383 private int _typeId;
384 private boolean _primary;
385 }