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.LayoutBranch;
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 LayoutBranch in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see LayoutBranch
032     * @generated
033     */
034    public class LayoutBranchCacheModel implements CacheModel<LayoutBranch>,
035            Externalizable {
036            @Override
037            public String toString() {
038                    StringBundler sb = new StringBundler(21);
039    
040                    sb.append("{LayoutBranchId=");
041                    sb.append(LayoutBranchId);
042                    sb.append(", groupId=");
043                    sb.append(groupId);
044                    sb.append(", companyId=");
045                    sb.append(companyId);
046                    sb.append(", userId=");
047                    sb.append(userId);
048                    sb.append(", userName=");
049                    sb.append(userName);
050                    sb.append(", layoutSetBranchId=");
051                    sb.append(layoutSetBranchId);
052                    sb.append(", plid=");
053                    sb.append(plid);
054                    sb.append(", name=");
055                    sb.append(name);
056                    sb.append(", description=");
057                    sb.append(description);
058                    sb.append(", master=");
059                    sb.append(master);
060                    sb.append("}");
061    
062                    return sb.toString();
063            }
064    
065            public LayoutBranch toEntityModel() {
066                    LayoutBranchImpl layoutBranchImpl = new LayoutBranchImpl();
067    
068                    layoutBranchImpl.setLayoutBranchId(LayoutBranchId);
069                    layoutBranchImpl.setGroupId(groupId);
070                    layoutBranchImpl.setCompanyId(companyId);
071                    layoutBranchImpl.setUserId(userId);
072    
073                    if (userName == null) {
074                            layoutBranchImpl.setUserName(StringPool.BLANK);
075                    }
076                    else {
077                            layoutBranchImpl.setUserName(userName);
078                    }
079    
080                    layoutBranchImpl.setLayoutSetBranchId(layoutSetBranchId);
081                    layoutBranchImpl.setPlid(plid);
082    
083                    if (name == null) {
084                            layoutBranchImpl.setName(StringPool.BLANK);
085                    }
086                    else {
087                            layoutBranchImpl.setName(name);
088                    }
089    
090                    if (description == null) {
091                            layoutBranchImpl.setDescription(StringPool.BLANK);
092                    }
093                    else {
094                            layoutBranchImpl.setDescription(description);
095                    }
096    
097                    layoutBranchImpl.setMaster(master);
098    
099                    layoutBranchImpl.resetOriginalValues();
100    
101                    return layoutBranchImpl;
102            }
103    
104            public void readExternal(ObjectInput objectInput) throws IOException {
105                    LayoutBranchId = objectInput.readLong();
106                    groupId = objectInput.readLong();
107                    companyId = objectInput.readLong();
108                    userId = objectInput.readLong();
109                    userName = objectInput.readUTF();
110                    layoutSetBranchId = objectInput.readLong();
111                    plid = objectInput.readLong();
112                    name = objectInput.readUTF();
113                    description = objectInput.readUTF();
114                    master = objectInput.readBoolean();
115            }
116    
117            public void writeExternal(ObjectOutput objectOutput)
118                    throws IOException {
119                    objectOutput.writeLong(LayoutBranchId);
120                    objectOutput.writeLong(groupId);
121                    objectOutput.writeLong(companyId);
122                    objectOutput.writeLong(userId);
123    
124                    if (userName == null) {
125                            objectOutput.writeUTF(StringPool.BLANK);
126                    }
127                    else {
128                            objectOutput.writeUTF(userName);
129                    }
130    
131                    objectOutput.writeLong(layoutSetBranchId);
132                    objectOutput.writeLong(plid);
133    
134                    if (name == null) {
135                            objectOutput.writeUTF(StringPool.BLANK);
136                    }
137                    else {
138                            objectOutput.writeUTF(name);
139                    }
140    
141                    if (description == null) {
142                            objectOutput.writeUTF(StringPool.BLANK);
143                    }
144                    else {
145                            objectOutput.writeUTF(description);
146                    }
147    
148                    objectOutput.writeBoolean(master);
149            }
150    
151            public long LayoutBranchId;
152            public long groupId;
153            public long companyId;
154            public long userId;
155            public String userName;
156            public long layoutSetBranchId;
157            public long plid;
158            public String name;
159            public String description;
160            public boolean master;
161    }