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.LayoutSetPrototype;
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 LayoutSetPrototype in entity cache.
031     *
032     * @author Brian Wing Shun Chan
033     * @see LayoutSetPrototype
034     * @generated
035     */
036    public class LayoutSetPrototypeCacheModel implements CacheModel<LayoutSetPrototype>,
037            Externalizable {
038            @Override
039            public String toString() {
040                    StringBundler sb = new StringBundler(23);
041    
042                    sb.append("{uuid=");
043                    sb.append(uuid);
044                    sb.append(", layoutSetPrototypeId=");
045                    sb.append(layoutSetPrototypeId);
046                    sb.append(", companyId=");
047                    sb.append(companyId);
048                    sb.append(", userId=");
049                    sb.append(userId);
050                    sb.append(", userName=");
051                    sb.append(userName);
052                    sb.append(", createDate=");
053                    sb.append(createDate);
054                    sb.append(", modifiedDate=");
055                    sb.append(modifiedDate);
056                    sb.append(", name=");
057                    sb.append(name);
058                    sb.append(", description=");
059                    sb.append(description);
060                    sb.append(", settings=");
061                    sb.append(settings);
062                    sb.append(", active=");
063                    sb.append(active);
064                    sb.append("}");
065    
066                    return sb.toString();
067            }
068    
069            public LayoutSetPrototype toEntityModel() {
070                    LayoutSetPrototypeImpl layoutSetPrototypeImpl = new LayoutSetPrototypeImpl();
071    
072                    if (uuid == null) {
073                            layoutSetPrototypeImpl.setUuid(StringPool.BLANK);
074                    }
075                    else {
076                            layoutSetPrototypeImpl.setUuid(uuid);
077                    }
078    
079                    layoutSetPrototypeImpl.setLayoutSetPrototypeId(layoutSetPrototypeId);
080                    layoutSetPrototypeImpl.setCompanyId(companyId);
081                    layoutSetPrototypeImpl.setUserId(userId);
082    
083                    if (userName == null) {
084                            layoutSetPrototypeImpl.setUserName(StringPool.BLANK);
085                    }
086                    else {
087                            layoutSetPrototypeImpl.setUserName(userName);
088                    }
089    
090                    if (createDate == Long.MIN_VALUE) {
091                            layoutSetPrototypeImpl.setCreateDate(null);
092                    }
093                    else {
094                            layoutSetPrototypeImpl.setCreateDate(new Date(createDate));
095                    }
096    
097                    if (modifiedDate == Long.MIN_VALUE) {
098                            layoutSetPrototypeImpl.setModifiedDate(null);
099                    }
100                    else {
101                            layoutSetPrototypeImpl.setModifiedDate(new Date(modifiedDate));
102                    }
103    
104                    if (name == null) {
105                            layoutSetPrototypeImpl.setName(StringPool.BLANK);
106                    }
107                    else {
108                            layoutSetPrototypeImpl.setName(name);
109                    }
110    
111                    if (description == null) {
112                            layoutSetPrototypeImpl.setDescription(StringPool.BLANK);
113                    }
114                    else {
115                            layoutSetPrototypeImpl.setDescription(description);
116                    }
117    
118                    if (settings == null) {
119                            layoutSetPrototypeImpl.setSettings(StringPool.BLANK);
120                    }
121                    else {
122                            layoutSetPrototypeImpl.setSettings(settings);
123                    }
124    
125                    layoutSetPrototypeImpl.setActive(active);
126    
127                    layoutSetPrototypeImpl.resetOriginalValues();
128    
129                    return layoutSetPrototypeImpl;
130            }
131    
132            public void readExternal(ObjectInput objectInput) throws IOException {
133                    uuid = objectInput.readUTF();
134                    layoutSetPrototypeId = objectInput.readLong();
135                    companyId = objectInput.readLong();
136                    userId = objectInput.readLong();
137                    userName = objectInput.readUTF();
138                    createDate = objectInput.readLong();
139                    modifiedDate = objectInput.readLong();
140                    name = objectInput.readUTF();
141                    description = objectInput.readUTF();
142                    settings = objectInput.readUTF();
143                    active = objectInput.readBoolean();
144            }
145    
146            public void writeExternal(ObjectOutput objectOutput)
147                    throws IOException {
148                    if (uuid == null) {
149                            objectOutput.writeUTF(StringPool.BLANK);
150                    }
151                    else {
152                            objectOutput.writeUTF(uuid);
153                    }
154    
155                    objectOutput.writeLong(layoutSetPrototypeId);
156                    objectOutput.writeLong(companyId);
157                    objectOutput.writeLong(userId);
158    
159                    if (userName == null) {
160                            objectOutput.writeUTF(StringPool.BLANK);
161                    }
162                    else {
163                            objectOutput.writeUTF(userName);
164                    }
165    
166                    objectOutput.writeLong(createDate);
167                    objectOutput.writeLong(modifiedDate);
168    
169                    if (name == null) {
170                            objectOutput.writeUTF(StringPool.BLANK);
171                    }
172                    else {
173                            objectOutput.writeUTF(name);
174                    }
175    
176                    if (description == null) {
177                            objectOutput.writeUTF(StringPool.BLANK);
178                    }
179                    else {
180                            objectOutput.writeUTF(description);
181                    }
182    
183                    if (settings == null) {
184                            objectOutput.writeUTF(StringPool.BLANK);
185                    }
186                    else {
187                            objectOutput.writeUTF(settings);
188                    }
189    
190                    objectOutput.writeBoolean(active);
191            }
192    
193            public String uuid;
194            public long layoutSetPrototypeId;
195            public long companyId;
196            public long userId;
197            public String userName;
198            public long createDate;
199            public long modifiedDate;
200            public String name;
201            public String description;
202            public String settings;
203            public boolean active;
204    }