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.LayoutPrototype;
021    
022    import java.io.Externalizable;
023    import java.io.IOException;
024    import java.io.ObjectInput;
025    import java.io.ObjectOutput;
026    
027    /**
028     * The cache model class for representing LayoutPrototype in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see LayoutPrototype
032     * @generated
033     */
034    public class LayoutPrototypeCacheModel implements CacheModel<LayoutPrototype>,
035            Externalizable {
036            @Override
037            public String toString() {
038                    StringBundler sb = new StringBundler(15);
039    
040                    sb.append("{uuid=");
041                    sb.append(uuid);
042                    sb.append(", layoutPrototypeId=");
043                    sb.append(layoutPrototypeId);
044                    sb.append(", companyId=");
045                    sb.append(companyId);
046                    sb.append(", name=");
047                    sb.append(name);
048                    sb.append(", description=");
049                    sb.append(description);
050                    sb.append(", settings=");
051                    sb.append(settings);
052                    sb.append(", active=");
053                    sb.append(active);
054                    sb.append("}");
055    
056                    return sb.toString();
057            }
058    
059            public LayoutPrototype toEntityModel() {
060                    LayoutPrototypeImpl layoutPrototypeImpl = new LayoutPrototypeImpl();
061    
062                    if (uuid == null) {
063                            layoutPrototypeImpl.setUuid(StringPool.BLANK);
064                    }
065                    else {
066                            layoutPrototypeImpl.setUuid(uuid);
067                    }
068    
069                    layoutPrototypeImpl.setLayoutPrototypeId(layoutPrototypeId);
070                    layoutPrototypeImpl.setCompanyId(companyId);
071    
072                    if (name == null) {
073                            layoutPrototypeImpl.setName(StringPool.BLANK);
074                    }
075                    else {
076                            layoutPrototypeImpl.setName(name);
077                    }
078    
079                    if (description == null) {
080                            layoutPrototypeImpl.setDescription(StringPool.BLANK);
081                    }
082                    else {
083                            layoutPrototypeImpl.setDescription(description);
084                    }
085    
086                    if (settings == null) {
087                            layoutPrototypeImpl.setSettings(StringPool.BLANK);
088                    }
089                    else {
090                            layoutPrototypeImpl.setSettings(settings);
091                    }
092    
093                    layoutPrototypeImpl.setActive(active);
094    
095                    layoutPrototypeImpl.resetOriginalValues();
096    
097                    return layoutPrototypeImpl;
098            }
099    
100            public void readExternal(ObjectInput objectInput) throws IOException {
101                    uuid = objectInput.readUTF();
102                    layoutPrototypeId = objectInput.readLong();
103                    companyId = objectInput.readLong();
104                    name = objectInput.readUTF();
105                    description = objectInput.readUTF();
106                    settings = objectInput.readUTF();
107                    active = objectInput.readBoolean();
108            }
109    
110            public void writeExternal(ObjectOutput objectOutput)
111                    throws IOException {
112                    if (uuid == null) {
113                            objectOutput.writeUTF(StringPool.BLANK);
114                    }
115                    else {
116                            objectOutput.writeUTF(uuid);
117                    }
118    
119                    objectOutput.writeLong(layoutPrototypeId);
120                    objectOutput.writeLong(companyId);
121    
122                    if (name == null) {
123                            objectOutput.writeUTF(StringPool.BLANK);
124                    }
125                    else {
126                            objectOutput.writeUTF(name);
127                    }
128    
129                    if (description == null) {
130                            objectOutput.writeUTF(StringPool.BLANK);
131                    }
132                    else {
133                            objectOutput.writeUTF(description);
134                    }
135    
136                    if (settings == null) {
137                            objectOutput.writeUTF(StringPool.BLANK);
138                    }
139                    else {
140                            objectOutput.writeUTF(settings);
141                    }
142    
143                    objectOutput.writeBoolean(active);
144            }
145    
146            public String uuid;
147            public long layoutPrototypeId;
148            public long companyId;
149            public String name;
150            public String description;
151            public String settings;
152            public boolean active;
153    }