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