001    /**
002     * Copyright (c) 2000-2010 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.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.util.GetterUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.Account;
023    import com.liferay.portal.model.AccountModel;
024    import com.liferay.portal.model.AccountSoap;
025    import com.liferay.portal.service.ServiceContext;
026    import com.liferay.portal.util.PortalUtil;
027    
028    import com.liferay.portlet.expando.model.ExpandoBridge;
029    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
030    
031    import java.io.Serializable;
032    
033    import java.lang.reflect.Proxy;
034    
035    import java.sql.Types;
036    
037    import java.util.ArrayList;
038    import java.util.Date;
039    import java.util.List;
040    
041    /**
042     * The base model implementation for the Account service. Represents a row in the "Account_" database table, with each column mapped to a property of this class.
043     *
044     * <p>
045     * This implementation and its corresponding interface {@link com.liferay.portal.model.AccountModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link AccountImpl}.
046     * </p>
047     *
048     * <p>
049     * Never modify or reference this class directly. All methods that expect a account model instance should use the {@link com.liferay.portal.model.Account} interface instead.
050     * </p>
051     *
052     * @author Brian Wing Shun Chan
053     * @see AccountImpl
054     * @see com.liferay.portal.model.Account
055     * @see com.liferay.portal.model.AccountModel
056     * @generated
057     */
058    public class AccountModelImpl extends BaseModelImpl<Account>
059            implements AccountModel {
060            public static final String TABLE_NAME = "Account_";
061            public static final Object[][] TABLE_COLUMNS = {
062                            { "accountId", new Integer(Types.BIGINT) },
063                            { "companyId", new Integer(Types.BIGINT) },
064                            { "userId", new Integer(Types.BIGINT) },
065                            { "userName", new Integer(Types.VARCHAR) },
066                            { "createDate", new Integer(Types.TIMESTAMP) },
067                            { "modifiedDate", new Integer(Types.TIMESTAMP) },
068                            { "parentAccountId", new Integer(Types.BIGINT) },
069                            { "name", new Integer(Types.VARCHAR) },
070                            { "legalName", new Integer(Types.VARCHAR) },
071                            { "legalId", new Integer(Types.VARCHAR) },
072                            { "legalType", new Integer(Types.VARCHAR) },
073                            { "sicCode", new Integer(Types.VARCHAR) },
074                            { "tickerSymbol", new Integer(Types.VARCHAR) },
075                            { "industry", new Integer(Types.VARCHAR) },
076                            { "type_", new Integer(Types.VARCHAR) },
077                            { "size_", new Integer(Types.VARCHAR) }
078                    };
079            public static final String TABLE_SQL_CREATE = "create table Account_ (accountId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,parentAccountId LONG,name VARCHAR(75) null,legalName VARCHAR(75) null,legalId VARCHAR(75) null,legalType VARCHAR(75) null,sicCode VARCHAR(75) null,tickerSymbol VARCHAR(75) null,industry VARCHAR(75) null,type_ VARCHAR(75) null,size_ VARCHAR(75) null)";
080            public static final String TABLE_SQL_DROP = "drop table Account_";
081            public static final String DATA_SOURCE = "liferayDataSource";
082            public static final String SESSION_FACTORY = "liferaySessionFactory";
083            public static final String TX_MANAGER = "liferayTransactionManager";
084            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
085                                    "value.object.entity.cache.enabled.com.liferay.portal.model.Account"),
086                            true);
087            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
088                                    "value.object.finder.cache.enabled.com.liferay.portal.model.Account"),
089                            true);
090    
091            /**
092             * Converts the soap model instance into a normal model instance.
093             *
094             * @param soapModel the soap model instance to convert
095             * @return the normal model instance
096             */
097            public static Account toModel(AccountSoap soapModel) {
098                    Account model = new AccountImpl();
099    
100                    model.setAccountId(soapModel.getAccountId());
101                    model.setCompanyId(soapModel.getCompanyId());
102                    model.setUserId(soapModel.getUserId());
103                    model.setUserName(soapModel.getUserName());
104                    model.setCreateDate(soapModel.getCreateDate());
105                    model.setModifiedDate(soapModel.getModifiedDate());
106                    model.setParentAccountId(soapModel.getParentAccountId());
107                    model.setName(soapModel.getName());
108                    model.setLegalName(soapModel.getLegalName());
109                    model.setLegalId(soapModel.getLegalId());
110                    model.setLegalType(soapModel.getLegalType());
111                    model.setSicCode(soapModel.getSicCode());
112                    model.setTickerSymbol(soapModel.getTickerSymbol());
113                    model.setIndustry(soapModel.getIndustry());
114                    model.setType(soapModel.getType());
115                    model.setSize(soapModel.getSize());
116    
117                    return model;
118            }
119    
120            /**
121             * Converts the soap model instances into normal model instances.
122             *
123             * @param soapModels the soap model instances to convert
124             * @return the normal model instances
125             */
126            public static List<Account> toModels(AccountSoap[] soapModels) {
127                    List<Account> models = new ArrayList<Account>(soapModels.length);
128    
129                    for (AccountSoap soapModel : soapModels) {
130                            models.add(toModel(soapModel));
131                    }
132    
133                    return models;
134            }
135    
136            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
137                                    "lock.expiration.time.com.liferay.portal.model.Account"));
138    
139            public AccountModelImpl() {
140            }
141    
142            public long getPrimaryKey() {
143                    return _accountId;
144            }
145    
146            public void setPrimaryKey(long pk) {
147                    setAccountId(pk);
148            }
149    
150            public Serializable getPrimaryKeyObj() {
151                    return new Long(_accountId);
152            }
153    
154            public long getAccountId() {
155                    return _accountId;
156            }
157    
158            public void setAccountId(long accountId) {
159                    _accountId = accountId;
160            }
161    
162            public long getCompanyId() {
163                    return _companyId;
164            }
165    
166            public void setCompanyId(long companyId) {
167                    _companyId = companyId;
168            }
169    
170            public long getUserId() {
171                    return _userId;
172            }
173    
174            public void setUserId(long userId) {
175                    _userId = userId;
176            }
177    
178            public String getUserUuid() throws SystemException {
179                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
180            }
181    
182            public void setUserUuid(String userUuid) {
183                    _userUuid = userUuid;
184            }
185    
186            public String getUserName() {
187                    if (_userName == null) {
188                            return StringPool.BLANK;
189                    }
190                    else {
191                            return _userName;
192                    }
193            }
194    
195            public void setUserName(String userName) {
196                    _userName = userName;
197            }
198    
199            public Date getCreateDate() {
200                    return _createDate;
201            }
202    
203            public void setCreateDate(Date createDate) {
204                    _createDate = createDate;
205            }
206    
207            public Date getModifiedDate() {
208                    return _modifiedDate;
209            }
210    
211            public void setModifiedDate(Date modifiedDate) {
212                    _modifiedDate = modifiedDate;
213            }
214    
215            public long getParentAccountId() {
216                    return _parentAccountId;
217            }
218    
219            public void setParentAccountId(long parentAccountId) {
220                    _parentAccountId = parentAccountId;
221            }
222    
223            public String getName() {
224                    if (_name == null) {
225                            return StringPool.BLANK;
226                    }
227                    else {
228                            return _name;
229                    }
230            }
231    
232            public void setName(String name) {
233                    _name = name;
234            }
235    
236            public String getLegalName() {
237                    if (_legalName == null) {
238                            return StringPool.BLANK;
239                    }
240                    else {
241                            return _legalName;
242                    }
243            }
244    
245            public void setLegalName(String legalName) {
246                    _legalName = legalName;
247            }
248    
249            public String getLegalId() {
250                    if (_legalId == null) {
251                            return StringPool.BLANK;
252                    }
253                    else {
254                            return _legalId;
255                    }
256            }
257    
258            public void setLegalId(String legalId) {
259                    _legalId = legalId;
260            }
261    
262            public String getLegalType() {
263                    if (_legalType == null) {
264                            return StringPool.BLANK;
265                    }
266                    else {
267                            return _legalType;
268                    }
269            }
270    
271            public void setLegalType(String legalType) {
272                    _legalType = legalType;
273            }
274    
275            public String getSicCode() {
276                    if (_sicCode == null) {
277                            return StringPool.BLANK;
278                    }
279                    else {
280                            return _sicCode;
281                    }
282            }
283    
284            public void setSicCode(String sicCode) {
285                    _sicCode = sicCode;
286            }
287    
288            public String getTickerSymbol() {
289                    if (_tickerSymbol == null) {
290                            return StringPool.BLANK;
291                    }
292                    else {
293                            return _tickerSymbol;
294                    }
295            }
296    
297            public void setTickerSymbol(String tickerSymbol) {
298                    _tickerSymbol = tickerSymbol;
299            }
300    
301            public String getIndustry() {
302                    if (_industry == null) {
303                            return StringPool.BLANK;
304                    }
305                    else {
306                            return _industry;
307                    }
308            }
309    
310            public void setIndustry(String industry) {
311                    _industry = industry;
312            }
313    
314            public String getType() {
315                    if (_type == null) {
316                            return StringPool.BLANK;
317                    }
318                    else {
319                            return _type;
320                    }
321            }
322    
323            public void setType(String type) {
324                    _type = type;
325            }
326    
327            public String getSize() {
328                    if (_size == null) {
329                            return StringPool.BLANK;
330                    }
331                    else {
332                            return _size;
333                    }
334            }
335    
336            public void setSize(String size) {
337                    _size = size;
338            }
339    
340            public Account toEscapedModel() {
341                    if (isEscapedModel()) {
342                            return (Account)this;
343                    }
344                    else {
345                            return (Account)Proxy.newProxyInstance(Account.class.getClassLoader(),
346                                    new Class[] { Account.class }, new AutoEscapeBeanHandler(this));
347                    }
348            }
349    
350            public ExpandoBridge getExpandoBridge() {
351                    if (_expandoBridge == null) {
352                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
353                                            Account.class.getName(), getPrimaryKey());
354                    }
355    
356                    return _expandoBridge;
357            }
358    
359            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
360                    getExpandoBridge().setAttributes(serviceContext);
361            }
362    
363            public Object clone() {
364                    AccountImpl clone = new AccountImpl();
365    
366                    clone.setAccountId(getAccountId());
367                    clone.setCompanyId(getCompanyId());
368                    clone.setUserId(getUserId());
369                    clone.setUserName(getUserName());
370                    clone.setCreateDate(getCreateDate());
371                    clone.setModifiedDate(getModifiedDate());
372                    clone.setParentAccountId(getParentAccountId());
373                    clone.setName(getName());
374                    clone.setLegalName(getLegalName());
375                    clone.setLegalId(getLegalId());
376                    clone.setLegalType(getLegalType());
377                    clone.setSicCode(getSicCode());
378                    clone.setTickerSymbol(getTickerSymbol());
379                    clone.setIndustry(getIndustry());
380                    clone.setType(getType());
381                    clone.setSize(getSize());
382    
383                    return clone;
384            }
385    
386            public int compareTo(Account account) {
387                    long pk = account.getPrimaryKey();
388    
389                    if (getPrimaryKey() < pk) {
390                            return -1;
391                    }
392                    else if (getPrimaryKey() > pk) {
393                            return 1;
394                    }
395                    else {
396                            return 0;
397                    }
398            }
399    
400            public boolean equals(Object obj) {
401                    if (obj == null) {
402                            return false;
403                    }
404    
405                    Account account = null;
406    
407                    try {
408                            account = (Account)obj;
409                    }
410                    catch (ClassCastException cce) {
411                            return false;
412                    }
413    
414                    long pk = account.getPrimaryKey();
415    
416                    if (getPrimaryKey() == pk) {
417                            return true;
418                    }
419                    else {
420                            return false;
421                    }
422            }
423    
424            public int hashCode() {
425                    return (int)getPrimaryKey();
426            }
427    
428            public String toString() {
429                    StringBundler sb = new StringBundler(33);
430    
431                    sb.append("{accountId=");
432                    sb.append(getAccountId());
433                    sb.append(", companyId=");
434                    sb.append(getCompanyId());
435                    sb.append(", userId=");
436                    sb.append(getUserId());
437                    sb.append(", userName=");
438                    sb.append(getUserName());
439                    sb.append(", createDate=");
440                    sb.append(getCreateDate());
441                    sb.append(", modifiedDate=");
442                    sb.append(getModifiedDate());
443                    sb.append(", parentAccountId=");
444                    sb.append(getParentAccountId());
445                    sb.append(", name=");
446                    sb.append(getName());
447                    sb.append(", legalName=");
448                    sb.append(getLegalName());
449                    sb.append(", legalId=");
450                    sb.append(getLegalId());
451                    sb.append(", legalType=");
452                    sb.append(getLegalType());
453                    sb.append(", sicCode=");
454                    sb.append(getSicCode());
455                    sb.append(", tickerSymbol=");
456                    sb.append(getTickerSymbol());
457                    sb.append(", industry=");
458                    sb.append(getIndustry());
459                    sb.append(", type=");
460                    sb.append(getType());
461                    sb.append(", size=");
462                    sb.append(getSize());
463                    sb.append("}");
464    
465                    return sb.toString();
466            }
467    
468            public String toXmlString() {
469                    StringBundler sb = new StringBundler(52);
470    
471                    sb.append("<model><model-name>");
472                    sb.append("com.liferay.portal.model.Account");
473                    sb.append("</model-name>");
474    
475                    sb.append(
476                            "<column><column-name>accountId</column-name><column-value><![CDATA[");
477                    sb.append(getAccountId());
478                    sb.append("]]></column-value></column>");
479                    sb.append(
480                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
481                    sb.append(getCompanyId());
482                    sb.append("]]></column-value></column>");
483                    sb.append(
484                            "<column><column-name>userId</column-name><column-value><![CDATA[");
485                    sb.append(getUserId());
486                    sb.append("]]></column-value></column>");
487                    sb.append(
488                            "<column><column-name>userName</column-name><column-value><![CDATA[");
489                    sb.append(getUserName());
490                    sb.append("]]></column-value></column>");
491                    sb.append(
492                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
493                    sb.append(getCreateDate());
494                    sb.append("]]></column-value></column>");
495                    sb.append(
496                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
497                    sb.append(getModifiedDate());
498                    sb.append("]]></column-value></column>");
499                    sb.append(
500                            "<column><column-name>parentAccountId</column-name><column-value><![CDATA[");
501                    sb.append(getParentAccountId());
502                    sb.append("]]></column-value></column>");
503                    sb.append(
504                            "<column><column-name>name</column-name><column-value><![CDATA[");
505                    sb.append(getName());
506                    sb.append("]]></column-value></column>");
507                    sb.append(
508                            "<column><column-name>legalName</column-name><column-value><![CDATA[");
509                    sb.append(getLegalName());
510                    sb.append("]]></column-value></column>");
511                    sb.append(
512                            "<column><column-name>legalId</column-name><column-value><![CDATA[");
513                    sb.append(getLegalId());
514                    sb.append("]]></column-value></column>");
515                    sb.append(
516                            "<column><column-name>legalType</column-name><column-value><![CDATA[");
517                    sb.append(getLegalType());
518                    sb.append("]]></column-value></column>");
519                    sb.append(
520                            "<column><column-name>sicCode</column-name><column-value><![CDATA[");
521                    sb.append(getSicCode());
522                    sb.append("]]></column-value></column>");
523                    sb.append(
524                            "<column><column-name>tickerSymbol</column-name><column-value><![CDATA[");
525                    sb.append(getTickerSymbol());
526                    sb.append("]]></column-value></column>");
527                    sb.append(
528                            "<column><column-name>industry</column-name><column-value><![CDATA[");
529                    sb.append(getIndustry());
530                    sb.append("]]></column-value></column>");
531                    sb.append(
532                            "<column><column-name>type</column-name><column-value><![CDATA[");
533                    sb.append(getType());
534                    sb.append("]]></column-value></column>");
535                    sb.append(
536                            "<column><column-name>size</column-name><column-value><![CDATA[");
537                    sb.append(getSize());
538                    sb.append("]]></column-value></column>");
539    
540                    sb.append("</model>");
541    
542                    return sb.toString();
543            }
544    
545            private long _accountId;
546            private long _companyId;
547            private long _userId;
548            private String _userUuid;
549            private String _userName;
550            private Date _createDate;
551            private Date _modifiedDate;
552            private long _parentAccountId;
553            private String _name;
554            private String _legalName;
555            private String _legalId;
556            private String _legalType;
557            private String _sicCode;
558            private String _tickerSymbol;
559            private String _industry;
560            private String _type;
561            private String _size;
562            private transient ExpandoBridge _expandoBridge;
563    }