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