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