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.HashUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.CacheModel;
023    import com.liferay.portal.model.LayoutBranch;
024    import com.liferay.portal.model.MVCCModel;
025    
026    import java.io.Externalizable;
027    import java.io.IOException;
028    import java.io.ObjectInput;
029    import java.io.ObjectOutput;
030    
031    /**
032     * The cache model class for representing LayoutBranch in entity cache.
033     *
034     * @author Brian Wing Shun Chan
035     * @see LayoutBranch
036     * @generated
037     */
038    @ProviderType
039    public class LayoutBranchCacheModel implements CacheModel<LayoutBranch>,
040            Externalizable, MVCCModel {
041            @Override
042            public boolean equals(Object obj) {
043                    if (this == obj) {
044                            return true;
045                    }
046    
047                    if (!(obj instanceof LayoutBranchCacheModel)) {
048                            return false;
049                    }
050    
051                    LayoutBranchCacheModel layoutBranchCacheModel = (LayoutBranchCacheModel)obj;
052    
053                    if ((layoutBranchId == layoutBranchCacheModel.layoutBranchId) &&
054                                    (mvccVersion == layoutBranchCacheModel.mvccVersion)) {
055                            return true;
056                    }
057    
058                    return false;
059            }
060    
061            @Override
062            public int hashCode() {
063                    int hashCode = HashUtil.hash(0, layoutBranchId);
064    
065                    return HashUtil.hash(hashCode, mvccVersion);
066            }
067    
068            @Override
069            public long getMvccVersion() {
070                    return mvccVersion;
071            }
072    
073            @Override
074            public void setMvccVersion(long mvccVersion) {
075                    this.mvccVersion = mvccVersion;
076            }
077    
078            @Override
079            public String toString() {
080                    StringBundler sb = new StringBundler(23);
081    
082                    sb.append("{mvccVersion=");
083                    sb.append(mvccVersion);
084                    sb.append(", layoutBranchId=");
085                    sb.append(layoutBranchId);
086                    sb.append(", groupId=");
087                    sb.append(groupId);
088                    sb.append(", companyId=");
089                    sb.append(companyId);
090                    sb.append(", userId=");
091                    sb.append(userId);
092                    sb.append(", userName=");
093                    sb.append(userName);
094                    sb.append(", layoutSetBranchId=");
095                    sb.append(layoutSetBranchId);
096                    sb.append(", plid=");
097                    sb.append(plid);
098                    sb.append(", name=");
099                    sb.append(name);
100                    sb.append(", description=");
101                    sb.append(description);
102                    sb.append(", master=");
103                    sb.append(master);
104                    sb.append("}");
105    
106                    return sb.toString();
107            }
108    
109            @Override
110            public LayoutBranch toEntityModel() {
111                    LayoutBranchImpl layoutBranchImpl = new LayoutBranchImpl();
112    
113                    layoutBranchImpl.setMvccVersion(mvccVersion);
114                    layoutBranchImpl.setLayoutBranchId(layoutBranchId);
115                    layoutBranchImpl.setGroupId(groupId);
116                    layoutBranchImpl.setCompanyId(companyId);
117                    layoutBranchImpl.setUserId(userId);
118    
119                    if (userName == null) {
120                            layoutBranchImpl.setUserName(StringPool.BLANK);
121                    }
122                    else {
123                            layoutBranchImpl.setUserName(userName);
124                    }
125    
126                    layoutBranchImpl.setLayoutSetBranchId(layoutSetBranchId);
127                    layoutBranchImpl.setPlid(plid);
128    
129                    if (name == null) {
130                            layoutBranchImpl.setName(StringPool.BLANK);
131                    }
132                    else {
133                            layoutBranchImpl.setName(name);
134                    }
135    
136                    if (description == null) {
137                            layoutBranchImpl.setDescription(StringPool.BLANK);
138                    }
139                    else {
140                            layoutBranchImpl.setDescription(description);
141                    }
142    
143                    layoutBranchImpl.setMaster(master);
144    
145                    layoutBranchImpl.resetOriginalValues();
146    
147                    return layoutBranchImpl;
148            }
149    
150            @Override
151            public void readExternal(ObjectInput objectInput) throws IOException {
152                    mvccVersion = objectInput.readLong();
153                    layoutBranchId = objectInput.readLong();
154                    groupId = objectInput.readLong();
155                    companyId = objectInput.readLong();
156                    userId = objectInput.readLong();
157                    userName = objectInput.readUTF();
158                    layoutSetBranchId = objectInput.readLong();
159                    plid = objectInput.readLong();
160                    name = objectInput.readUTF();
161                    description = objectInput.readUTF();
162                    master = objectInput.readBoolean();
163            }
164    
165            @Override
166            public void writeExternal(ObjectOutput objectOutput)
167                    throws IOException {
168                    objectOutput.writeLong(mvccVersion);
169                    objectOutput.writeLong(layoutBranchId);
170                    objectOutput.writeLong(groupId);
171                    objectOutput.writeLong(companyId);
172                    objectOutput.writeLong(userId);
173    
174                    if (userName == null) {
175                            objectOutput.writeUTF(StringPool.BLANK);
176                    }
177                    else {
178                            objectOutput.writeUTF(userName);
179                    }
180    
181                    objectOutput.writeLong(layoutSetBranchId);
182                    objectOutput.writeLong(plid);
183    
184                    if (name == null) {
185                            objectOutput.writeUTF(StringPool.BLANK);
186                    }
187                    else {
188                            objectOutput.writeUTF(name);
189                    }
190    
191                    if (description == null) {
192                            objectOutput.writeUTF(StringPool.BLANK);
193                    }
194                    else {
195                            objectOutput.writeUTF(description);
196                    }
197    
198                    objectOutput.writeBoolean(master);
199            }
200    
201            public long mvccVersion;
202            public long layoutBranchId;
203            public long groupId;
204            public long companyId;
205            public long userId;
206            public String userName;
207            public long layoutSetBranchId;
208            public long plid;
209            public String name;
210            public String description;
211            public boolean master;
212    }