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.model.CacheModel;
020    import com.liferay.portal.kernel.model.Company;
021    import com.liferay.portal.kernel.model.MVCCModel;
022    import com.liferay.portal.kernel.util.HashUtil;
023    import com.liferay.portal.kernel.util.StringBundler;
024    import com.liferay.portal.kernel.util.StringPool;
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 Company in entity cache.
033     *
034     * @author Brian Wing Shun Chan
035     * @see Company
036     * @generated
037     */
038    @ProviderType
039    public class CompanyCacheModel implements CacheModel<Company>, Externalizable,
040            MVCCModel {
041            @Override
042            public boolean equals(Object obj) {
043                    if (this == obj) {
044                            return true;
045                    }
046    
047                    if (!(obj instanceof CompanyCacheModel)) {
048                            return false;
049                    }
050    
051                    CompanyCacheModel companyCacheModel = (CompanyCacheModel)obj;
052    
053                    if ((companyId == companyCacheModel.companyId) &&
054                                    (mvccVersion == companyCacheModel.mvccVersion)) {
055                            return true;
056                    }
057    
058                    return false;
059            }
060    
061            @Override
062            public int hashCode() {
063                    int hashCode = HashUtil.hash(0, companyId);
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(", companyId=");
085                    sb.append(companyId);
086                    sb.append(", accountId=");
087                    sb.append(accountId);
088                    sb.append(", webId=");
089                    sb.append(webId);
090                    sb.append(", key=");
091                    sb.append(key);
092                    sb.append(", mx=");
093                    sb.append(mx);
094                    sb.append(", homeURL=");
095                    sb.append(homeURL);
096                    sb.append(", logoId=");
097                    sb.append(logoId);
098                    sb.append(", system=");
099                    sb.append(system);
100                    sb.append(", maxUsers=");
101                    sb.append(maxUsers);
102                    sb.append(", active=");
103                    sb.append(active);
104                    sb.append("}");
105    
106                    return sb.toString();
107            }
108    
109            @Override
110            public Company toEntityModel() {
111                    CompanyImpl companyImpl = new CompanyImpl();
112    
113                    companyImpl.setMvccVersion(mvccVersion);
114                    companyImpl.setCompanyId(companyId);
115                    companyImpl.setAccountId(accountId);
116    
117                    if (webId == null) {
118                            companyImpl.setWebId(StringPool.BLANK);
119                    }
120                    else {
121                            companyImpl.setWebId(webId);
122                    }
123    
124                    if (key == null) {
125                            companyImpl.setKey(StringPool.BLANK);
126                    }
127                    else {
128                            companyImpl.setKey(key);
129                    }
130    
131                    if (mx == null) {
132                            companyImpl.setMx(StringPool.BLANK);
133                    }
134                    else {
135                            companyImpl.setMx(mx);
136                    }
137    
138                    if (homeURL == null) {
139                            companyImpl.setHomeURL(StringPool.BLANK);
140                    }
141                    else {
142                            companyImpl.setHomeURL(homeURL);
143                    }
144    
145                    companyImpl.setLogoId(logoId);
146                    companyImpl.setSystem(system);
147                    companyImpl.setMaxUsers(maxUsers);
148                    companyImpl.setActive(active);
149    
150                    companyImpl.resetOriginalValues();
151    
152                    companyImpl.setKeyObj(_keyObj);
153    
154                    companyImpl.setVirtualHostname(_virtualHostname);
155    
156                    return companyImpl;
157            }
158    
159            @Override
160            public void readExternal(ObjectInput objectInput)
161                    throws ClassNotFoundException, IOException {
162                    mvccVersion = objectInput.readLong();
163    
164                    companyId = objectInput.readLong();
165    
166                    accountId = objectInput.readLong();
167                    webId = objectInput.readUTF();
168                    key = objectInput.readUTF();
169                    mx = objectInput.readUTF();
170                    homeURL = objectInput.readUTF();
171    
172                    logoId = objectInput.readLong();
173    
174                    system = objectInput.readBoolean();
175    
176                    maxUsers = objectInput.readInt();
177    
178                    active = objectInput.readBoolean();
179    
180                    _keyObj = (java.security.Key)objectInput.readObject();
181                    _virtualHostname = (java.lang.String)objectInput.readObject();
182            }
183    
184            @Override
185            public void writeExternal(ObjectOutput objectOutput)
186                    throws IOException {
187                    objectOutput.writeLong(mvccVersion);
188    
189                    objectOutput.writeLong(companyId);
190    
191                    objectOutput.writeLong(accountId);
192    
193                    if (webId == null) {
194                            objectOutput.writeUTF(StringPool.BLANK);
195                    }
196                    else {
197                            objectOutput.writeUTF(webId);
198                    }
199    
200                    if (key == null) {
201                            objectOutput.writeUTF(StringPool.BLANK);
202                    }
203                    else {
204                            objectOutput.writeUTF(key);
205                    }
206    
207                    if (mx == null) {
208                            objectOutput.writeUTF(StringPool.BLANK);
209                    }
210                    else {
211                            objectOutput.writeUTF(mx);
212                    }
213    
214                    if (homeURL == null) {
215                            objectOutput.writeUTF(StringPool.BLANK);
216                    }
217                    else {
218                            objectOutput.writeUTF(homeURL);
219                    }
220    
221                    objectOutput.writeLong(logoId);
222    
223                    objectOutput.writeBoolean(system);
224    
225                    objectOutput.writeInt(maxUsers);
226    
227                    objectOutput.writeBoolean(active);
228    
229                    objectOutput.writeObject(_keyObj);
230                    objectOutput.writeObject(_virtualHostname);
231            }
232    
233            public long mvccVersion;
234            public long companyId;
235            public long accountId;
236            public String webId;
237            public String key;
238            public String mx;
239            public String homeURL;
240            public long logoId;
241            public boolean system;
242            public int maxUsers;
243            public boolean active;
244            public java.security.Key _keyObj;
245            public java.lang.String _virtualHostname;
246    }