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.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            @Override
066            public LayoutBranch toEntityModel() {
067                    LayoutBranchImpl layoutBranchImpl = new LayoutBranchImpl();
068    
069                    layoutBranchImpl.setLayoutBranchId(LayoutBranchId);
070                    layoutBranchImpl.setGroupId(groupId);
071                    layoutBranchImpl.setCompanyId(companyId);
072                    layoutBranchImpl.setUserId(userId);
073    
074                    if (userName == null) {
075                            layoutBranchImpl.setUserName(StringPool.BLANK);
076                    }
077                    else {
078                            layoutBranchImpl.setUserName(userName);
079                    }
080    
081                    layoutBranchImpl.setLayoutSetBranchId(layoutSetBranchId);
082                    layoutBranchImpl.setPlid(plid);
083    
084                    if (name == null) {
085                            layoutBranchImpl.setName(StringPool.BLANK);
086                    }
087                    else {
088                            layoutBranchImpl.setName(name);
089                    }
090    
091                    if (description == null) {
092                            layoutBranchImpl.setDescription(StringPool.BLANK);
093                    }
094                    else {
095                            layoutBranchImpl.setDescription(description);
096                    }
097    
098                    layoutBranchImpl.setMaster(master);
099    
100                    layoutBranchImpl.resetOriginalValues();
101    
102                    return layoutBranchImpl;
103            }
104    
105            @Override
106            public void readExternal(ObjectInput objectInput) throws IOException {
107                    LayoutBranchId = objectInput.readLong();
108                    groupId = objectInput.readLong();
109                    companyId = objectInput.readLong();
110                    userId = objectInput.readLong();
111                    userName = objectInput.readUTF();
112                    layoutSetBranchId = objectInput.readLong();
113                    plid = objectInput.readLong();
114                    name = objectInput.readUTF();
115                    description = objectInput.readUTF();
116                    master = objectInput.readBoolean();
117            }
118    
119            @Override
120            public void writeExternal(ObjectOutput objectOutput)
121                    throws IOException {
122                    objectOutput.writeLong(LayoutBranchId);
123                    objectOutput.writeLong(groupId);
124                    objectOutput.writeLong(companyId);
125                    objectOutput.writeLong(userId);
126    
127                    if (userName == null) {
128                            objectOutput.writeUTF(StringPool.BLANK);
129                    }
130                    else {
131                            objectOutput.writeUTF(userName);
132                    }
133    
134                    objectOutput.writeLong(layoutSetBranchId);
135                    objectOutput.writeLong(plid);
136    
137                    if (name == null) {
138                            objectOutput.writeUTF(StringPool.BLANK);
139                    }
140                    else {
141                            objectOutput.writeUTF(name);
142                    }
143    
144                    if (description == null) {
145                            objectOutput.writeUTF(StringPool.BLANK);
146                    }
147                    else {
148                            objectOutput.writeUTF(description);
149                    }
150    
151                    objectOutput.writeBoolean(master);
152            }
153    
154            public long LayoutBranchId;
155            public long groupId;
156            public long companyId;
157            public long userId;
158            public String userName;
159            public long layoutSetBranchId;
160            public long plid;
161            public String name;
162            public String description;
163            public boolean master;
164    }