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.Externalizable;
023    import java.io.IOException;
024    import java.io.ObjectInput;
025    import java.io.ObjectOutput;
026    
027    import java.util.Date;
028    
029    /**
030     * The cache model class for representing Website in entity cache.
031     *
032     * @author Brian Wing Shun Chan
033     * @see Website
034     * @generated
035     */
036    public class WebsiteCacheModel implements CacheModel<Website>, Externalizable {
037            @Override
038            public String toString() {
039                    StringBundler sb = new StringBundler(25);
040    
041                    sb.append("{uuid=");
042                    sb.append(uuid);
043                    sb.append(", websiteId=");
044                    sb.append(websiteId);
045                    sb.append(", companyId=");
046                    sb.append(companyId);
047                    sb.append(", userId=");
048                    sb.append(userId);
049                    sb.append(", userName=");
050                    sb.append(userName);
051                    sb.append(", createDate=");
052                    sb.append(createDate);
053                    sb.append(", modifiedDate=");
054                    sb.append(modifiedDate);
055                    sb.append(", classNameId=");
056                    sb.append(classNameId);
057                    sb.append(", classPK=");
058                    sb.append(classPK);
059                    sb.append(", url=");
060                    sb.append(url);
061                    sb.append(", typeId=");
062                    sb.append(typeId);
063                    sb.append(", primary=");
064                    sb.append(primary);
065                    sb.append("}");
066    
067                    return sb.toString();
068            }
069    
070            @Override
071            public Website toEntityModel() {
072                    WebsiteImpl websiteImpl = new WebsiteImpl();
073    
074                    if (uuid == null) {
075                            websiteImpl.setUuid(StringPool.BLANK);
076                    }
077                    else {
078                            websiteImpl.setUuid(uuid);
079                    }
080    
081                    websiteImpl.setWebsiteId(websiteId);
082                    websiteImpl.setCompanyId(companyId);
083                    websiteImpl.setUserId(userId);
084    
085                    if (userName == null) {
086                            websiteImpl.setUserName(StringPool.BLANK);
087                    }
088                    else {
089                            websiteImpl.setUserName(userName);
090                    }
091    
092                    if (createDate == Long.MIN_VALUE) {
093                            websiteImpl.setCreateDate(null);
094                    }
095                    else {
096                            websiteImpl.setCreateDate(new Date(createDate));
097                    }
098    
099                    if (modifiedDate == Long.MIN_VALUE) {
100                            websiteImpl.setModifiedDate(null);
101                    }
102                    else {
103                            websiteImpl.setModifiedDate(new Date(modifiedDate));
104                    }
105    
106                    websiteImpl.setClassNameId(classNameId);
107                    websiteImpl.setClassPK(classPK);
108    
109                    if (url == null) {
110                            websiteImpl.setUrl(StringPool.BLANK);
111                    }
112                    else {
113                            websiteImpl.setUrl(url);
114                    }
115    
116                    websiteImpl.setTypeId(typeId);
117                    websiteImpl.setPrimary(primary);
118    
119                    websiteImpl.resetOriginalValues();
120    
121                    return websiteImpl;
122            }
123    
124            @Override
125            public void readExternal(ObjectInput objectInput) throws IOException {
126                    uuid = objectInput.readUTF();
127                    websiteId = objectInput.readLong();
128                    companyId = objectInput.readLong();
129                    userId = objectInput.readLong();
130                    userName = objectInput.readUTF();
131                    createDate = objectInput.readLong();
132                    modifiedDate = objectInput.readLong();
133                    classNameId = objectInput.readLong();
134                    classPK = objectInput.readLong();
135                    url = objectInput.readUTF();
136                    typeId = objectInput.readInt();
137                    primary = objectInput.readBoolean();
138            }
139    
140            @Override
141            public void writeExternal(ObjectOutput objectOutput)
142                    throws IOException {
143                    if (uuid == null) {
144                            objectOutput.writeUTF(StringPool.BLANK);
145                    }
146                    else {
147                            objectOutput.writeUTF(uuid);
148                    }
149    
150                    objectOutput.writeLong(websiteId);
151                    objectOutput.writeLong(companyId);
152                    objectOutput.writeLong(userId);
153    
154                    if (userName == null) {
155                            objectOutput.writeUTF(StringPool.BLANK);
156                    }
157                    else {
158                            objectOutput.writeUTF(userName);
159                    }
160    
161                    objectOutput.writeLong(createDate);
162                    objectOutput.writeLong(modifiedDate);
163                    objectOutput.writeLong(classNameId);
164                    objectOutput.writeLong(classPK);
165    
166                    if (url == null) {
167                            objectOutput.writeUTF(StringPool.BLANK);
168                    }
169                    else {
170                            objectOutput.writeUTF(url);
171                    }
172    
173                    objectOutput.writeInt(typeId);
174                    objectOutput.writeBoolean(primary);
175            }
176    
177            public String uuid;
178            public long websiteId;
179            public long companyId;
180            public long userId;
181            public String userName;
182            public long createDate;
183            public long modifiedDate;
184            public long classNameId;
185            public long classPK;
186            public String url;
187            public int typeId;
188            public boolean primary;
189    }