1
14
15 package com.liferay.portal.model.impl;
16
17 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
18 import com.liferay.portal.kernel.exception.SystemException;
19 import com.liferay.portal.kernel.util.DateUtil;
20 import com.liferay.portal.kernel.util.GetterUtil;
21 import com.liferay.portal.kernel.util.HtmlUtil;
22 import com.liferay.portal.kernel.util.StringBundler;
23 import com.liferay.portal.kernel.util.StringPool;
24 import com.liferay.portal.model.EmailAddress;
25 import com.liferay.portal.model.EmailAddressSoap;
26 import com.liferay.portal.service.ServiceContext;
27 import com.liferay.portal.util.PortalUtil;
28
29 import com.liferay.portlet.expando.model.ExpandoBridge;
30 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
31
32 import java.io.Serializable;
33
34 import java.lang.reflect.Proxy;
35
36 import java.sql.Types;
37
38 import java.util.ArrayList;
39 import java.util.Date;
40 import java.util.List;
41
42
61 public class EmailAddressModelImpl extends BaseModelImpl<EmailAddress> {
62 public static final String TABLE_NAME = "EmailAddress";
63 public static final Object[][] TABLE_COLUMNS = {
64 { "emailAddressId", new Integer(Types.BIGINT) },
65 { "companyId", new Integer(Types.BIGINT) },
66 { "userId", new Integer(Types.BIGINT) },
67 { "userName", new Integer(Types.VARCHAR) },
68 { "createDate", new Integer(Types.TIMESTAMP) },
69 { "modifiedDate", new Integer(Types.TIMESTAMP) },
70 { "classNameId", new Integer(Types.BIGINT) },
71 { "classPK", new Integer(Types.BIGINT) },
72 { "address", new Integer(Types.VARCHAR) },
73 { "typeId", new Integer(Types.INTEGER) },
74 { "primary_", new Integer(Types.BOOLEAN) }
75 };
76 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)";
77 public static final String TABLE_SQL_DROP = "drop table EmailAddress";
78 public static final String ORDER_BY_JPQL = " ORDER BY emailAddress.createDate ASC";
79 public static final String ORDER_BY_SQL = " ORDER BY EmailAddress.createDate ASC";
80 public static final String DATA_SOURCE = "liferayDataSource";
81 public static final String SESSION_FACTORY = "liferaySessionFactory";
82 public static final String TX_MANAGER = "liferayTransactionManager";
83 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
84 "value.object.entity.cache.enabled.com.liferay.portal.model.EmailAddress"),
85 true);
86 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
87 "value.object.finder.cache.enabled.com.liferay.portal.model.EmailAddress"),
88 true);
89
90 public static EmailAddress toModel(EmailAddressSoap soapModel) {
91 EmailAddress model = new EmailAddressImpl();
92
93 model.setEmailAddressId(soapModel.getEmailAddressId());
94 model.setCompanyId(soapModel.getCompanyId());
95 model.setUserId(soapModel.getUserId());
96 model.setUserName(soapModel.getUserName());
97 model.setCreateDate(soapModel.getCreateDate());
98 model.setModifiedDate(soapModel.getModifiedDate());
99 model.setClassNameId(soapModel.getClassNameId());
100 model.setClassPK(soapModel.getClassPK());
101 model.setAddress(soapModel.getAddress());
102 model.setTypeId(soapModel.getTypeId());
103 model.setPrimary(soapModel.getPrimary());
104
105 return model;
106 }
107
108 public static List<EmailAddress> toModels(EmailAddressSoap[] soapModels) {
109 List<EmailAddress> models = new ArrayList<EmailAddress>(soapModels.length);
110
111 for (EmailAddressSoap soapModel : soapModels) {
112 models.add(toModel(soapModel));
113 }
114
115 return models;
116 }
117
118 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
119 "lock.expiration.time.com.liferay.portal.model.EmailAddress"));
120
121 public EmailAddressModelImpl() {
122 }
123
124 public long getPrimaryKey() {
125 return _emailAddressId;
126 }
127
128 public void setPrimaryKey(long pk) {
129 setEmailAddressId(pk);
130 }
131
132 public Serializable getPrimaryKeyObj() {
133 return new Long(_emailAddressId);
134 }
135
136 public long getEmailAddressId() {
137 return _emailAddressId;
138 }
139
140 public void setEmailAddressId(long emailAddressId) {
141 _emailAddressId = emailAddressId;
142 }
143
144 public long getCompanyId() {
145 return _companyId;
146 }
147
148 public void setCompanyId(long companyId) {
149 _companyId = companyId;
150 }
151
152 public long getUserId() {
153 return _userId;
154 }
155
156 public void setUserId(long userId) {
157 _userId = userId;
158 }
159
160 public String getUserUuid() throws SystemException {
161 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
162 }
163
164 public void setUserUuid(String userUuid) {
165 _userUuid = userUuid;
166 }
167
168 public String getUserName() {
169 return GetterUtil.getString(_userName);
170 }
171
172 public void setUserName(String userName) {
173 _userName = userName;
174 }
175
176 public Date getCreateDate() {
177 return _createDate;
178 }
179
180 public void setCreateDate(Date createDate) {
181 _createDate = createDate;
182 }
183
184 public Date getModifiedDate() {
185 return _modifiedDate;
186 }
187
188 public void setModifiedDate(Date modifiedDate) {
189 _modifiedDate = modifiedDate;
190 }
191
192 public String getClassName() {
193 if (getClassNameId() <= 0) {
194 return StringPool.BLANK;
195 }
196
197 return PortalUtil.getClassName(getClassNameId());
198 }
199
200 public long getClassNameId() {
201 return _classNameId;
202 }
203
204 public void setClassNameId(long classNameId) {
205 _classNameId = classNameId;
206 }
207
208 public long getClassPK() {
209 return _classPK;
210 }
211
212 public void setClassPK(long classPK) {
213 _classPK = classPK;
214 }
215
216 public String getAddress() {
217 return GetterUtil.getString(_address);
218 }
219
220 public void setAddress(String address) {
221 _address = address;
222 }
223
224 public int getTypeId() {
225 return _typeId;
226 }
227
228 public void setTypeId(int typeId) {
229 _typeId = typeId;
230 }
231
232 public boolean getPrimary() {
233 return _primary;
234 }
235
236 public boolean isPrimary() {
237 return _primary;
238 }
239
240 public void setPrimary(boolean primary) {
241 _primary = primary;
242 }
243
244 public EmailAddress toEscapedModel() {
245 if (isEscapedModel()) {
246 return (EmailAddress)this;
247 }
248 else {
249 EmailAddress model = new EmailAddressImpl();
250
251 model.setNew(isNew());
252 model.setEscapedModel(true);
253
254 model.setEmailAddressId(getEmailAddressId());
255 model.setCompanyId(getCompanyId());
256 model.setUserId(getUserId());
257 model.setUserName(HtmlUtil.escape(getUserName()));
258 model.setCreateDate(getCreateDate());
259 model.setModifiedDate(getModifiedDate());
260 model.setClassNameId(getClassNameId());
261 model.setClassPK(getClassPK());
262 model.setAddress(HtmlUtil.escape(getAddress()));
263 model.setTypeId(getTypeId());
264 model.setPrimary(getPrimary());
265
266 model = (EmailAddress)Proxy.newProxyInstance(EmailAddress.class.getClassLoader(),
267 new Class[] { EmailAddress.class },
268 new ReadOnlyBeanHandler(model));
269
270 return model;
271 }
272 }
273
274 public ExpandoBridge getExpandoBridge() {
275 if (_expandoBridge == null) {
276 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
277 EmailAddress.class.getName(), getPrimaryKey());
278 }
279
280 return _expandoBridge;
281 }
282
283 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
284 getExpandoBridge().setAttributes(serviceContext);
285 }
286
287 public Object clone() {
288 EmailAddressImpl clone = new EmailAddressImpl();
289
290 clone.setEmailAddressId(getEmailAddressId());
291 clone.setCompanyId(getCompanyId());
292 clone.setUserId(getUserId());
293 clone.setUserName(getUserName());
294 clone.setCreateDate(getCreateDate());
295 clone.setModifiedDate(getModifiedDate());
296 clone.setClassNameId(getClassNameId());
297 clone.setClassPK(getClassPK());
298 clone.setAddress(getAddress());
299 clone.setTypeId(getTypeId());
300 clone.setPrimary(getPrimary());
301
302 return clone;
303 }
304
305 public int compareTo(EmailAddress emailAddress) {
306 int value = 0;
307
308 value = DateUtil.compareTo(getCreateDate(), emailAddress.getCreateDate());
309
310 if (value != 0) {
311 return value;
312 }
313
314 return 0;
315 }
316
317 public boolean equals(Object obj) {
318 if (obj == null) {
319 return false;
320 }
321
322 EmailAddress emailAddress = null;
323
324 try {
325 emailAddress = (EmailAddress)obj;
326 }
327 catch (ClassCastException cce) {
328 return false;
329 }
330
331 long pk = emailAddress.getPrimaryKey();
332
333 if (getPrimaryKey() == pk) {
334 return true;
335 }
336 else {
337 return false;
338 }
339 }
340
341 public int hashCode() {
342 return (int)getPrimaryKey();
343 }
344
345 public String toString() {
346 StringBundler sb = new StringBundler(23);
347
348 sb.append("{emailAddressId=");
349 sb.append(getEmailAddressId());
350 sb.append(", companyId=");
351 sb.append(getCompanyId());
352 sb.append(", userId=");
353 sb.append(getUserId());
354 sb.append(", userName=");
355 sb.append(getUserName());
356 sb.append(", createDate=");
357 sb.append(getCreateDate());
358 sb.append(", modifiedDate=");
359 sb.append(getModifiedDate());
360 sb.append(", classNameId=");
361 sb.append(getClassNameId());
362 sb.append(", classPK=");
363 sb.append(getClassPK());
364 sb.append(", address=");
365 sb.append(getAddress());
366 sb.append(", typeId=");
367 sb.append(getTypeId());
368 sb.append(", primary=");
369 sb.append(getPrimary());
370 sb.append("}");
371
372 return sb.toString();
373 }
374
375 public String toXmlString() {
376 StringBundler sb = new StringBundler(37);
377
378 sb.append("<model><model-name>");
379 sb.append("com.liferay.portal.model.EmailAddress");
380 sb.append("</model-name>");
381
382 sb.append(
383 "<column><column-name>emailAddressId</column-name><column-value><![CDATA[");
384 sb.append(getEmailAddressId());
385 sb.append("]]></column-value></column>");
386 sb.append(
387 "<column><column-name>companyId</column-name><column-value><![CDATA[");
388 sb.append(getCompanyId());
389 sb.append("]]></column-value></column>");
390 sb.append(
391 "<column><column-name>userId</column-name><column-value><![CDATA[");
392 sb.append(getUserId());
393 sb.append("]]></column-value></column>");
394 sb.append(
395 "<column><column-name>userName</column-name><column-value><![CDATA[");
396 sb.append(getUserName());
397 sb.append("]]></column-value></column>");
398 sb.append(
399 "<column><column-name>createDate</column-name><column-value><![CDATA[");
400 sb.append(getCreateDate());
401 sb.append("]]></column-value></column>");
402 sb.append(
403 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
404 sb.append(getModifiedDate());
405 sb.append("]]></column-value></column>");
406 sb.append(
407 "<column><column-name>classNameId</column-name><column-value><![CDATA[");
408 sb.append(getClassNameId());
409 sb.append("]]></column-value></column>");
410 sb.append(
411 "<column><column-name>classPK</column-name><column-value><![CDATA[");
412 sb.append(getClassPK());
413 sb.append("]]></column-value></column>");
414 sb.append(
415 "<column><column-name>address</column-name><column-value><![CDATA[");
416 sb.append(getAddress());
417 sb.append("]]></column-value></column>");
418 sb.append(
419 "<column><column-name>typeId</column-name><column-value><![CDATA[");
420 sb.append(getTypeId());
421 sb.append("]]></column-value></column>");
422 sb.append(
423 "<column><column-name>primary</column-name><column-value><![CDATA[");
424 sb.append(getPrimary());
425 sb.append("]]></column-value></column>");
426
427 sb.append("</model>");
428
429 return sb.toString();
430 }
431
432 private long _emailAddressId;
433 private long _companyId;
434 private long _userId;
435 private String _userUuid;
436 private String _userName;
437 private Date _createDate;
438 private Date _modifiedDate;
439 private long _classNameId;
440 private long _classPK;
441 private String _address;
442 private int _typeId;
443 private boolean _primary;
444 private transient ExpandoBridge _expandoBridge;
445 }