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.Account;
020    import com.liferay.portal.model.CacheModel;
021    
022    import java.io.Externalizable;
023    import java.io.IOException;
024    import java.io.ObjectInput;
025    import java.io.ObjectOutput;
026    
027    import java.util.Date;
028    
029    /**
030     * The cache model class for representing Account in entity cache.
031     *
032     * @author Brian Wing Shun Chan
033     * @see Account
034     * @generated
035     */
036    public class AccountCacheModel implements CacheModel<Account>, Externalizable {
037            @Override
038            public String toString() {
039                    StringBundler sb = new StringBundler(33);
040    
041                    sb.append("{accountId=");
042                    sb.append(accountId);
043                    sb.append(", companyId=");
044                    sb.append(companyId);
045                    sb.append(", userId=");
046                    sb.append(userId);
047                    sb.append(", userName=");
048                    sb.append(userName);
049                    sb.append(", createDate=");
050                    sb.append(createDate);
051                    sb.append(", modifiedDate=");
052                    sb.append(modifiedDate);
053                    sb.append(", parentAccountId=");
054                    sb.append(parentAccountId);
055                    sb.append(", name=");
056                    sb.append(name);
057                    sb.append(", legalName=");
058                    sb.append(legalName);
059                    sb.append(", legalId=");
060                    sb.append(legalId);
061                    sb.append(", legalType=");
062                    sb.append(legalType);
063                    sb.append(", sicCode=");
064                    sb.append(sicCode);
065                    sb.append(", tickerSymbol=");
066                    sb.append(tickerSymbol);
067                    sb.append(", industry=");
068                    sb.append(industry);
069                    sb.append(", type=");
070                    sb.append(type);
071                    sb.append(", size=");
072                    sb.append(size);
073                    sb.append("}");
074    
075                    return sb.toString();
076            }
077    
078            public Account toEntityModel() {
079                    AccountImpl accountImpl = new AccountImpl();
080    
081                    accountImpl.setAccountId(accountId);
082                    accountImpl.setCompanyId(companyId);
083                    accountImpl.setUserId(userId);
084    
085                    if (userName == null) {
086                            accountImpl.setUserName(StringPool.BLANK);
087                    }
088                    else {
089                            accountImpl.setUserName(userName);
090                    }
091    
092                    if (createDate == Long.MIN_VALUE) {
093                            accountImpl.setCreateDate(null);
094                    }
095                    else {
096                            accountImpl.setCreateDate(new Date(createDate));
097                    }
098    
099                    if (modifiedDate == Long.MIN_VALUE) {
100                            accountImpl.setModifiedDate(null);
101                    }
102                    else {
103                            accountImpl.setModifiedDate(new Date(modifiedDate));
104                    }
105    
106                    accountImpl.setParentAccountId(parentAccountId);
107    
108                    if (name == null) {
109                            accountImpl.setName(StringPool.BLANK);
110                    }
111                    else {
112                            accountImpl.setName(name);
113                    }
114    
115                    if (legalName == null) {
116                            accountImpl.setLegalName(StringPool.BLANK);
117                    }
118                    else {
119                            accountImpl.setLegalName(legalName);
120                    }
121    
122                    if (legalId == null) {
123                            accountImpl.setLegalId(StringPool.BLANK);
124                    }
125                    else {
126                            accountImpl.setLegalId(legalId);
127                    }
128    
129                    if (legalType == null) {
130                            accountImpl.setLegalType(StringPool.BLANK);
131                    }
132                    else {
133                            accountImpl.setLegalType(legalType);
134                    }
135    
136                    if (sicCode == null) {
137                            accountImpl.setSicCode(StringPool.BLANK);
138                    }
139                    else {
140                            accountImpl.setSicCode(sicCode);
141                    }
142    
143                    if (tickerSymbol == null) {
144                            accountImpl.setTickerSymbol(StringPool.BLANK);
145                    }
146                    else {
147                            accountImpl.setTickerSymbol(tickerSymbol);
148                    }
149    
150                    if (industry == null) {
151                            accountImpl.setIndustry(StringPool.BLANK);
152                    }
153                    else {
154                            accountImpl.setIndustry(industry);
155                    }
156    
157                    if (type == null) {
158                            accountImpl.setType(StringPool.BLANK);
159                    }
160                    else {
161                            accountImpl.setType(type);
162                    }
163    
164                    if (size == null) {
165                            accountImpl.setSize(StringPool.BLANK);
166                    }
167                    else {
168                            accountImpl.setSize(size);
169                    }
170    
171                    accountImpl.resetOriginalValues();
172    
173                    return accountImpl;
174            }
175    
176            public void readExternal(ObjectInput objectInput) throws IOException {
177                    accountId = objectInput.readLong();
178                    companyId = objectInput.readLong();
179                    userId = objectInput.readLong();
180                    userName = objectInput.readUTF();
181                    createDate = objectInput.readLong();
182                    modifiedDate = objectInput.readLong();
183                    parentAccountId = objectInput.readLong();
184                    name = objectInput.readUTF();
185                    legalName = objectInput.readUTF();
186                    legalId = objectInput.readUTF();
187                    legalType = objectInput.readUTF();
188                    sicCode = objectInput.readUTF();
189                    tickerSymbol = objectInput.readUTF();
190                    industry = objectInput.readUTF();
191                    type = objectInput.readUTF();
192                    size = objectInput.readUTF();
193            }
194    
195            public void writeExternal(ObjectOutput objectOutput)
196                    throws IOException {
197                    objectOutput.writeLong(accountId);
198                    objectOutput.writeLong(companyId);
199                    objectOutput.writeLong(userId);
200    
201                    if (userName == null) {
202                            objectOutput.writeUTF(StringPool.BLANK);
203                    }
204                    else {
205                            objectOutput.writeUTF(userName);
206                    }
207    
208                    objectOutput.writeLong(createDate);
209                    objectOutput.writeLong(modifiedDate);
210                    objectOutput.writeLong(parentAccountId);
211    
212                    if (name == null) {
213                            objectOutput.writeUTF(StringPool.BLANK);
214                    }
215                    else {
216                            objectOutput.writeUTF(name);
217                    }
218    
219                    if (legalName == null) {
220                            objectOutput.writeUTF(StringPool.BLANK);
221                    }
222                    else {
223                            objectOutput.writeUTF(legalName);
224                    }
225    
226                    if (legalId == null) {
227                            objectOutput.writeUTF(StringPool.BLANK);
228                    }
229                    else {
230                            objectOutput.writeUTF(legalId);
231                    }
232    
233                    if (legalType == null) {
234                            objectOutput.writeUTF(StringPool.BLANK);
235                    }
236                    else {
237                            objectOutput.writeUTF(legalType);
238                    }
239    
240                    if (sicCode == null) {
241                            objectOutput.writeUTF(StringPool.BLANK);
242                    }
243                    else {
244                            objectOutput.writeUTF(sicCode);
245                    }
246    
247                    if (tickerSymbol == null) {
248                            objectOutput.writeUTF(StringPool.BLANK);
249                    }
250                    else {
251                            objectOutput.writeUTF(tickerSymbol);
252                    }
253    
254                    if (industry == null) {
255                            objectOutput.writeUTF(StringPool.BLANK);
256                    }
257                    else {
258                            objectOutput.writeUTF(industry);
259                    }
260    
261                    if (type == null) {
262                            objectOutput.writeUTF(StringPool.BLANK);
263                    }
264                    else {
265                            objectOutput.writeUTF(type);
266                    }
267    
268                    if (size == null) {
269                            objectOutput.writeUTF(StringPool.BLANK);
270                    }
271                    else {
272                            objectOutput.writeUTF(size);
273                    }
274            }
275    
276            public long accountId;
277            public long companyId;
278            public long userId;
279            public String userName;
280            public long createDate;
281            public long modifiedDate;
282            public long parentAccountId;
283            public String name;
284            public String legalName;
285            public String legalId;
286            public String legalType;
287            public String sicCode;
288            public String tickerSymbol;
289            public String industry;
290            public String type;
291            public String size;
292    }