001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
020    import com.liferay.portal.kernel.exception.PortalException;
021    import com.liferay.portal.kernel.json.JSON;
022    import com.liferay.portal.kernel.util.DateUtil;
023    import com.liferay.portal.kernel.util.GetterUtil;
024    import com.liferay.portal.kernel.util.ProxyUtil;
025    import com.liferay.portal.kernel.util.StringBundler;
026    import com.liferay.portal.kernel.util.StringPool;
027    import com.liferay.portal.kernel.util.Validator;
028    import com.liferay.portal.model.CacheModel;
029    import com.liferay.portal.model.EmailAddress;
030    import com.liferay.portal.model.EmailAddressModel;
031    import com.liferay.portal.model.EmailAddressSoap;
032    import com.liferay.portal.model.User;
033    import com.liferay.portal.service.ServiceContext;
034    import com.liferay.portal.service.UserLocalServiceUtil;
035    import com.liferay.portal.util.PortalUtil;
036    
037    import com.liferay.portlet.expando.model.ExpandoBridge;
038    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
039    import com.liferay.portlet.exportimport.lar.StagedModelType;
040    
041    import java.io.Serializable;
042    
043    import java.sql.Types;
044    
045    import java.util.ArrayList;
046    import java.util.Date;
047    import java.util.HashMap;
048    import java.util.List;
049    import java.util.Map;
050    
051    /**
052     * The base model implementation for the EmailAddress service. Represents a row in the "EmailAddress" database table, with each column mapped to a property of this class.
053     *
054     * <p>
055     * This implementation and its corresponding interface {@link EmailAddressModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link EmailAddressImpl}.
056     * </p>
057     *
058     * @author Brian Wing Shun Chan
059     * @see EmailAddressImpl
060     * @see EmailAddress
061     * @see EmailAddressModel
062     * @generated
063     */
064    @JSON(strict = true)
065    @ProviderType
066    public class EmailAddressModelImpl extends BaseModelImpl<EmailAddress>
067            implements EmailAddressModel {
068            /*
069             * NOTE FOR DEVELOPERS:
070             *
071             * Never modify or reference this class directly. All methods that expect a email address model instance should use the {@link EmailAddress} interface instead.
072             */
073            public static final String TABLE_NAME = "EmailAddress";
074            public static final Object[][] TABLE_COLUMNS = {
075                            { "mvccVersion", Types.BIGINT },
076                            { "uuid_", Types.VARCHAR },
077                            { "emailAddressId", Types.BIGINT },
078                            { "companyId", Types.BIGINT },
079                            { "userId", Types.BIGINT },
080                            { "userName", Types.VARCHAR },
081                            { "createDate", Types.TIMESTAMP },
082                            { "modifiedDate", Types.TIMESTAMP },
083                            { "classNameId", Types.BIGINT },
084                            { "classPK", Types.BIGINT },
085                            { "address", Types.VARCHAR },
086                            { "typeId", Types.BIGINT },
087                            { "primary_", Types.BOOLEAN }
088                    };
089            public static final Map<String, Integer> TABLE_COLUMNS_MAP = new HashMap<String, Integer>();
090    
091            static {
092                    TABLE_COLUMNS_MAP.put("mvccVersion", Types.BIGINT);
093                    TABLE_COLUMNS_MAP.put("uuid_", Types.VARCHAR);
094                    TABLE_COLUMNS_MAP.put("emailAddressId", Types.BIGINT);
095                    TABLE_COLUMNS_MAP.put("companyId", Types.BIGINT);
096                    TABLE_COLUMNS_MAP.put("userId", Types.BIGINT);
097                    TABLE_COLUMNS_MAP.put("userName", Types.VARCHAR);
098                    TABLE_COLUMNS_MAP.put("createDate", Types.TIMESTAMP);
099                    TABLE_COLUMNS_MAP.put("modifiedDate", Types.TIMESTAMP);
100                    TABLE_COLUMNS_MAP.put("classNameId", Types.BIGINT);
101                    TABLE_COLUMNS_MAP.put("classPK", Types.BIGINT);
102                    TABLE_COLUMNS_MAP.put("address", Types.VARCHAR);
103                    TABLE_COLUMNS_MAP.put("typeId", Types.BIGINT);
104                    TABLE_COLUMNS_MAP.put("primary_", Types.BOOLEAN);
105            }
106    
107            public static final String TABLE_SQL_CREATE = "create table EmailAddress (mvccVersion LONG default 0,uuid_ VARCHAR(75) null,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 LONG,primary_ BOOLEAN)";
108            public static final String TABLE_SQL_DROP = "drop table EmailAddress";
109            public static final String ORDER_BY_JPQL = " ORDER BY emailAddress.createDate ASC";
110            public static final String ORDER_BY_SQL = " ORDER BY EmailAddress.createDate ASC";
111            public static final String DATA_SOURCE = "liferayDataSource";
112            public static final String SESSION_FACTORY = "liferaySessionFactory";
113            public static final String TX_MANAGER = "liferayTransactionManager";
114            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
115                                    "value.object.entity.cache.enabled.com.liferay.portal.model.EmailAddress"),
116                            true);
117            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
118                                    "value.object.finder.cache.enabled.com.liferay.portal.model.EmailAddress"),
119                            true);
120            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
121                                    "value.object.column.bitmask.enabled.com.liferay.portal.model.EmailAddress"),
122                            true);
123            public static final long CLASSNAMEID_COLUMN_BITMASK = 1L;
124            public static final long CLASSPK_COLUMN_BITMASK = 2L;
125            public static final long COMPANYID_COLUMN_BITMASK = 4L;
126            public static final long PRIMARY_COLUMN_BITMASK = 8L;
127            public static final long USERID_COLUMN_BITMASK = 16L;
128            public static final long UUID_COLUMN_BITMASK = 32L;
129            public static final long CREATEDATE_COLUMN_BITMASK = 64L;
130    
131            /**
132             * Converts the soap model instance into a normal model instance.
133             *
134             * @param soapModel the soap model instance to convert
135             * @return the normal model instance
136             */
137            public static EmailAddress toModel(EmailAddressSoap soapModel) {
138                    if (soapModel == null) {
139                            return null;
140                    }
141    
142                    EmailAddress model = new EmailAddressImpl();
143    
144                    model.setMvccVersion(soapModel.getMvccVersion());
145                    model.setUuid(soapModel.getUuid());
146                    model.setEmailAddressId(soapModel.getEmailAddressId());
147                    model.setCompanyId(soapModel.getCompanyId());
148                    model.setUserId(soapModel.getUserId());
149                    model.setUserName(soapModel.getUserName());
150                    model.setCreateDate(soapModel.getCreateDate());
151                    model.setModifiedDate(soapModel.getModifiedDate());
152                    model.setClassNameId(soapModel.getClassNameId());
153                    model.setClassPK(soapModel.getClassPK());
154                    model.setAddress(soapModel.getAddress());
155                    model.setTypeId(soapModel.getTypeId());
156                    model.setPrimary(soapModel.getPrimary());
157    
158                    return model;
159            }
160    
161            /**
162             * Converts the soap model instances into normal model instances.
163             *
164             * @param soapModels the soap model instances to convert
165             * @return the normal model instances
166             */
167            public static List<EmailAddress> toModels(EmailAddressSoap[] soapModels) {
168                    if (soapModels == null) {
169                            return null;
170                    }
171    
172                    List<EmailAddress> models = new ArrayList<EmailAddress>(soapModels.length);
173    
174                    for (EmailAddressSoap soapModel : soapModels) {
175                            models.add(toModel(soapModel));
176                    }
177    
178                    return models;
179            }
180    
181            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
182                                    "lock.expiration.time.com.liferay.portal.model.EmailAddress"));
183    
184            public EmailAddressModelImpl() {
185            }
186    
187            @Override
188            public long getPrimaryKey() {
189                    return _emailAddressId;
190            }
191    
192            @Override
193            public void setPrimaryKey(long primaryKey) {
194                    setEmailAddressId(primaryKey);
195            }
196    
197            @Override
198            public Serializable getPrimaryKeyObj() {
199                    return _emailAddressId;
200            }
201    
202            @Override
203            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
204                    setPrimaryKey(((Long)primaryKeyObj).longValue());
205            }
206    
207            @Override
208            public Class<?> getModelClass() {
209                    return EmailAddress.class;
210            }
211    
212            @Override
213            public String getModelClassName() {
214                    return EmailAddress.class.getName();
215            }
216    
217            @Override
218            public Map<String, Object> getModelAttributes() {
219                    Map<String, Object> attributes = new HashMap<String, Object>();
220    
221                    attributes.put("mvccVersion", getMvccVersion());
222                    attributes.put("uuid", getUuid());
223                    attributes.put("emailAddressId", getEmailAddressId());
224                    attributes.put("companyId", getCompanyId());
225                    attributes.put("userId", getUserId());
226                    attributes.put("userName", getUserName());
227                    attributes.put("createDate", getCreateDate());
228                    attributes.put("modifiedDate", getModifiedDate());
229                    attributes.put("classNameId", getClassNameId());
230                    attributes.put("classPK", getClassPK());
231                    attributes.put("address", getAddress());
232                    attributes.put("typeId", getTypeId());
233                    attributes.put("primary", getPrimary());
234    
235                    attributes.put("entityCacheEnabled", isEntityCacheEnabled());
236                    attributes.put("finderCacheEnabled", isFinderCacheEnabled());
237    
238                    return attributes;
239            }
240    
241            @Override
242            public void setModelAttributes(Map<String, Object> attributes) {
243                    Long mvccVersion = (Long)attributes.get("mvccVersion");
244    
245                    if (mvccVersion != null) {
246                            setMvccVersion(mvccVersion);
247                    }
248    
249                    String uuid = (String)attributes.get("uuid");
250    
251                    if (uuid != null) {
252                            setUuid(uuid);
253                    }
254    
255                    Long emailAddressId = (Long)attributes.get("emailAddressId");
256    
257                    if (emailAddressId != null) {
258                            setEmailAddressId(emailAddressId);
259                    }
260    
261                    Long companyId = (Long)attributes.get("companyId");
262    
263                    if (companyId != null) {
264                            setCompanyId(companyId);
265                    }
266    
267                    Long userId = (Long)attributes.get("userId");
268    
269                    if (userId != null) {
270                            setUserId(userId);
271                    }
272    
273                    String userName = (String)attributes.get("userName");
274    
275                    if (userName != null) {
276                            setUserName(userName);
277                    }
278    
279                    Date createDate = (Date)attributes.get("createDate");
280    
281                    if (createDate != null) {
282                            setCreateDate(createDate);
283                    }
284    
285                    Date modifiedDate = (Date)attributes.get("modifiedDate");
286    
287                    if (modifiedDate != null) {
288                            setModifiedDate(modifiedDate);
289                    }
290    
291                    Long classNameId = (Long)attributes.get("classNameId");
292    
293                    if (classNameId != null) {
294                            setClassNameId(classNameId);
295                    }
296    
297                    Long classPK = (Long)attributes.get("classPK");
298    
299                    if (classPK != null) {
300                            setClassPK(classPK);
301                    }
302    
303                    String address = (String)attributes.get("address");
304    
305                    if (address != null) {
306                            setAddress(address);
307                    }
308    
309                    Long typeId = (Long)attributes.get("typeId");
310    
311                    if (typeId != null) {
312                            setTypeId(typeId);
313                    }
314    
315                    Boolean primary = (Boolean)attributes.get("primary");
316    
317                    if (primary != null) {
318                            setPrimary(primary);
319                    }
320            }
321    
322            @JSON
323            @Override
324            public long getMvccVersion() {
325                    return _mvccVersion;
326            }
327    
328            @Override
329            public void setMvccVersion(long mvccVersion) {
330                    _mvccVersion = mvccVersion;
331            }
332    
333            @JSON
334            @Override
335            public String getUuid() {
336                    if (_uuid == null) {
337                            return StringPool.BLANK;
338                    }
339                    else {
340                            return _uuid;
341                    }
342            }
343    
344            @Override
345            public void setUuid(String uuid) {
346                    if (_originalUuid == null) {
347                            _originalUuid = _uuid;
348                    }
349    
350                    _uuid = uuid;
351            }
352    
353            public String getOriginalUuid() {
354                    return GetterUtil.getString(_originalUuid);
355            }
356    
357            @JSON
358            @Override
359            public long getEmailAddressId() {
360                    return _emailAddressId;
361            }
362    
363            @Override
364            public void setEmailAddressId(long emailAddressId) {
365                    _emailAddressId = emailAddressId;
366            }
367    
368            @JSON
369            @Override
370            public long getCompanyId() {
371                    return _companyId;
372            }
373    
374            @Override
375            public void setCompanyId(long companyId) {
376                    _columnBitmask |= COMPANYID_COLUMN_BITMASK;
377    
378                    if (!_setOriginalCompanyId) {
379                            _setOriginalCompanyId = true;
380    
381                            _originalCompanyId = _companyId;
382                    }
383    
384                    _companyId = companyId;
385            }
386    
387            public long getOriginalCompanyId() {
388                    return _originalCompanyId;
389            }
390    
391            @JSON
392            @Override
393            public long getUserId() {
394                    return _userId;
395            }
396    
397            @Override
398            public void setUserId(long userId) {
399                    _columnBitmask |= USERID_COLUMN_BITMASK;
400    
401                    if (!_setOriginalUserId) {
402                            _setOriginalUserId = true;
403    
404                            _originalUserId = _userId;
405                    }
406    
407                    _userId = userId;
408            }
409    
410            @Override
411            public String getUserUuid() {
412                    try {
413                            User user = UserLocalServiceUtil.getUserById(getUserId());
414    
415                            return user.getUuid();
416                    }
417                    catch (PortalException pe) {
418                            return StringPool.BLANK;
419                    }
420            }
421    
422            @Override
423            public void setUserUuid(String userUuid) {
424            }
425    
426            public long getOriginalUserId() {
427                    return _originalUserId;
428            }
429    
430            @JSON
431            @Override
432            public String getUserName() {
433                    if (_userName == null) {
434                            return StringPool.BLANK;
435                    }
436                    else {
437                            return _userName;
438                    }
439            }
440    
441            @Override
442            public void setUserName(String userName) {
443                    _userName = userName;
444            }
445    
446            @JSON
447            @Override
448            public Date getCreateDate() {
449                    return _createDate;
450            }
451    
452            @Override
453            public void setCreateDate(Date createDate) {
454                    _columnBitmask = -1L;
455    
456                    _createDate = createDate;
457            }
458    
459            @JSON
460            @Override
461            public Date getModifiedDate() {
462                    return _modifiedDate;
463            }
464    
465            public boolean hasSetModifiedDate() {
466                    return _setModifiedDate;
467            }
468    
469            @Override
470            public void setModifiedDate(Date modifiedDate) {
471                    _setModifiedDate = true;
472    
473                    _modifiedDate = modifiedDate;
474            }
475    
476            @Override
477            public String getClassName() {
478                    if (getClassNameId() <= 0) {
479                            return StringPool.BLANK;
480                    }
481    
482                    return PortalUtil.getClassName(getClassNameId());
483            }
484    
485            @Override
486            public void setClassName(String className) {
487                    long classNameId = 0;
488    
489                    if (Validator.isNotNull(className)) {
490                            classNameId = PortalUtil.getClassNameId(className);
491                    }
492    
493                    setClassNameId(classNameId);
494            }
495    
496            @JSON
497            @Override
498            public long getClassNameId() {
499                    return _classNameId;
500            }
501    
502            @Override
503            public void setClassNameId(long classNameId) {
504                    _columnBitmask |= CLASSNAMEID_COLUMN_BITMASK;
505    
506                    if (!_setOriginalClassNameId) {
507                            _setOriginalClassNameId = true;
508    
509                            _originalClassNameId = _classNameId;
510                    }
511    
512                    _classNameId = classNameId;
513            }
514    
515            public long getOriginalClassNameId() {
516                    return _originalClassNameId;
517            }
518    
519            @JSON
520            @Override
521            public long getClassPK() {
522                    return _classPK;
523            }
524    
525            @Override
526            public void setClassPK(long classPK) {
527                    _columnBitmask |= CLASSPK_COLUMN_BITMASK;
528    
529                    if (!_setOriginalClassPK) {
530                            _setOriginalClassPK = true;
531    
532                            _originalClassPK = _classPK;
533                    }
534    
535                    _classPK = classPK;
536            }
537    
538            public long getOriginalClassPK() {
539                    return _originalClassPK;
540            }
541    
542            @JSON
543            @Override
544            public String getAddress() {
545                    if (_address == null) {
546                            return StringPool.BLANK;
547                    }
548                    else {
549                            return _address;
550                    }
551            }
552    
553            @Override
554            public void setAddress(String address) {
555                    _address = address;
556            }
557    
558            @JSON
559            @Override
560            public long getTypeId() {
561                    return _typeId;
562            }
563    
564            @Override
565            public void setTypeId(long typeId) {
566                    _typeId = typeId;
567            }
568    
569            @JSON
570            @Override
571            public boolean getPrimary() {
572                    return _primary;
573            }
574    
575            @Override
576            public boolean isPrimary() {
577                    return _primary;
578            }
579    
580            @Override
581            public void setPrimary(boolean primary) {
582                    _columnBitmask |= PRIMARY_COLUMN_BITMASK;
583    
584                    if (!_setOriginalPrimary) {
585                            _setOriginalPrimary = true;
586    
587                            _originalPrimary = _primary;
588                    }
589    
590                    _primary = primary;
591            }
592    
593            public boolean getOriginalPrimary() {
594                    return _originalPrimary;
595            }
596    
597            @Override
598            public StagedModelType getStagedModelType() {
599                    return new StagedModelType(PortalUtil.getClassNameId(
600                                    EmailAddress.class.getName()), getClassNameId());
601            }
602    
603            public long getColumnBitmask() {
604                    return _columnBitmask;
605            }
606    
607            @Override
608            public ExpandoBridge getExpandoBridge() {
609                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
610                            EmailAddress.class.getName(), getPrimaryKey());
611            }
612    
613            @Override
614            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
615                    ExpandoBridge expandoBridge = getExpandoBridge();
616    
617                    expandoBridge.setAttributes(serviceContext);
618            }
619    
620            @Override
621            public EmailAddress toEscapedModel() {
622                    if (_escapedModel == null) {
623                            _escapedModel = (EmailAddress)ProxyUtil.newProxyInstance(_classLoader,
624                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
625                    }
626    
627                    return _escapedModel;
628            }
629    
630            @Override
631            public Object clone() {
632                    EmailAddressImpl emailAddressImpl = new EmailAddressImpl();
633    
634                    emailAddressImpl.setMvccVersion(getMvccVersion());
635                    emailAddressImpl.setUuid(getUuid());
636                    emailAddressImpl.setEmailAddressId(getEmailAddressId());
637                    emailAddressImpl.setCompanyId(getCompanyId());
638                    emailAddressImpl.setUserId(getUserId());
639                    emailAddressImpl.setUserName(getUserName());
640                    emailAddressImpl.setCreateDate(getCreateDate());
641                    emailAddressImpl.setModifiedDate(getModifiedDate());
642                    emailAddressImpl.setClassNameId(getClassNameId());
643                    emailAddressImpl.setClassPK(getClassPK());
644                    emailAddressImpl.setAddress(getAddress());
645                    emailAddressImpl.setTypeId(getTypeId());
646                    emailAddressImpl.setPrimary(getPrimary());
647    
648                    emailAddressImpl.resetOriginalValues();
649    
650                    return emailAddressImpl;
651            }
652    
653            @Override
654            public int compareTo(EmailAddress emailAddress) {
655                    int value = 0;
656    
657                    value = DateUtil.compareTo(getCreateDate(), emailAddress.getCreateDate());
658    
659                    if (value != 0) {
660                            return value;
661                    }
662    
663                    return 0;
664            }
665    
666            @Override
667            public boolean equals(Object obj) {
668                    if (this == obj) {
669                            return true;
670                    }
671    
672                    if (!(obj instanceof EmailAddress)) {
673                            return false;
674                    }
675    
676                    EmailAddress emailAddress = (EmailAddress)obj;
677    
678                    long primaryKey = emailAddress.getPrimaryKey();
679    
680                    if (getPrimaryKey() == primaryKey) {
681                            return true;
682                    }
683                    else {
684                            return false;
685                    }
686            }
687    
688            @Override
689            public int hashCode() {
690                    return (int)getPrimaryKey();
691            }
692    
693            @Override
694            public boolean isEntityCacheEnabled() {
695                    return ENTITY_CACHE_ENABLED;
696            }
697    
698            @Override
699            public boolean isFinderCacheEnabled() {
700                    return FINDER_CACHE_ENABLED;
701            }
702    
703            @Override
704            public void resetOriginalValues() {
705                    EmailAddressModelImpl emailAddressModelImpl = this;
706    
707                    emailAddressModelImpl._originalUuid = emailAddressModelImpl._uuid;
708    
709                    emailAddressModelImpl._originalCompanyId = emailAddressModelImpl._companyId;
710    
711                    emailAddressModelImpl._setOriginalCompanyId = false;
712    
713                    emailAddressModelImpl._originalUserId = emailAddressModelImpl._userId;
714    
715                    emailAddressModelImpl._setOriginalUserId = false;
716    
717                    emailAddressModelImpl._setModifiedDate = false;
718    
719                    emailAddressModelImpl._originalClassNameId = emailAddressModelImpl._classNameId;
720    
721                    emailAddressModelImpl._setOriginalClassNameId = false;
722    
723                    emailAddressModelImpl._originalClassPK = emailAddressModelImpl._classPK;
724    
725                    emailAddressModelImpl._setOriginalClassPK = false;
726    
727                    emailAddressModelImpl._originalPrimary = emailAddressModelImpl._primary;
728    
729                    emailAddressModelImpl._setOriginalPrimary = false;
730    
731                    emailAddressModelImpl._columnBitmask = 0;
732            }
733    
734            @Override
735            public CacheModel<EmailAddress> toCacheModel() {
736                    EmailAddressCacheModel emailAddressCacheModel = new EmailAddressCacheModel();
737    
738                    emailAddressCacheModel.mvccVersion = getMvccVersion();
739    
740                    emailAddressCacheModel.uuid = getUuid();
741    
742                    String uuid = emailAddressCacheModel.uuid;
743    
744                    if ((uuid != null) && (uuid.length() == 0)) {
745                            emailAddressCacheModel.uuid = null;
746                    }
747    
748                    emailAddressCacheModel.emailAddressId = getEmailAddressId();
749    
750                    emailAddressCacheModel.companyId = getCompanyId();
751    
752                    emailAddressCacheModel.userId = getUserId();
753    
754                    emailAddressCacheModel.userName = getUserName();
755    
756                    String userName = emailAddressCacheModel.userName;
757    
758                    if ((userName != null) && (userName.length() == 0)) {
759                            emailAddressCacheModel.userName = null;
760                    }
761    
762                    Date createDate = getCreateDate();
763    
764                    if (createDate != null) {
765                            emailAddressCacheModel.createDate = createDate.getTime();
766                    }
767                    else {
768                            emailAddressCacheModel.createDate = Long.MIN_VALUE;
769                    }
770    
771                    Date modifiedDate = getModifiedDate();
772    
773                    if (modifiedDate != null) {
774                            emailAddressCacheModel.modifiedDate = modifiedDate.getTime();
775                    }
776                    else {
777                            emailAddressCacheModel.modifiedDate = Long.MIN_VALUE;
778                    }
779    
780                    emailAddressCacheModel.classNameId = getClassNameId();
781    
782                    emailAddressCacheModel.classPK = getClassPK();
783    
784                    emailAddressCacheModel.address = getAddress();
785    
786                    String address = emailAddressCacheModel.address;
787    
788                    if ((address != null) && (address.length() == 0)) {
789                            emailAddressCacheModel.address = null;
790                    }
791    
792                    emailAddressCacheModel.typeId = getTypeId();
793    
794                    emailAddressCacheModel.primary = getPrimary();
795    
796                    return emailAddressCacheModel;
797            }
798    
799            @Override
800            public String toString() {
801                    StringBundler sb = new StringBundler(27);
802    
803                    sb.append("{mvccVersion=");
804                    sb.append(getMvccVersion());
805                    sb.append(", uuid=");
806                    sb.append(getUuid());
807                    sb.append(", emailAddressId=");
808                    sb.append(getEmailAddressId());
809                    sb.append(", companyId=");
810                    sb.append(getCompanyId());
811                    sb.append(", userId=");
812                    sb.append(getUserId());
813                    sb.append(", userName=");
814                    sb.append(getUserName());
815                    sb.append(", createDate=");
816                    sb.append(getCreateDate());
817                    sb.append(", modifiedDate=");
818                    sb.append(getModifiedDate());
819                    sb.append(", classNameId=");
820                    sb.append(getClassNameId());
821                    sb.append(", classPK=");
822                    sb.append(getClassPK());
823                    sb.append(", address=");
824                    sb.append(getAddress());
825                    sb.append(", typeId=");
826                    sb.append(getTypeId());
827                    sb.append(", primary=");
828                    sb.append(getPrimary());
829                    sb.append("}");
830    
831                    return sb.toString();
832            }
833    
834            @Override
835            public String toXmlString() {
836                    StringBundler sb = new StringBundler(43);
837    
838                    sb.append("<model><model-name>");
839                    sb.append("com.liferay.portal.model.EmailAddress");
840                    sb.append("</model-name>");
841    
842                    sb.append(
843                            "<column><column-name>mvccVersion</column-name><column-value><![CDATA[");
844                    sb.append(getMvccVersion());
845                    sb.append("]]></column-value></column>");
846                    sb.append(
847                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
848                    sb.append(getUuid());
849                    sb.append("]]></column-value></column>");
850                    sb.append(
851                            "<column><column-name>emailAddressId</column-name><column-value><![CDATA[");
852                    sb.append(getEmailAddressId());
853                    sb.append("]]></column-value></column>");
854                    sb.append(
855                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
856                    sb.append(getCompanyId());
857                    sb.append("]]></column-value></column>");
858                    sb.append(
859                            "<column><column-name>userId</column-name><column-value><![CDATA[");
860                    sb.append(getUserId());
861                    sb.append("]]></column-value></column>");
862                    sb.append(
863                            "<column><column-name>userName</column-name><column-value><![CDATA[");
864                    sb.append(getUserName());
865                    sb.append("]]></column-value></column>");
866                    sb.append(
867                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
868                    sb.append(getCreateDate());
869                    sb.append("]]></column-value></column>");
870                    sb.append(
871                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
872                    sb.append(getModifiedDate());
873                    sb.append("]]></column-value></column>");
874                    sb.append(
875                            "<column><column-name>classNameId</column-name><column-value><![CDATA[");
876                    sb.append(getClassNameId());
877                    sb.append("]]></column-value></column>");
878                    sb.append(
879                            "<column><column-name>classPK</column-name><column-value><![CDATA[");
880                    sb.append(getClassPK());
881                    sb.append("]]></column-value></column>");
882                    sb.append(
883                            "<column><column-name>address</column-name><column-value><![CDATA[");
884                    sb.append(getAddress());
885                    sb.append("]]></column-value></column>");
886                    sb.append(
887                            "<column><column-name>typeId</column-name><column-value><![CDATA[");
888                    sb.append(getTypeId());
889                    sb.append("]]></column-value></column>");
890                    sb.append(
891                            "<column><column-name>primary</column-name><column-value><![CDATA[");
892                    sb.append(getPrimary());
893                    sb.append("]]></column-value></column>");
894    
895                    sb.append("</model>");
896    
897                    return sb.toString();
898            }
899    
900            private static final ClassLoader _classLoader = EmailAddress.class.getClassLoader();
901            private static final Class<?>[] _escapedModelInterfaces = new Class[] {
902                            EmailAddress.class
903                    };
904            private long _mvccVersion;
905            private String _uuid;
906            private String _originalUuid;
907            private long _emailAddressId;
908            private long _companyId;
909            private long _originalCompanyId;
910            private boolean _setOriginalCompanyId;
911            private long _userId;
912            private long _originalUserId;
913            private boolean _setOriginalUserId;
914            private String _userName;
915            private Date _createDate;
916            private Date _modifiedDate;
917            private boolean _setModifiedDate;
918            private long _classNameId;
919            private long _originalClassNameId;
920            private boolean _setOriginalClassNameId;
921            private long _classPK;
922            private long _originalClassPK;
923            private boolean _setOriginalClassPK;
924            private String _address;
925            private long _typeId;
926            private boolean _primary;
927            private boolean _originalPrimary;
928            private boolean _setOriginalPrimary;
929            private long _columnBitmask;
930            private EmailAddress _escapedModel;
931    }