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