001
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.json.JSON;
020 import com.liferay.portal.kernel.util.GetterUtil;
021 import com.liferay.portal.kernel.util.ProxyUtil;
022 import com.liferay.portal.kernel.util.StringBundler;
023 import com.liferay.portal.kernel.util.StringPool;
024 import com.liferay.portal.model.Account;
025 import com.liferay.portal.model.AccountModel;
026 import com.liferay.portal.model.AccountSoap;
027 import com.liferay.portal.model.CacheModel;
028 import com.liferay.portal.service.ServiceContext;
029 import com.liferay.portal.util.PortalUtil;
030
031 import com.liferay.portlet.expando.model.ExpandoBridge;
032 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
033
034 import java.io.Serializable;
035
036 import java.sql.Types;
037
038 import java.util.ArrayList;
039 import java.util.Date;
040 import java.util.HashMap;
041 import java.util.List;
042 import java.util.Map;
043
044
057 @JSON(strict = true)
058 public class AccountModelImpl extends BaseModelImpl<Account>
059 implements AccountModel {
060
065 public static final String TABLE_NAME = "Account_";
066 public static final Object[][] TABLE_COLUMNS = {
067 { "accountId", Types.BIGINT },
068 { "companyId", Types.BIGINT },
069 { "userId", Types.BIGINT },
070 { "userName", Types.VARCHAR },
071 { "createDate", Types.TIMESTAMP },
072 { "modifiedDate", Types.TIMESTAMP },
073 { "parentAccountId", Types.BIGINT },
074 { "name", Types.VARCHAR },
075 { "legalName", Types.VARCHAR },
076 { "legalId", Types.VARCHAR },
077 { "legalType", Types.VARCHAR },
078 { "sicCode", Types.VARCHAR },
079 { "tickerSymbol", Types.VARCHAR },
080 { "industry", Types.VARCHAR },
081 { "type_", Types.VARCHAR },
082 { "size_", Types.VARCHAR }
083 };
084 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)";
085 public static final String TABLE_SQL_DROP = "drop table Account_";
086 public static final String DATA_SOURCE = "liferayDataSource";
087 public static final String SESSION_FACTORY = "liferaySessionFactory";
088 public static final String TX_MANAGER = "liferayTransactionManager";
089 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
090 "value.object.entity.cache.enabled.com.liferay.portal.model.Account"),
091 true);
092 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
093 "value.object.finder.cache.enabled.com.liferay.portal.model.Account"),
094 true);
095 public static final boolean COLUMN_BITMASK_ENABLED = false;
096
097
103 public static Account toModel(AccountSoap soapModel) {
104 if (soapModel == null) {
105 return null;
106 }
107
108 Account model = new AccountImpl();
109
110 model.setAccountId(soapModel.getAccountId());
111 model.setCompanyId(soapModel.getCompanyId());
112 model.setUserId(soapModel.getUserId());
113 model.setUserName(soapModel.getUserName());
114 model.setCreateDate(soapModel.getCreateDate());
115 model.setModifiedDate(soapModel.getModifiedDate());
116 model.setParentAccountId(soapModel.getParentAccountId());
117 model.setName(soapModel.getName());
118 model.setLegalName(soapModel.getLegalName());
119 model.setLegalId(soapModel.getLegalId());
120 model.setLegalType(soapModel.getLegalType());
121 model.setSicCode(soapModel.getSicCode());
122 model.setTickerSymbol(soapModel.getTickerSymbol());
123 model.setIndustry(soapModel.getIndustry());
124 model.setType(soapModel.getType());
125 model.setSize(soapModel.getSize());
126
127 return model;
128 }
129
130
136 public static List<Account> toModels(AccountSoap[] soapModels) {
137 if (soapModels == null) {
138 return null;
139 }
140
141 List<Account> models = new ArrayList<Account>(soapModels.length);
142
143 for (AccountSoap soapModel : soapModels) {
144 models.add(toModel(soapModel));
145 }
146
147 return models;
148 }
149
150 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
151 "lock.expiration.time.com.liferay.portal.model.Account"));
152
153 public AccountModelImpl() {
154 }
155
156 public long getPrimaryKey() {
157 return _accountId;
158 }
159
160 public void setPrimaryKey(long primaryKey) {
161 setAccountId(primaryKey);
162 }
163
164 public Serializable getPrimaryKeyObj() {
165 return new Long(_accountId);
166 }
167
168 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
169 setPrimaryKey(((Long)primaryKeyObj).longValue());
170 }
171
172 public Class<?> getModelClass() {
173 return Account.class;
174 }
175
176 public String getModelClassName() {
177 return Account.class.getName();
178 }
179
180 @Override
181 public Map<String, Object> getModelAttributes() {
182 Map<String, Object> attributes = new HashMap<String, Object>();
183
184 attributes.put("accountId", getAccountId());
185 attributes.put("companyId", getCompanyId());
186 attributes.put("userId", getUserId());
187 attributes.put("userName", getUserName());
188 attributes.put("createDate", getCreateDate());
189 attributes.put("modifiedDate", getModifiedDate());
190 attributes.put("parentAccountId", getParentAccountId());
191 attributes.put("name", getName());
192 attributes.put("legalName", getLegalName());
193 attributes.put("legalId", getLegalId());
194 attributes.put("legalType", getLegalType());
195 attributes.put("sicCode", getSicCode());
196 attributes.put("tickerSymbol", getTickerSymbol());
197 attributes.put("industry", getIndustry());
198 attributes.put("type", getType());
199 attributes.put("size", getSize());
200
201 return attributes;
202 }
203
204 @Override
205 public void setModelAttributes(Map<String, Object> attributes) {
206 Long accountId = (Long)attributes.get("accountId");
207
208 if (accountId != null) {
209 setAccountId(accountId);
210 }
211
212 Long companyId = (Long)attributes.get("companyId");
213
214 if (companyId != null) {
215 setCompanyId(companyId);
216 }
217
218 Long userId = (Long)attributes.get("userId");
219
220 if (userId != null) {
221 setUserId(userId);
222 }
223
224 String userName = (String)attributes.get("userName");
225
226 if (userName != null) {
227 setUserName(userName);
228 }
229
230 Date createDate = (Date)attributes.get("createDate");
231
232 if (createDate != null) {
233 setCreateDate(createDate);
234 }
235
236 Date modifiedDate = (Date)attributes.get("modifiedDate");
237
238 if (modifiedDate != null) {
239 setModifiedDate(modifiedDate);
240 }
241
242 Long parentAccountId = (Long)attributes.get("parentAccountId");
243
244 if (parentAccountId != null) {
245 setParentAccountId(parentAccountId);
246 }
247
248 String name = (String)attributes.get("name");
249
250 if (name != null) {
251 setName(name);
252 }
253
254 String legalName = (String)attributes.get("legalName");
255
256 if (legalName != null) {
257 setLegalName(legalName);
258 }
259
260 String legalId = (String)attributes.get("legalId");
261
262 if (legalId != null) {
263 setLegalId(legalId);
264 }
265
266 String legalType = (String)attributes.get("legalType");
267
268 if (legalType != null) {
269 setLegalType(legalType);
270 }
271
272 String sicCode = (String)attributes.get("sicCode");
273
274 if (sicCode != null) {
275 setSicCode(sicCode);
276 }
277
278 String tickerSymbol = (String)attributes.get("tickerSymbol");
279
280 if (tickerSymbol != null) {
281 setTickerSymbol(tickerSymbol);
282 }
283
284 String industry = (String)attributes.get("industry");
285
286 if (industry != null) {
287 setIndustry(industry);
288 }
289
290 String type = (String)attributes.get("type");
291
292 if (type != null) {
293 setType(type);
294 }
295
296 String size = (String)attributes.get("size");
297
298 if (size != null) {
299 setSize(size);
300 }
301 }
302
303 @JSON
304 public long getAccountId() {
305 return _accountId;
306 }
307
308 public void setAccountId(long accountId) {
309 _accountId = accountId;
310 }
311
312 @JSON
313 public long getCompanyId() {
314 return _companyId;
315 }
316
317 public void setCompanyId(long companyId) {
318 _companyId = companyId;
319 }
320
321 @JSON
322 public long getUserId() {
323 return _userId;
324 }
325
326 public void setUserId(long userId) {
327 _userId = userId;
328 }
329
330 public String getUserUuid() throws SystemException {
331 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
332 }
333
334 public void setUserUuid(String userUuid) {
335 _userUuid = userUuid;
336 }
337
338 @JSON
339 public String getUserName() {
340 if (_userName == null) {
341 return StringPool.BLANK;
342 }
343 else {
344 return _userName;
345 }
346 }
347
348 public void setUserName(String userName) {
349 _userName = userName;
350 }
351
352 @JSON
353 public Date getCreateDate() {
354 return _createDate;
355 }
356
357 public void setCreateDate(Date createDate) {
358 _createDate = createDate;
359 }
360
361 @JSON
362 public Date getModifiedDate() {
363 return _modifiedDate;
364 }
365
366 public void setModifiedDate(Date modifiedDate) {
367 _modifiedDate = modifiedDate;
368 }
369
370 @JSON
371 public long getParentAccountId() {
372 return _parentAccountId;
373 }
374
375 public void setParentAccountId(long parentAccountId) {
376 _parentAccountId = parentAccountId;
377 }
378
379 @JSON
380 public String getName() {
381 if (_name == null) {
382 return StringPool.BLANK;
383 }
384 else {
385 return _name;
386 }
387 }
388
389 public void setName(String name) {
390 _name = name;
391 }
392
393 @JSON
394 public String getLegalName() {
395 if (_legalName == null) {
396 return StringPool.BLANK;
397 }
398 else {
399 return _legalName;
400 }
401 }
402
403 public void setLegalName(String legalName) {
404 _legalName = legalName;
405 }
406
407 @JSON
408 public String getLegalId() {
409 if (_legalId == null) {
410 return StringPool.BLANK;
411 }
412 else {
413 return _legalId;
414 }
415 }
416
417 public void setLegalId(String legalId) {
418 _legalId = legalId;
419 }
420
421 @JSON
422 public String getLegalType() {
423 if (_legalType == null) {
424 return StringPool.BLANK;
425 }
426 else {
427 return _legalType;
428 }
429 }
430
431 public void setLegalType(String legalType) {
432 _legalType = legalType;
433 }
434
435 @JSON
436 public String getSicCode() {
437 if (_sicCode == null) {
438 return StringPool.BLANK;
439 }
440 else {
441 return _sicCode;
442 }
443 }
444
445 public void setSicCode(String sicCode) {
446 _sicCode = sicCode;
447 }
448
449 @JSON
450 public String getTickerSymbol() {
451 if (_tickerSymbol == null) {
452 return StringPool.BLANK;
453 }
454 else {
455 return _tickerSymbol;
456 }
457 }
458
459 public void setTickerSymbol(String tickerSymbol) {
460 _tickerSymbol = tickerSymbol;
461 }
462
463 @JSON
464 public String getIndustry() {
465 if (_industry == null) {
466 return StringPool.BLANK;
467 }
468 else {
469 return _industry;
470 }
471 }
472
473 public void setIndustry(String industry) {
474 _industry = industry;
475 }
476
477 @JSON
478 public String getType() {
479 if (_type == null) {
480 return StringPool.BLANK;
481 }
482 else {
483 return _type;
484 }
485 }
486
487 public void setType(String type) {
488 _type = type;
489 }
490
491 @JSON
492 public String getSize() {
493 if (_size == null) {
494 return StringPool.BLANK;
495 }
496 else {
497 return _size;
498 }
499 }
500
501 public void setSize(String size) {
502 _size = size;
503 }
504
505 @Override
506 public ExpandoBridge getExpandoBridge() {
507 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
508 Account.class.getName(), getPrimaryKey());
509 }
510
511 @Override
512 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
513 ExpandoBridge expandoBridge = getExpandoBridge();
514
515 expandoBridge.setAttributes(serviceContext);
516 }
517
518 @Override
519 public Account toEscapedModel() {
520 if (_escapedModel == null) {
521 _escapedModel = (Account)ProxyUtil.newProxyInstance(_classLoader,
522 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
523 }
524
525 return _escapedModel;
526 }
527
528 public Account toUnescapedModel() {
529 return (Account)this;
530 }
531
532 @Override
533 public Object clone() {
534 AccountImpl accountImpl = new AccountImpl();
535
536 accountImpl.setAccountId(getAccountId());
537 accountImpl.setCompanyId(getCompanyId());
538 accountImpl.setUserId(getUserId());
539 accountImpl.setUserName(getUserName());
540 accountImpl.setCreateDate(getCreateDate());
541 accountImpl.setModifiedDate(getModifiedDate());
542 accountImpl.setParentAccountId(getParentAccountId());
543 accountImpl.setName(getName());
544 accountImpl.setLegalName(getLegalName());
545 accountImpl.setLegalId(getLegalId());
546 accountImpl.setLegalType(getLegalType());
547 accountImpl.setSicCode(getSicCode());
548 accountImpl.setTickerSymbol(getTickerSymbol());
549 accountImpl.setIndustry(getIndustry());
550 accountImpl.setType(getType());
551 accountImpl.setSize(getSize());
552
553 accountImpl.resetOriginalValues();
554
555 return accountImpl;
556 }
557
558 public int compareTo(Account account) {
559 long primaryKey = account.getPrimaryKey();
560
561 if (getPrimaryKey() < primaryKey) {
562 return -1;
563 }
564 else if (getPrimaryKey() > primaryKey) {
565 return 1;
566 }
567 else {
568 return 0;
569 }
570 }
571
572 @Override
573 public boolean equals(Object obj) {
574 if (this == obj) {
575 return true;
576 }
577
578 if (!(obj instanceof Account)) {
579 return false;
580 }
581
582 Account account = (Account)obj;
583
584 long primaryKey = account.getPrimaryKey();
585
586 if (getPrimaryKey() == primaryKey) {
587 return true;
588 }
589 else {
590 return false;
591 }
592 }
593
594 @Override
595 public int hashCode() {
596 return (int)getPrimaryKey();
597 }
598
599 @Override
600 public void resetOriginalValues() {
601 }
602
603 @Override
604 public CacheModel<Account> toCacheModel() {
605 AccountCacheModel accountCacheModel = new AccountCacheModel();
606
607 accountCacheModel.accountId = getAccountId();
608
609 accountCacheModel.companyId = getCompanyId();
610
611 accountCacheModel.userId = getUserId();
612
613 accountCacheModel.userName = getUserName();
614
615 String userName = accountCacheModel.userName;
616
617 if ((userName != null) && (userName.length() == 0)) {
618 accountCacheModel.userName = null;
619 }
620
621 Date createDate = getCreateDate();
622
623 if (createDate != null) {
624 accountCacheModel.createDate = createDate.getTime();
625 }
626 else {
627 accountCacheModel.createDate = Long.MIN_VALUE;
628 }
629
630 Date modifiedDate = getModifiedDate();
631
632 if (modifiedDate != null) {
633 accountCacheModel.modifiedDate = modifiedDate.getTime();
634 }
635 else {
636 accountCacheModel.modifiedDate = Long.MIN_VALUE;
637 }
638
639 accountCacheModel.parentAccountId = getParentAccountId();
640
641 accountCacheModel.name = getName();
642
643 String name = accountCacheModel.name;
644
645 if ((name != null) && (name.length() == 0)) {
646 accountCacheModel.name = null;
647 }
648
649 accountCacheModel.legalName = getLegalName();
650
651 String legalName = accountCacheModel.legalName;
652
653 if ((legalName != null) && (legalName.length() == 0)) {
654 accountCacheModel.legalName = null;
655 }
656
657 accountCacheModel.legalId = getLegalId();
658
659 String legalId = accountCacheModel.legalId;
660
661 if ((legalId != null) && (legalId.length() == 0)) {
662 accountCacheModel.legalId = null;
663 }
664
665 accountCacheModel.legalType = getLegalType();
666
667 String legalType = accountCacheModel.legalType;
668
669 if ((legalType != null) && (legalType.length() == 0)) {
670 accountCacheModel.legalType = null;
671 }
672
673 accountCacheModel.sicCode = getSicCode();
674
675 String sicCode = accountCacheModel.sicCode;
676
677 if ((sicCode != null) && (sicCode.length() == 0)) {
678 accountCacheModel.sicCode = null;
679 }
680
681 accountCacheModel.tickerSymbol = getTickerSymbol();
682
683 String tickerSymbol = accountCacheModel.tickerSymbol;
684
685 if ((tickerSymbol != null) && (tickerSymbol.length() == 0)) {
686 accountCacheModel.tickerSymbol = null;
687 }
688
689 accountCacheModel.industry = getIndustry();
690
691 String industry = accountCacheModel.industry;
692
693 if ((industry != null) && (industry.length() == 0)) {
694 accountCacheModel.industry = null;
695 }
696
697 accountCacheModel.type = getType();
698
699 String type = accountCacheModel.type;
700
701 if ((type != null) && (type.length() == 0)) {
702 accountCacheModel.type = null;
703 }
704
705 accountCacheModel.size = getSize();
706
707 String size = accountCacheModel.size;
708
709 if ((size != null) && (size.length() == 0)) {
710 accountCacheModel.size = null;
711 }
712
713 return accountCacheModel;
714 }
715
716 @Override
717 public String toString() {
718 StringBundler sb = new StringBundler(33);
719
720 sb.append("{accountId=");
721 sb.append(getAccountId());
722 sb.append(", companyId=");
723 sb.append(getCompanyId());
724 sb.append(", userId=");
725 sb.append(getUserId());
726 sb.append(", userName=");
727 sb.append(getUserName());
728 sb.append(", createDate=");
729 sb.append(getCreateDate());
730 sb.append(", modifiedDate=");
731 sb.append(getModifiedDate());
732 sb.append(", parentAccountId=");
733 sb.append(getParentAccountId());
734 sb.append(", name=");
735 sb.append(getName());
736 sb.append(", legalName=");
737 sb.append(getLegalName());
738 sb.append(", legalId=");
739 sb.append(getLegalId());
740 sb.append(", legalType=");
741 sb.append(getLegalType());
742 sb.append(", sicCode=");
743 sb.append(getSicCode());
744 sb.append(", tickerSymbol=");
745 sb.append(getTickerSymbol());
746 sb.append(", industry=");
747 sb.append(getIndustry());
748 sb.append(", type=");
749 sb.append(getType());
750 sb.append(", size=");
751 sb.append(getSize());
752 sb.append("}");
753
754 return sb.toString();
755 }
756
757 public String toXmlString() {
758 StringBundler sb = new StringBundler(52);
759
760 sb.append("<model><model-name>");
761 sb.append("com.liferay.portal.model.Account");
762 sb.append("</model-name>");
763
764 sb.append(
765 "<column><column-name>accountId</column-name><column-value><![CDATA[");
766 sb.append(getAccountId());
767 sb.append("]]></column-value></column>");
768 sb.append(
769 "<column><column-name>companyId</column-name><column-value><![CDATA[");
770 sb.append(getCompanyId());
771 sb.append("]]></column-value></column>");
772 sb.append(
773 "<column><column-name>userId</column-name><column-value><![CDATA[");
774 sb.append(getUserId());
775 sb.append("]]></column-value></column>");
776 sb.append(
777 "<column><column-name>userName</column-name><column-value><![CDATA[");
778 sb.append(getUserName());
779 sb.append("]]></column-value></column>");
780 sb.append(
781 "<column><column-name>createDate</column-name><column-value><![CDATA[");
782 sb.append(getCreateDate());
783 sb.append("]]></column-value></column>");
784 sb.append(
785 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
786 sb.append(getModifiedDate());
787 sb.append("]]></column-value></column>");
788 sb.append(
789 "<column><column-name>parentAccountId</column-name><column-value><![CDATA[");
790 sb.append(getParentAccountId());
791 sb.append("]]></column-value></column>");
792 sb.append(
793 "<column><column-name>name</column-name><column-value><![CDATA[");
794 sb.append(getName());
795 sb.append("]]></column-value></column>");
796 sb.append(
797 "<column><column-name>legalName</column-name><column-value><![CDATA[");
798 sb.append(getLegalName());
799 sb.append("]]></column-value></column>");
800 sb.append(
801 "<column><column-name>legalId</column-name><column-value><![CDATA[");
802 sb.append(getLegalId());
803 sb.append("]]></column-value></column>");
804 sb.append(
805 "<column><column-name>legalType</column-name><column-value><![CDATA[");
806 sb.append(getLegalType());
807 sb.append("]]></column-value></column>");
808 sb.append(
809 "<column><column-name>sicCode</column-name><column-value><![CDATA[");
810 sb.append(getSicCode());
811 sb.append("]]></column-value></column>");
812 sb.append(
813 "<column><column-name>tickerSymbol</column-name><column-value><![CDATA[");
814 sb.append(getTickerSymbol());
815 sb.append("]]></column-value></column>");
816 sb.append(
817 "<column><column-name>industry</column-name><column-value><![CDATA[");
818 sb.append(getIndustry());
819 sb.append("]]></column-value></column>");
820 sb.append(
821 "<column><column-name>type</column-name><column-value><![CDATA[");
822 sb.append(getType());
823 sb.append("]]></column-value></column>");
824 sb.append(
825 "<column><column-name>size</column-name><column-value><![CDATA[");
826 sb.append(getSize());
827 sb.append("]]></column-value></column>");
828
829 sb.append("</model>");
830
831 return sb.toString();
832 }
833
834 private static ClassLoader _classLoader = Account.class.getClassLoader();
835 private static Class<?>[] _escapedModelInterfaces = new Class[] {
836 Account.class
837 };
838 private long _accountId;
839 private long _companyId;
840 private long _userId;
841 private String _userUuid;
842 private String _userName;
843 private Date _createDate;
844 private Date _modifiedDate;
845 private long _parentAccountId;
846 private String _name;
847 private String _legalName;
848 private String _legalId;
849 private String _legalType;
850 private String _sicCode;
851 private String _tickerSymbol;
852 private String _industry;
853 private String _type;
854 private String _size;
855 private Account _escapedModel;
856 }