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.Website;
021    
022    import java.io.Serializable;
023    
024    import java.util.Date;
025    
026    /**
027     * The cache model class for representing Website in entity cache.
028     *
029     * @author Brian Wing Shun Chan
030     * @see Website
031     * @generated
032     */
033    public class WebsiteCacheModel implements CacheModel<Website>, Serializable {
034            @Override
035            public String toString() {
036                    StringBundler sb = new StringBundler(23);
037    
038                    sb.append("{websiteId=");
039                    sb.append(websiteId);
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(", url=");
055                    sb.append(url);
056                    sb.append(", typeId=");
057                    sb.append(typeId);
058                    sb.append(", primary=");
059                    sb.append(primary);
060                    sb.append("}");
061    
062                    return sb.toString();
063            }
064    
065            public Website toEntityModel() {
066                    WebsiteImpl websiteImpl = new WebsiteImpl();
067    
068                    websiteImpl.setWebsiteId(websiteId);
069                    websiteImpl.setCompanyId(companyId);
070                    websiteImpl.setUserId(userId);
071    
072                    if (userName == null) {
073                            websiteImpl.setUserName(StringPool.BLANK);
074                    }
075                    else {
076                            websiteImpl.setUserName(userName);
077                    }
078    
079                    if (createDate == Long.MIN_VALUE) {
080                            websiteImpl.setCreateDate(null);
081                    }
082                    else {
083                            websiteImpl.setCreateDate(new Date(createDate));
084                    }
085    
086                    if (modifiedDate == Long.MIN_VALUE) {
087                            websiteImpl.setModifiedDate(null);
088                    }
089                    else {
090                            websiteImpl.setModifiedDate(new Date(modifiedDate));
091                    }
092    
093                    websiteImpl.setClassNameId(classNameId);
094                    websiteImpl.setClassPK(classPK);
095    
096                    if (url == null) {
097                            websiteImpl.setUrl(StringPool.BLANK);
098                    }
099                    else {
100                            websiteImpl.setUrl(url);
101                    }
102    
103                    websiteImpl.setTypeId(typeId);
104                    websiteImpl.setPrimary(primary);
105    
106                    websiteImpl.resetOriginalValues();
107    
108                    return websiteImpl;
109            }
110    
111            public long websiteId;
112            public long companyId;
113            public long userId;
114            public String userName;
115            public long createDate;
116            public long modifiedDate;
117            public long classNameId;
118            public long classPK;
119            public String url;
120            public int typeId;
121            public boolean primary;
122    }