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