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.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.CacheModel;
022    import com.liferay.portal.model.Company;
023    import com.liferay.portal.model.MVCCModel;
024    
025    import java.io.Externalizable;
026    import java.io.IOException;
027    import java.io.ObjectInput;
028    import java.io.ObjectOutput;
029    
030    /**
031     * The cache model class for representing Company in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see Company
035     * @generated
036     */
037    @ProviderType
038    public class CompanyCacheModel implements CacheModel<Company>, Externalizable,
039            MVCCModel {
040            @Override
041            public long getMvccVersion() {
042                    return mvccVersion;
043            }
044    
045            @Override
046            public void setMvccVersion(long mvccVersion) {
047                    this.mvccVersion = mvccVersion;
048            }
049    
050            @Override
051            public String toString() {
052                    StringBundler sb = new StringBundler(23);
053    
054                    sb.append("{mvccVersion=");
055                    sb.append(mvccVersion);
056                    sb.append(", companyId=");
057                    sb.append(companyId);
058                    sb.append(", accountId=");
059                    sb.append(accountId);
060                    sb.append(", webId=");
061                    sb.append(webId);
062                    sb.append(", key=");
063                    sb.append(key);
064                    sb.append(", mx=");
065                    sb.append(mx);
066                    sb.append(", homeURL=");
067                    sb.append(homeURL);
068                    sb.append(", logoId=");
069                    sb.append(logoId);
070                    sb.append(", system=");
071                    sb.append(system);
072                    sb.append(", maxUsers=");
073                    sb.append(maxUsers);
074                    sb.append(", active=");
075                    sb.append(active);
076                    sb.append("}");
077    
078                    return sb.toString();
079            }
080    
081            @Override
082            public Company toEntityModel() {
083                    CompanyImpl companyImpl = new CompanyImpl();
084    
085                    companyImpl.setMvccVersion(mvccVersion);
086                    companyImpl.setCompanyId(companyId);
087                    companyImpl.setAccountId(accountId);
088    
089                    if (webId == null) {
090                            companyImpl.setWebId(StringPool.BLANK);
091                    }
092                    else {
093                            companyImpl.setWebId(webId);
094                    }
095    
096                    if (key == null) {
097                            companyImpl.setKey(StringPool.BLANK);
098                    }
099                    else {
100                            companyImpl.setKey(key);
101                    }
102    
103                    if (mx == null) {
104                            companyImpl.setMx(StringPool.BLANK);
105                    }
106                    else {
107                            companyImpl.setMx(mx);
108                    }
109    
110                    if (homeURL == null) {
111                            companyImpl.setHomeURL(StringPool.BLANK);
112                    }
113                    else {
114                            companyImpl.setHomeURL(homeURL);
115                    }
116    
117                    companyImpl.setLogoId(logoId);
118                    companyImpl.setSystem(system);
119                    companyImpl.setMaxUsers(maxUsers);
120                    companyImpl.setActive(active);
121    
122                    companyImpl.resetOriginalValues();
123    
124                    companyImpl.setKeyObj(_keyObj);
125    
126                    companyImpl.setVirtualHostname(_virtualHostname);
127    
128                    return companyImpl;
129            }
130    
131            @Override
132            public void readExternal(ObjectInput objectInput)
133                    throws ClassNotFoundException, IOException {
134                    mvccVersion = objectInput.readLong();
135                    companyId = objectInput.readLong();
136                    accountId = objectInput.readLong();
137                    webId = objectInput.readUTF();
138                    key = objectInput.readUTF();
139                    mx = objectInput.readUTF();
140                    homeURL = objectInput.readUTF();
141                    logoId = objectInput.readLong();
142                    system = objectInput.readBoolean();
143                    maxUsers = objectInput.readInt();
144                    active = objectInput.readBoolean();
145    
146                    _keyObj = (java.security.Key)objectInput.readObject();
147                    _virtualHostname = (java.lang.String)objectInput.readObject();
148            }
149    
150            @Override
151            public void writeExternal(ObjectOutput objectOutput)
152                    throws IOException {
153                    objectOutput.writeLong(mvccVersion);
154                    objectOutput.writeLong(companyId);
155                    objectOutput.writeLong(accountId);
156    
157                    if (webId == null) {
158                            objectOutput.writeUTF(StringPool.BLANK);
159                    }
160                    else {
161                            objectOutput.writeUTF(webId);
162                    }
163    
164                    if (key == null) {
165                            objectOutput.writeUTF(StringPool.BLANK);
166                    }
167                    else {
168                            objectOutput.writeUTF(key);
169                    }
170    
171                    if (mx == null) {
172                            objectOutput.writeUTF(StringPool.BLANK);
173                    }
174                    else {
175                            objectOutput.writeUTF(mx);
176                    }
177    
178                    if (homeURL == null) {
179                            objectOutput.writeUTF(StringPool.BLANK);
180                    }
181                    else {
182                            objectOutput.writeUTF(homeURL);
183                    }
184    
185                    objectOutput.writeLong(logoId);
186                    objectOutput.writeBoolean(system);
187                    objectOutput.writeInt(maxUsers);
188                    objectOutput.writeBoolean(active);
189    
190                    objectOutput.writeObject(_keyObj);
191                    objectOutput.writeObject(_virtualHostname);
192            }
193    
194            public long mvccVersion;
195            public long companyId;
196            public long accountId;
197            public String webId;
198            public String key;
199            public String mx;
200            public String homeURL;
201            public long logoId;
202            public boolean system;
203            public int maxUsers;
204            public boolean active;
205            public java.security.Key _keyObj;
206            public java.lang.String _virtualHostname;
207    }