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.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(19);
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(", createDate=");
049                    sb.append(createDate);
050                    sb.append(", modifiedDate=");
051                    sb.append(modifiedDate);
052                    sb.append(", name=");
053                    sb.append(name);
054                    sb.append(", description=");
055                    sb.append(description);
056                    sb.append(", settings=");
057                    sb.append(settings);
058                    sb.append(", active=");
059                    sb.append(active);
060                    sb.append("}");
061    
062                    return sb.toString();
063            }
064    
065            public LayoutSetPrototype toEntityModel() {
066                    LayoutSetPrototypeImpl layoutSetPrototypeImpl = new LayoutSetPrototypeImpl();
067    
068                    if (uuid == null) {
069                            layoutSetPrototypeImpl.setUuid(StringPool.BLANK);
070                    }
071                    else {
072                            layoutSetPrototypeImpl.setUuid(uuid);
073                    }
074    
075                    layoutSetPrototypeImpl.setLayoutSetPrototypeId(layoutSetPrototypeId);
076                    layoutSetPrototypeImpl.setCompanyId(companyId);
077    
078                    if (createDate == Long.MIN_VALUE) {
079                            layoutSetPrototypeImpl.setCreateDate(null);
080                    }
081                    else {
082                            layoutSetPrototypeImpl.setCreateDate(new Date(createDate));
083                    }
084    
085                    if (modifiedDate == Long.MIN_VALUE) {
086                            layoutSetPrototypeImpl.setModifiedDate(null);
087                    }
088                    else {
089                            layoutSetPrototypeImpl.setModifiedDate(new Date(modifiedDate));
090                    }
091    
092                    if (name == null) {
093                            layoutSetPrototypeImpl.setName(StringPool.BLANK);
094                    }
095                    else {
096                            layoutSetPrototypeImpl.setName(name);
097                    }
098    
099                    if (description == null) {
100                            layoutSetPrototypeImpl.setDescription(StringPool.BLANK);
101                    }
102                    else {
103                            layoutSetPrototypeImpl.setDescription(description);
104                    }
105    
106                    if (settings == null) {
107                            layoutSetPrototypeImpl.setSettings(StringPool.BLANK);
108                    }
109                    else {
110                            layoutSetPrototypeImpl.setSettings(settings);
111                    }
112    
113                    layoutSetPrototypeImpl.setActive(active);
114    
115                    layoutSetPrototypeImpl.resetOriginalValues();
116    
117                    return layoutSetPrototypeImpl;
118            }
119    
120            public void readExternal(ObjectInput objectInput) throws IOException {
121                    uuid = objectInput.readUTF();
122                    layoutSetPrototypeId = objectInput.readLong();
123                    companyId = objectInput.readLong();
124                    createDate = objectInput.readLong();
125                    modifiedDate = objectInput.readLong();
126                    name = objectInput.readUTF();
127                    description = objectInput.readUTF();
128                    settings = objectInput.readUTF();
129                    active = objectInput.readBoolean();
130            }
131    
132            public void writeExternal(ObjectOutput objectOutput)
133                    throws IOException {
134                    if (uuid == null) {
135                            objectOutput.writeUTF(StringPool.BLANK);
136                    }
137                    else {
138                            objectOutput.writeUTF(uuid);
139                    }
140    
141                    objectOutput.writeLong(layoutSetPrototypeId);
142                    objectOutput.writeLong(companyId);
143                    objectOutput.writeLong(createDate);
144                    objectOutput.writeLong(modifiedDate);
145    
146                    if (name == null) {
147                            objectOutput.writeUTF(StringPool.BLANK);
148                    }
149                    else {
150                            objectOutput.writeUTF(name);
151                    }
152    
153                    if (description == null) {
154                            objectOutput.writeUTF(StringPool.BLANK);
155                    }
156                    else {
157                            objectOutput.writeUTF(description);
158                    }
159    
160                    if (settings == null) {
161                            objectOutput.writeUTF(StringPool.BLANK);
162                    }
163                    else {
164                            objectOutput.writeUTF(settings);
165                    }
166    
167                    objectOutput.writeBoolean(active);
168            }
169    
170            public String uuid;
171            public long layoutSetPrototypeId;
172            public long companyId;
173            public long createDate;
174            public long modifiedDate;
175            public String name;
176            public String description;
177            public String settings;
178            public boolean active;
179    }