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