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