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                    return companyImpl;
108            }
109    
110            public void readExternal(ObjectInput objectInput)
111                    throws ClassNotFoundException, IOException {
112                    companyId = objectInput.readLong();
113                    accountId = objectInput.readLong();
114                    webId = objectInput.readUTF();
115                    key = objectInput.readUTF();
116                    mx = objectInput.readUTF();
117                    homeURL = objectInput.readUTF();
118                    logoId = objectInput.readLong();
119                    system = objectInput.readBoolean();
120                    maxUsers = objectInput.readInt();
121                    active = objectInput.readBoolean();
122    
123                    _keyObj = (java.security.Key)objectInput.readObject();
124            }
125    
126            public void writeExternal(ObjectOutput objectOutput)
127                    throws IOException {
128                    objectOutput.writeLong(companyId);
129                    objectOutput.writeLong(accountId);
130    
131                    if (webId == null) {
132                            objectOutput.writeUTF(StringPool.BLANK);
133                    }
134                    else {
135                            objectOutput.writeUTF(webId);
136                    }
137    
138                    if (key == null) {
139                            objectOutput.writeUTF(StringPool.BLANK);
140                    }
141                    else {
142                            objectOutput.writeUTF(key);
143                    }
144    
145                    if (mx == null) {
146                            objectOutput.writeUTF(StringPool.BLANK);
147                    }
148                    else {
149                            objectOutput.writeUTF(mx);
150                    }
151    
152                    if (homeURL == null) {
153                            objectOutput.writeUTF(StringPool.BLANK);
154                    }
155                    else {
156                            objectOutput.writeUTF(homeURL);
157                    }
158    
159                    objectOutput.writeLong(logoId);
160                    objectOutput.writeBoolean(system);
161                    objectOutput.writeInt(maxUsers);
162                    objectOutput.writeBoolean(active);
163    
164                    objectOutput.writeObject(_keyObj);
165            }
166    
167            public long companyId;
168            public long accountId;
169            public String webId;
170            public String key;
171            public String mx;
172            public String homeURL;
173            public long logoId;
174            public boolean system;
175            public int maxUsers;
176            public boolean active;
177            public java.security.Key _keyObj;
178    }