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