001    /**
002     * Copyright (c) 2000-2013 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 com.liferay.portal.kernel.util.StringBundler;
018    import com.liferay.portal.kernel.util.StringPool;
019    import com.liferay.portal.model.CacheModel;
020    import com.liferay.portal.model.EmailAddress;
021    
022    import java.io.Serializable;
023    
024    import java.util.Date;
025    
026    /**
027     * The cache model class for representing EmailAddress in entity cache.
028     *
029     * @author Brian Wing Shun Chan
030     * @see EmailAddress
031     * @generated
032     */
033    public class EmailAddressCacheModel implements CacheModel<EmailAddress>,
034            Serializable {
035            @Override
036            public String toString() {
037                    StringBundler sb = new StringBundler(23);
038    
039                    sb.append("{emailAddressId=");
040                    sb.append(emailAddressId);
041                    sb.append(", companyId=");
042                    sb.append(companyId);
043                    sb.append(", userId=");
044                    sb.append(userId);
045                    sb.append(", userName=");
046                    sb.append(userName);
047                    sb.append(", createDate=");
048                    sb.append(createDate);
049                    sb.append(", modifiedDate=");
050                    sb.append(modifiedDate);
051                    sb.append(", classNameId=");
052                    sb.append(classNameId);
053                    sb.append(", classPK=");
054                    sb.append(classPK);
055                    sb.append(", address=");
056                    sb.append(address);
057                    sb.append(", typeId=");
058                    sb.append(typeId);
059                    sb.append(", primary=");
060                    sb.append(primary);
061                    sb.append("}");
062    
063                    return sb.toString();
064            }
065    
066            public EmailAddress toEntityModel() {
067                    EmailAddressImpl emailAddressImpl = new EmailAddressImpl();
068    
069                    emailAddressImpl.setEmailAddressId(emailAddressId);
070                    emailAddressImpl.setCompanyId(companyId);
071                    emailAddressImpl.setUserId(userId);
072    
073                    if (userName == null) {
074                            emailAddressImpl.setUserName(StringPool.BLANK);
075                    }
076                    else {
077                            emailAddressImpl.setUserName(userName);
078                    }
079    
080                    if (createDate == Long.MIN_VALUE) {
081                            emailAddressImpl.setCreateDate(null);
082                    }
083                    else {
084                            emailAddressImpl.setCreateDate(new Date(createDate));
085                    }
086    
087                    if (modifiedDate == Long.MIN_VALUE) {
088                            emailAddressImpl.setModifiedDate(null);
089                    }
090                    else {
091                            emailAddressImpl.setModifiedDate(new Date(modifiedDate));
092                    }
093    
094                    emailAddressImpl.setClassNameId(classNameId);
095                    emailAddressImpl.setClassPK(classPK);
096    
097                    if (address == null) {
098                            emailAddressImpl.setAddress(StringPool.BLANK);
099                    }
100                    else {
101                            emailAddressImpl.setAddress(address);
102                    }
103    
104                    emailAddressImpl.setTypeId(typeId);
105                    emailAddressImpl.setPrimary(primary);
106    
107                    emailAddressImpl.resetOriginalValues();
108    
109                    return emailAddressImpl;
110            }
111    
112            public long emailAddressId;
113            public long companyId;
114            public long userId;
115            public String userName;
116            public long createDate;
117            public long modifiedDate;
118            public long classNameId;
119            public long classPK;
120            public String address;
121            public int typeId;
122            public boolean primary;
123    }