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