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.Company;
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 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                    companyId = objectInput.readLong();
164                    accountId = objectInput.readLong();
165                    webId = objectInput.readUTF();
166                    key = objectInput.readUTF();
167                    mx = objectInput.readUTF();
168                    homeURL = objectInput.readUTF();
169                    logoId = objectInput.readLong();
170                    system = objectInput.readBoolean();
171                    maxUsers = objectInput.readInt();
172                    active = objectInput.readBoolean();
173    
174                    _keyObj = (java.security.Key)objectInput.readObject();
175                    _virtualHostname = (java.lang.String)objectInput.readObject();
176            }
177    
178            @Override
179            public void writeExternal(ObjectOutput objectOutput)
180                    throws IOException {
181                    objectOutput.writeLong(mvccVersion);
182                    objectOutput.writeLong(companyId);
183                    objectOutput.writeLong(accountId);
184    
185                    if (webId == null) {
186                            objectOutput.writeUTF(StringPool.BLANK);
187                    }
188                    else {
189                            objectOutput.writeUTF(webId);
190                    }
191    
192                    if (key == null) {
193                            objectOutput.writeUTF(StringPool.BLANK);
194                    }
195                    else {
196                            objectOutput.writeUTF(key);
197                    }
198    
199                    if (mx == null) {
200                            objectOutput.writeUTF(StringPool.BLANK);
201                    }
202                    else {
203                            objectOutput.writeUTF(mx);
204                    }
205    
206                    if (homeURL == null) {
207                            objectOutput.writeUTF(StringPool.BLANK);
208                    }
209                    else {
210                            objectOutput.writeUTF(homeURL);
211                    }
212    
213                    objectOutput.writeLong(logoId);
214                    objectOutput.writeBoolean(system);
215                    objectOutput.writeInt(maxUsers);
216                    objectOutput.writeBoolean(active);
217    
218                    objectOutput.writeObject(_keyObj);
219                    objectOutput.writeObject(_virtualHostname);
220            }
221    
222            public long mvccVersion;
223            public long companyId;
224            public long accountId;
225            public String webId;
226            public String key;
227            public String mx;
228            public String homeURL;
229            public long logoId;
230            public boolean system;
231            public int maxUsers;
232            public boolean active;
233            public java.security.Key _keyObj;
234            public java.lang.String _virtualHostname;
235    }