1
19
20 package com.liferay.portal.model.impl;
21
22 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23 import com.liferay.portal.kernel.util.DateUtil;
24 import com.liferay.portal.kernel.util.GetterUtil;
25 import com.liferay.portal.kernel.util.HtmlUtil;
26 import com.liferay.portal.kernel.util.StringPool;
27 import com.liferay.portal.model.EmailAddress;
28 import com.liferay.portal.model.EmailAddressSoap;
29 import com.liferay.portal.util.PortalUtil;
30
31 import java.io.Serializable;
32
33 import java.lang.reflect.Proxy;
34
35 import java.sql.Types;
36
37 import java.util.ArrayList;
38 import java.util.Date;
39 import java.util.List;
40
41
61 public class EmailAddressModelImpl extends BaseModelImpl {
62 public static final String TABLE_NAME = "EmailAddress";
63 public static final Object[][] TABLE_COLUMNS = {
64 { "emailAddressId", new Integer(Types.BIGINT) },
65
66
67 { "companyId", new Integer(Types.BIGINT) },
68
69
70 { "userId", new Integer(Types.BIGINT) },
71
72
73 { "userName", new Integer(Types.VARCHAR) },
74
75
76 { "createDate", new Integer(Types.TIMESTAMP) },
77
78
79 { "modifiedDate", new Integer(Types.TIMESTAMP) },
80
81
82 { "classNameId", new Integer(Types.BIGINT) },
83
84
85 { "classPK", new Integer(Types.BIGINT) },
86
87
88 { "address", new Integer(Types.VARCHAR) },
89
90
91 { "typeId", new Integer(Types.INTEGER) },
92
93
94 { "primary_", new Integer(Types.BOOLEAN) }
95 };
96 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)";
97 public static final String TABLE_SQL_DROP = "drop table EmailAddress";
98 public static final String DATA_SOURCE = "liferayDataSource";
99 public static final String SESSION_FACTORY = "liferaySessionFactory";
100 public static final String TX_MANAGER = "liferayTransactionManager";
101 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.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(com.liferay.portal.util.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 if (getClassNameId() <= 0) {
222 return StringPool.BLANK;
223 }
224
225 return PortalUtil.getClassName(getClassNameId());
226 }
227
228 public long getClassNameId() {
229 return _classNameId;
230 }
231
232 public void setClassNameId(long classNameId) {
233 if (classNameId != _classNameId) {
234 _classNameId = classNameId;
235 }
236 }
237
238 public long getClassPK() {
239 return _classPK;
240 }
241
242 public void setClassPK(long classPK) {
243 if (classPK != _classPK) {
244 _classPK = classPK;
245 }
246 }
247
248 public String getAddress() {
249 return GetterUtil.getString(_address);
250 }
251
252 public void setAddress(String address) {
253 if (((address == null) && (_address != null)) ||
254 ((address != null) && (_address == null)) ||
255 ((address != null) && (_address != null) &&
256 !address.equals(_address))) {
257 _address = address;
258 }
259 }
260
261 public int getTypeId() {
262 return _typeId;
263 }
264
265 public void setTypeId(int typeId) {
266 if (typeId != _typeId) {
267 _typeId = typeId;
268 }
269 }
270
271 public boolean getPrimary() {
272 return _primary;
273 }
274
275 public boolean isPrimary() {
276 return _primary;
277 }
278
279 public void setPrimary(boolean primary) {
280 if (primary != _primary) {
281 _primary = primary;
282 }
283 }
284
285 public EmailAddress toEscapedModel() {
286 if (isEscapedModel()) {
287 return (EmailAddress)this;
288 }
289 else {
290 EmailAddress model = new EmailAddressImpl();
291
292 model.setNew(isNew());
293 model.setEscapedModel(true);
294
295 model.setEmailAddressId(getEmailAddressId());
296 model.setCompanyId(getCompanyId());
297 model.setUserId(getUserId());
298 model.setUserName(HtmlUtil.escape(getUserName()));
299 model.setCreateDate(getCreateDate());
300 model.setModifiedDate(getModifiedDate());
301 model.setClassNameId(getClassNameId());
302 model.setClassPK(getClassPK());
303 model.setAddress(HtmlUtil.escape(getAddress()));
304 model.setTypeId(getTypeId());
305 model.setPrimary(getPrimary());
306
307 model = (EmailAddress)Proxy.newProxyInstance(EmailAddress.class.getClassLoader(),
308 new Class[] { EmailAddress.class },
309 new ReadOnlyBeanHandler(model));
310
311 return model;
312 }
313 }
314
315 public Object clone() {
316 EmailAddressImpl clone = new EmailAddressImpl();
317
318 clone.setEmailAddressId(getEmailAddressId());
319 clone.setCompanyId(getCompanyId());
320 clone.setUserId(getUserId());
321 clone.setUserName(getUserName());
322 clone.setCreateDate(getCreateDate());
323 clone.setModifiedDate(getModifiedDate());
324 clone.setClassNameId(getClassNameId());
325 clone.setClassPK(getClassPK());
326 clone.setAddress(getAddress());
327 clone.setTypeId(getTypeId());
328 clone.setPrimary(getPrimary());
329
330 return clone;
331 }
332
333 public int compareTo(Object obj) {
334 if (obj == null) {
335 return -1;
336 }
337
338 EmailAddressImpl emailAddress = (EmailAddressImpl)obj;
339
340 int value = 0;
341
342 value = DateUtil.compareTo(getCreateDate(), emailAddress.getCreateDate());
343
344 if (value != 0) {
345 return value;
346 }
347
348 return 0;
349 }
350
351 public boolean equals(Object obj) {
352 if (obj == null) {
353 return false;
354 }
355
356 EmailAddressImpl emailAddress = null;
357
358 try {
359 emailAddress = (EmailAddressImpl)obj;
360 }
361 catch (ClassCastException cce) {
362 return false;
363 }
364
365 long pk = emailAddress.getPrimaryKey();
366
367 if (getPrimaryKey() == pk) {
368 return true;
369 }
370 else {
371 return false;
372 }
373 }
374
375 public int hashCode() {
376 return (int)getPrimaryKey();
377 }
378
379 private long _emailAddressId;
380 private long _companyId;
381 private long _userId;
382 private String _userName;
383 private Date _createDate;
384 private Date _modifiedDate;
385 private long _classNameId;
386 private long _classPK;
387 private String _address;
388 private int _typeId;
389 private boolean _primary;
390 }