001
014
015 package com.liferay.portal.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.util.DateUtil;
020 import com.liferay.portal.kernel.util.GetterUtil;
021 import com.liferay.portal.kernel.util.StringBundler;
022 import com.liferay.portal.kernel.util.StringPool;
023 import com.liferay.portal.model.EmailAddress;
024 import com.liferay.portal.model.EmailAddressModel;
025 import com.liferay.portal.model.EmailAddressSoap;
026 import com.liferay.portal.service.ServiceContext;
027 import com.liferay.portal.util.PortalUtil;
028
029 import com.liferay.portlet.expando.model.ExpandoBridge;
030 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
031
032 import java.io.Serializable;
033
034 import java.lang.reflect.Proxy;
035
036 import java.sql.Types;
037
038 import java.util.ArrayList;
039 import java.util.Date;
040 import java.util.List;
041
042
059 public class EmailAddressModelImpl extends BaseModelImpl<EmailAddress>
060 implements EmailAddressModel {
061 public static final String TABLE_NAME = "EmailAddress";
062 public static final Object[][] TABLE_COLUMNS = {
063 { "emailAddressId", new Integer(Types.BIGINT) },
064 { "companyId", new Integer(Types.BIGINT) },
065 { "userId", new Integer(Types.BIGINT) },
066 { "userName", new Integer(Types.VARCHAR) },
067 { "createDate", new Integer(Types.TIMESTAMP) },
068 { "modifiedDate", new Integer(Types.TIMESTAMP) },
069 { "classNameId", new Integer(Types.BIGINT) },
070 { "classPK", new Integer(Types.BIGINT) },
071 { "address", new Integer(Types.VARCHAR) },
072 { "typeId", new Integer(Types.INTEGER) },
073 { "primary_", new Integer(Types.BOOLEAN) }
074 };
075 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)";
076 public static final String TABLE_SQL_DROP = "drop table EmailAddress";
077 public static final String ORDER_BY_JPQL = " ORDER BY emailAddress.createDate ASC";
078 public static final String ORDER_BY_SQL = " ORDER BY EmailAddress.createDate ASC";
079 public static final String DATA_SOURCE = "liferayDataSource";
080 public static final String SESSION_FACTORY = "liferaySessionFactory";
081 public static final String TX_MANAGER = "liferayTransactionManager";
082 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
083 "value.object.entity.cache.enabled.com.liferay.portal.model.EmailAddress"),
084 true);
085 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
086 "value.object.finder.cache.enabled.com.liferay.portal.model.EmailAddress"),
087 true);
088
089
095 public static EmailAddress toModel(EmailAddressSoap soapModel) {
096 EmailAddress model = new EmailAddressImpl();
097
098 model.setEmailAddressId(soapModel.getEmailAddressId());
099 model.setCompanyId(soapModel.getCompanyId());
100 model.setUserId(soapModel.getUserId());
101 model.setUserName(soapModel.getUserName());
102 model.setCreateDate(soapModel.getCreateDate());
103 model.setModifiedDate(soapModel.getModifiedDate());
104 model.setClassNameId(soapModel.getClassNameId());
105 model.setClassPK(soapModel.getClassPK());
106 model.setAddress(soapModel.getAddress());
107 model.setTypeId(soapModel.getTypeId());
108 model.setPrimary(soapModel.getPrimary());
109
110 return model;
111 }
112
113
119 public static List<EmailAddress> toModels(EmailAddressSoap[] soapModels) {
120 List<EmailAddress> models = new ArrayList<EmailAddress>(soapModels.length);
121
122 for (EmailAddressSoap soapModel : soapModels) {
123 models.add(toModel(soapModel));
124 }
125
126 return models;
127 }
128
129 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
130 "lock.expiration.time.com.liferay.portal.model.EmailAddress"));
131
132 public EmailAddressModelImpl() {
133 }
134
135 public long getPrimaryKey() {
136 return _emailAddressId;
137 }
138
139 public void setPrimaryKey(long pk) {
140 setEmailAddressId(pk);
141 }
142
143 public Serializable getPrimaryKeyObj() {
144 return new Long(_emailAddressId);
145 }
146
147 public long getEmailAddressId() {
148 return _emailAddressId;
149 }
150
151 public void setEmailAddressId(long emailAddressId) {
152 _emailAddressId = emailAddressId;
153 }
154
155 public long getCompanyId() {
156 return _companyId;
157 }
158
159 public void setCompanyId(long companyId) {
160 _companyId = companyId;
161 }
162
163 public long getUserId() {
164 return _userId;
165 }
166
167 public void setUserId(long userId) {
168 _userId = userId;
169 }
170
171 public String getUserUuid() throws SystemException {
172 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
173 }
174
175 public void setUserUuid(String userUuid) {
176 _userUuid = userUuid;
177 }
178
179 public String getUserName() {
180 if (_userName == null) {
181 return StringPool.BLANK;
182 }
183 else {
184 return _userName;
185 }
186 }
187
188 public void setUserName(String userName) {
189 _userName = userName;
190 }
191
192 public Date getCreateDate() {
193 return _createDate;
194 }
195
196 public void setCreateDate(Date createDate) {
197 _createDate = createDate;
198 }
199
200 public Date getModifiedDate() {
201 return _modifiedDate;
202 }
203
204 public void setModifiedDate(Date modifiedDate) {
205 _modifiedDate = modifiedDate;
206 }
207
208 public String getClassName() {
209 if (getClassNameId() <= 0) {
210 return StringPool.BLANK;
211 }
212
213 return PortalUtil.getClassName(getClassNameId());
214 }
215
216 public long getClassNameId() {
217 return _classNameId;
218 }
219
220 public void setClassNameId(long classNameId) {
221 _classNameId = classNameId;
222 }
223
224 public long getClassPK() {
225 return _classPK;
226 }
227
228 public void setClassPK(long classPK) {
229 _classPK = classPK;
230 }
231
232 public String getAddress() {
233 if (_address == null) {
234 return StringPool.BLANK;
235 }
236 else {
237 return _address;
238 }
239 }
240
241 public void setAddress(String address) {
242 _address = address;
243 }
244
245 public int getTypeId() {
246 return _typeId;
247 }
248
249 public void setTypeId(int typeId) {
250 _typeId = typeId;
251 }
252
253 public boolean getPrimary() {
254 return _primary;
255 }
256
257 public boolean isPrimary() {
258 return _primary;
259 }
260
261 public void setPrimary(boolean primary) {
262 _primary = primary;
263 }
264
265 public EmailAddress toEscapedModel() {
266 if (isEscapedModel()) {
267 return (EmailAddress)this;
268 }
269 else {
270 return (EmailAddress)Proxy.newProxyInstance(EmailAddress.class.getClassLoader(),
271 new Class[] { EmailAddress.class },
272 new AutoEscapeBeanHandler(this));
273 }
274 }
275
276 public ExpandoBridge getExpandoBridge() {
277 if (_expandoBridge == null) {
278 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
279 EmailAddress.class.getName(), getPrimaryKey());
280 }
281
282 return _expandoBridge;
283 }
284
285 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
286 getExpandoBridge().setAttributes(serviceContext);
287 }
288
289 public Object clone() {
290 EmailAddressImpl clone = new EmailAddressImpl();
291
292 clone.setEmailAddressId(getEmailAddressId());
293 clone.setCompanyId(getCompanyId());
294 clone.setUserId(getUserId());
295 clone.setUserName(getUserName());
296 clone.setCreateDate(getCreateDate());
297 clone.setModifiedDate(getModifiedDate());
298 clone.setClassNameId(getClassNameId());
299 clone.setClassPK(getClassPK());
300 clone.setAddress(getAddress());
301 clone.setTypeId(getTypeId());
302 clone.setPrimary(getPrimary());
303
304 return clone;
305 }
306
307 public int compareTo(EmailAddress emailAddress) {
308 int value = 0;
309
310 value = DateUtil.compareTo(getCreateDate(), emailAddress.getCreateDate());
311
312 if (value != 0) {
313 return value;
314 }
315
316 return 0;
317 }
318
319 public boolean equals(Object obj) {
320 if (obj == null) {
321 return false;
322 }
323
324 EmailAddress emailAddress = null;
325
326 try {
327 emailAddress = (EmailAddress)obj;
328 }
329 catch (ClassCastException cce) {
330 return false;
331 }
332
333 long pk = emailAddress.getPrimaryKey();
334
335 if (getPrimaryKey() == pk) {
336 return true;
337 }
338 else {
339 return false;
340 }
341 }
342
343 public int hashCode() {
344 return (int)getPrimaryKey();
345 }
346
347 public String toString() {
348 StringBundler sb = new StringBundler(23);
349
350 sb.append("{emailAddressId=");
351 sb.append(getEmailAddressId());
352 sb.append(", companyId=");
353 sb.append(getCompanyId());
354 sb.append(", userId=");
355 sb.append(getUserId());
356 sb.append(", userName=");
357 sb.append(getUserName());
358 sb.append(", createDate=");
359 sb.append(getCreateDate());
360 sb.append(", modifiedDate=");
361 sb.append(getModifiedDate());
362 sb.append(", classNameId=");
363 sb.append(getClassNameId());
364 sb.append(", classPK=");
365 sb.append(getClassPK());
366 sb.append(", address=");
367 sb.append(getAddress());
368 sb.append(", typeId=");
369 sb.append(getTypeId());
370 sb.append(", primary=");
371 sb.append(getPrimary());
372 sb.append("}");
373
374 return sb.toString();
375 }
376
377 public String toXmlString() {
378 StringBundler sb = new StringBundler(37);
379
380 sb.append("<model><model-name>");
381 sb.append("com.liferay.portal.model.EmailAddress");
382 sb.append("</model-name>");
383
384 sb.append(
385 "<column><column-name>emailAddressId</column-name><column-value><![CDATA[");
386 sb.append(getEmailAddressId());
387 sb.append("]]></column-value></column>");
388 sb.append(
389 "<column><column-name>companyId</column-name><column-value><![CDATA[");
390 sb.append(getCompanyId());
391 sb.append("]]></column-value></column>");
392 sb.append(
393 "<column><column-name>userId</column-name><column-value><![CDATA[");
394 sb.append(getUserId());
395 sb.append("]]></column-value></column>");
396 sb.append(
397 "<column><column-name>userName</column-name><column-value><![CDATA[");
398 sb.append(getUserName());
399 sb.append("]]></column-value></column>");
400 sb.append(
401 "<column><column-name>createDate</column-name><column-value><![CDATA[");
402 sb.append(getCreateDate());
403 sb.append("]]></column-value></column>");
404 sb.append(
405 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
406 sb.append(getModifiedDate());
407 sb.append("]]></column-value></column>");
408 sb.append(
409 "<column><column-name>classNameId</column-name><column-value><![CDATA[");
410 sb.append(getClassNameId());
411 sb.append("]]></column-value></column>");
412 sb.append(
413 "<column><column-name>classPK</column-name><column-value><![CDATA[");
414 sb.append(getClassPK());
415 sb.append("]]></column-value></column>");
416 sb.append(
417 "<column><column-name>address</column-name><column-value><![CDATA[");
418 sb.append(getAddress());
419 sb.append("]]></column-value></column>");
420 sb.append(
421 "<column><column-name>typeId</column-name><column-value><![CDATA[");
422 sb.append(getTypeId());
423 sb.append("]]></column-value></column>");
424 sb.append(
425 "<column><column-name>primary</column-name><column-value><![CDATA[");
426 sb.append(getPrimary());
427 sb.append("]]></column-value></column>");
428
429 sb.append("</model>");
430
431 return sb.toString();
432 }
433
434 private long _emailAddressId;
435 private long _companyId;
436 private long _userId;
437 private String _userUuid;
438 private String _userName;
439 private Date _createDate;
440 private Date _modifiedDate;
441 private long _classNameId;
442 private long _classPK;
443 private String _address;
444 private int _typeId;
445 private boolean _primary;
446 private transient ExpandoBridge _expandoBridge;
447 }