001    /**
002     * Copyright (c) 2000-2012 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            public Company toEntityModel() {
065                    CompanyImpl companyImpl = new CompanyImpl();
066    
067                    companyImpl.setCompanyId(companyId);
068                    companyImpl.setAccountId(accountId);
069    
070                    if (webId == null) {
071                            companyImpl.setWebId(StringPool.BLANK);
072                    }
073                    else {
074                            companyImpl.setWebId(webId);
075                    }
076    
077                    if (key == null) {
078                            companyImpl.setKey(StringPool.BLANK);
079                    }
080                    else {
081                            companyImpl.setKey(key);
082                    }
083    
084                    if (mx == null) {
085                            companyImpl.setMx(StringPool.BLANK);
086                    }
087                    else {
088                            companyImpl.setMx(mx);
089                    }
090    
091                    if (homeURL == null) {
092                            companyImpl.setHomeURL(StringPool.BLANK);
093                    }
094                    else {
095                            companyImpl.setHomeURL(homeURL);
096                    }
097    
098                    companyImpl.setLogoId(logoId);
099                    companyImpl.setSystem(system);
100                    companyImpl.setMaxUsers(maxUsers);
101                    companyImpl.setActive(active);
102    
103                    companyImpl.resetOriginalValues();
104    
105                    companyImpl.setKeyObj(_keyObj);
106    
107                    companyImpl.setVirtualHostname(_virtualHostname);
108    
109                    return companyImpl;
110            }
111    
112            public void readExternal(ObjectInput objectInput)
113                    throws ClassNotFoundException, IOException {
114                    companyId = objectInput.readLong();
115                    accountId = objectInput.readLong();
116                    webId = objectInput.readUTF();
117                    key = objectInput.readUTF();
118                    mx = objectInput.readUTF();
119                    homeURL = objectInput.readUTF();
120                    logoId = objectInput.readLong();
121                    system = objectInput.readBoolean();
122                    maxUsers = objectInput.readInt();
123                    active = objectInput.readBoolean();
124    
125                    _keyObj = (java.security.Key)objectInput.readObject();
126                    _virtualHostname = (java.lang.String)objectInput.readObject();
127            }
128    
129            public void writeExternal(ObjectOutput objectOutput)
130                    throws IOException {
131                    objectOutput.writeLong(companyId);
132                    objectOutput.writeLong(accountId);
133    
134                    if (webId == null) {
135                            objectOutput.writeUTF(StringPool.BLANK);
136                    }
137                    else {
138                            objectOutput.writeUTF(webId);
139                    }
140    
141                    if (key == null) {
142                            objectOutput.writeUTF(StringPool.BLANK);
143                    }
144                    else {
145                            objectOutput.writeUTF(key);
146                    }
147    
148                    if (mx == null) {
149                            objectOutput.writeUTF(StringPool.BLANK);
150                    }
151                    else {
152                            objectOutput.writeUTF(mx);
153                    }
154    
155                    if (homeURL == null) {
156                            objectOutput.writeUTF(StringPool.BLANK);
157                    }
158                    else {
159                            objectOutput.writeUTF(homeURL);
160                    }
161    
162                    objectOutput.writeLong(logoId);
163                    objectOutput.writeBoolean(system);
164                    objectOutput.writeInt(maxUsers);
165                    objectOutput.writeBoolean(active);
166    
167                    objectOutput.writeObject(_keyObj);
168                    objectOutput.writeObject(_virtualHostname);
169            }
170    
171            public long companyId;
172            public long accountId;
173            public String webId;
174            public String key;
175            public String mx;
176            public String homeURL;
177            public long logoId;
178            public boolean system;
179            public int maxUsers;
180            public boolean active;
181            public java.security.Key _keyObj;
182            public java.lang.String _virtualHostname;
183    }