1
22
23 package com.liferay.portal.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.kernel.util.HtmlUtil;
28 import com.liferay.portal.model.Contact;
29 import com.liferay.portal.model.ContactSoap;
30
31 import com.liferay.portlet.expando.model.ExpandoBridge;
32 import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
33
34 import java.io.Serializable;
35
36 import java.lang.reflect.Proxy;
37
38 import java.sql.Types;
39
40 import java.util.ArrayList;
41 import java.util.Date;
42 import java.util.List;
43
44
64 public class ContactModelImpl extends BaseModelImpl {
65 public static final String TABLE_NAME = "Contact_";
66 public static final Object[][] TABLE_COLUMNS = {
67 { "contactId", new Integer(Types.BIGINT) },
68
69
70 { "companyId", new Integer(Types.BIGINT) },
71
72
73 { "userId", new Integer(Types.BIGINT) },
74
75
76 { "userName", new Integer(Types.VARCHAR) },
77
78
79 { "createDate", new Integer(Types.TIMESTAMP) },
80
81
82 { "modifiedDate", new Integer(Types.TIMESTAMP) },
83
84
85 { "accountId", new Integer(Types.BIGINT) },
86
87
88 { "parentContactId", new Integer(Types.BIGINT) },
89
90
91 { "firstName", new Integer(Types.VARCHAR) },
92
93
94 { "middleName", new Integer(Types.VARCHAR) },
95
96
97 { "lastName", new Integer(Types.VARCHAR) },
98
99
100 { "prefixId", new Integer(Types.INTEGER) },
101
102
103 { "suffixId", new Integer(Types.INTEGER) },
104
105
106 { "male", new Integer(Types.BOOLEAN) },
107
108
109 { "birthday", new Integer(Types.TIMESTAMP) },
110
111
112 { "smsSn", new Integer(Types.VARCHAR) },
113
114
115 { "aimSn", new Integer(Types.VARCHAR) },
116
117
118 { "facebookSn", new Integer(Types.VARCHAR) },
119
120
121 { "icqSn", new Integer(Types.VARCHAR) },
122
123
124 { "jabberSn", new Integer(Types.VARCHAR) },
125
126
127 { "msnSn", new Integer(Types.VARCHAR) },
128
129
130 { "mySpaceSn", new Integer(Types.VARCHAR) },
131
132
133 { "skypeSn", new Integer(Types.VARCHAR) },
134
135
136 { "twitterSn", new Integer(Types.VARCHAR) },
137
138
139 { "ymSn", new Integer(Types.VARCHAR) },
140
141
142 { "employeeStatusId", new Integer(Types.VARCHAR) },
143
144
145 { "employeeNumber", new Integer(Types.VARCHAR) },
146
147
148 { "jobTitle", new Integer(Types.VARCHAR) },
149
150
151 { "jobClass", new Integer(Types.VARCHAR) },
152
153
154 { "hoursOfOperation", new Integer(Types.VARCHAR) }
155 };
156 public static final String TABLE_SQL_CREATE = "create table Contact_ (contactId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,accountId LONG,parentContactId LONG,firstName VARCHAR(75) null,middleName VARCHAR(75) null,lastName VARCHAR(75) null,prefixId INTEGER,suffixId INTEGER,male BOOLEAN,birthday DATE null,smsSn VARCHAR(75) null,aimSn VARCHAR(75) null,facebookSn VARCHAR(75) null,icqSn VARCHAR(75) null,jabberSn VARCHAR(75) null,msnSn VARCHAR(75) null,mySpaceSn VARCHAR(75) null,skypeSn VARCHAR(75) null,twitterSn VARCHAR(75) null,ymSn VARCHAR(75) null,employeeStatusId VARCHAR(75) null,employeeNumber VARCHAR(75) null,jobTitle VARCHAR(100) null,jobClass VARCHAR(75) null,hoursOfOperation VARCHAR(75) null)";
157 public static final String TABLE_SQL_DROP = "drop table Contact_";
158 public static final String DATA_SOURCE = "liferayDataSource";
159 public static final String SESSION_FACTORY = "liferaySessionFactory";
160 public static final String TX_MANAGER = "liferayTransactionManager";
161 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
162 "value.object.finder.cache.enabled.com.liferay.portal.model.Contact"),
163 true);
164
165 public static Contact toModel(ContactSoap soapModel) {
166 Contact model = new ContactImpl();
167
168 model.setContactId(soapModel.getContactId());
169 model.setCompanyId(soapModel.getCompanyId());
170 model.setUserId(soapModel.getUserId());
171 model.setUserName(soapModel.getUserName());
172 model.setCreateDate(soapModel.getCreateDate());
173 model.setModifiedDate(soapModel.getModifiedDate());
174 model.setAccountId(soapModel.getAccountId());
175 model.setParentContactId(soapModel.getParentContactId());
176 model.setFirstName(soapModel.getFirstName());
177 model.setMiddleName(soapModel.getMiddleName());
178 model.setLastName(soapModel.getLastName());
179 model.setPrefixId(soapModel.getPrefixId());
180 model.setSuffixId(soapModel.getSuffixId());
181 model.setMale(soapModel.getMale());
182 model.setBirthday(soapModel.getBirthday());
183 model.setSmsSn(soapModel.getSmsSn());
184 model.setAimSn(soapModel.getAimSn());
185 model.setFacebookSn(soapModel.getFacebookSn());
186 model.setIcqSn(soapModel.getIcqSn());
187 model.setJabberSn(soapModel.getJabberSn());
188 model.setMsnSn(soapModel.getMsnSn());
189 model.setMySpaceSn(soapModel.getMySpaceSn());
190 model.setSkypeSn(soapModel.getSkypeSn());
191 model.setTwitterSn(soapModel.getTwitterSn());
192 model.setYmSn(soapModel.getYmSn());
193 model.setEmployeeStatusId(soapModel.getEmployeeStatusId());
194 model.setEmployeeNumber(soapModel.getEmployeeNumber());
195 model.setJobTitle(soapModel.getJobTitle());
196 model.setJobClass(soapModel.getJobClass());
197 model.setHoursOfOperation(soapModel.getHoursOfOperation());
198
199 return model;
200 }
201
202 public static List<Contact> toModels(ContactSoap[] soapModels) {
203 List<Contact> models = new ArrayList<Contact>(soapModels.length);
204
205 for (ContactSoap soapModel : soapModels) {
206 models.add(toModel(soapModel));
207 }
208
209 return models;
210 }
211
212 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
213 "lock.expiration.time.com.liferay.portal.model.Contact"));
214
215 public ContactModelImpl() {
216 }
217
218 public long getPrimaryKey() {
219 return _contactId;
220 }
221
222 public void setPrimaryKey(long pk) {
223 setContactId(pk);
224 }
225
226 public Serializable getPrimaryKeyObj() {
227 return new Long(_contactId);
228 }
229
230 public long getContactId() {
231 return _contactId;
232 }
233
234 public void setContactId(long contactId) {
235 if (contactId != _contactId) {
236 _contactId = contactId;
237 }
238 }
239
240 public long getCompanyId() {
241 return _companyId;
242 }
243
244 public void setCompanyId(long companyId) {
245 if (companyId != _companyId) {
246 _companyId = companyId;
247 }
248 }
249
250 public long getUserId() {
251 return _userId;
252 }
253
254 public void setUserId(long userId) {
255 if (userId != _userId) {
256 _userId = userId;
257 }
258 }
259
260 public String getUserName() {
261 return GetterUtil.getString(_userName);
262 }
263
264 public void setUserName(String userName) {
265 if (((userName == null) && (_userName != null)) ||
266 ((userName != null) && (_userName == null)) ||
267 ((userName != null) && (_userName != null) &&
268 !userName.equals(_userName))) {
269 _userName = userName;
270 }
271 }
272
273 public Date getCreateDate() {
274 return _createDate;
275 }
276
277 public void setCreateDate(Date createDate) {
278 if (((createDate == null) && (_createDate != null)) ||
279 ((createDate != null) && (_createDate == null)) ||
280 ((createDate != null) && (_createDate != null) &&
281 !createDate.equals(_createDate))) {
282 _createDate = createDate;
283 }
284 }
285
286 public Date getModifiedDate() {
287 return _modifiedDate;
288 }
289
290 public void setModifiedDate(Date modifiedDate) {
291 if (((modifiedDate == null) && (_modifiedDate != null)) ||
292 ((modifiedDate != null) && (_modifiedDate == null)) ||
293 ((modifiedDate != null) && (_modifiedDate != null) &&
294 !modifiedDate.equals(_modifiedDate))) {
295 _modifiedDate = modifiedDate;
296 }
297 }
298
299 public long getAccountId() {
300 return _accountId;
301 }
302
303 public void setAccountId(long accountId) {
304 if (accountId != _accountId) {
305 _accountId = accountId;
306 }
307 }
308
309 public long getParentContactId() {
310 return _parentContactId;
311 }
312
313 public void setParentContactId(long parentContactId) {
314 if (parentContactId != _parentContactId) {
315 _parentContactId = parentContactId;
316 }
317 }
318
319 public String getFirstName() {
320 return GetterUtil.getString(_firstName);
321 }
322
323 public void setFirstName(String firstName) {
324 if (((firstName == null) && (_firstName != null)) ||
325 ((firstName != null) && (_firstName == null)) ||
326 ((firstName != null) && (_firstName != null) &&
327 !firstName.equals(_firstName))) {
328 _firstName = firstName;
329 }
330 }
331
332 public String getMiddleName() {
333 return GetterUtil.getString(_middleName);
334 }
335
336 public void setMiddleName(String middleName) {
337 if (((middleName == null) && (_middleName != null)) ||
338 ((middleName != null) && (_middleName == null)) ||
339 ((middleName != null) && (_middleName != null) &&
340 !middleName.equals(_middleName))) {
341 _middleName = middleName;
342 }
343 }
344
345 public String getLastName() {
346 return GetterUtil.getString(_lastName);
347 }
348
349 public void setLastName(String lastName) {
350 if (((lastName == null) && (_lastName != null)) ||
351 ((lastName != null) && (_lastName == null)) ||
352 ((lastName != null) && (_lastName != null) &&
353 !lastName.equals(_lastName))) {
354 _lastName = lastName;
355 }
356 }
357
358 public int getPrefixId() {
359 return _prefixId;
360 }
361
362 public void setPrefixId(int prefixId) {
363 if (prefixId != _prefixId) {
364 _prefixId = prefixId;
365 }
366 }
367
368 public int getSuffixId() {
369 return _suffixId;
370 }
371
372 public void setSuffixId(int suffixId) {
373 if (suffixId != _suffixId) {
374 _suffixId = suffixId;
375 }
376 }
377
378 public boolean getMale() {
379 return _male;
380 }
381
382 public boolean isMale() {
383 return _male;
384 }
385
386 public void setMale(boolean male) {
387 if (male != _male) {
388 _male = male;
389 }
390 }
391
392 public Date getBirthday() {
393 return _birthday;
394 }
395
396 public void setBirthday(Date birthday) {
397 if (((birthday == null) && (_birthday != null)) ||
398 ((birthday != null) && (_birthday == null)) ||
399 ((birthday != null) && (_birthday != null) &&
400 !birthday.equals(_birthday))) {
401 _birthday = birthday;
402 }
403 }
404
405 public String getSmsSn() {
406 return GetterUtil.getString(_smsSn);
407 }
408
409 public void setSmsSn(String smsSn) {
410 if (((smsSn == null) && (_smsSn != null)) ||
411 ((smsSn != null) && (_smsSn == null)) ||
412 ((smsSn != null) && (_smsSn != null) && !smsSn.equals(_smsSn))) {
413 _smsSn = smsSn;
414 }
415 }
416
417 public String getAimSn() {
418 return GetterUtil.getString(_aimSn);
419 }
420
421 public void setAimSn(String aimSn) {
422 if (((aimSn == null) && (_aimSn != null)) ||
423 ((aimSn != null) && (_aimSn == null)) ||
424 ((aimSn != null) && (_aimSn != null) && !aimSn.equals(_aimSn))) {
425 _aimSn = aimSn;
426 }
427 }
428
429 public String getFacebookSn() {
430 return GetterUtil.getString(_facebookSn);
431 }
432
433 public void setFacebookSn(String facebookSn) {
434 if (((facebookSn == null) && (_facebookSn != null)) ||
435 ((facebookSn != null) && (_facebookSn == null)) ||
436 ((facebookSn != null) && (_facebookSn != null) &&
437 !facebookSn.equals(_facebookSn))) {
438 _facebookSn = facebookSn;
439 }
440 }
441
442 public String getIcqSn() {
443 return GetterUtil.getString(_icqSn);
444 }
445
446 public void setIcqSn(String icqSn) {
447 if (((icqSn == null) && (_icqSn != null)) ||
448 ((icqSn != null) && (_icqSn == null)) ||
449 ((icqSn != null) && (_icqSn != null) && !icqSn.equals(_icqSn))) {
450 _icqSn = icqSn;
451 }
452 }
453
454 public String getJabberSn() {
455 return GetterUtil.getString(_jabberSn);
456 }
457
458 public void setJabberSn(String jabberSn) {
459 if (((jabberSn == null) && (_jabberSn != null)) ||
460 ((jabberSn != null) && (_jabberSn == null)) ||
461 ((jabberSn != null) && (_jabberSn != null) &&
462 !jabberSn.equals(_jabberSn))) {
463 _jabberSn = jabberSn;
464 }
465 }
466
467 public String getMsnSn() {
468 return GetterUtil.getString(_msnSn);
469 }
470
471 public void setMsnSn(String msnSn) {
472 if (((msnSn == null) && (_msnSn != null)) ||
473 ((msnSn != null) && (_msnSn == null)) ||
474 ((msnSn != null) && (_msnSn != null) && !msnSn.equals(_msnSn))) {
475 _msnSn = msnSn;
476 }
477 }
478
479 public String getMySpaceSn() {
480 return GetterUtil.getString(_mySpaceSn);
481 }
482
483 public void setMySpaceSn(String mySpaceSn) {
484 if (((mySpaceSn == null) && (_mySpaceSn != null)) ||
485 ((mySpaceSn != null) && (_mySpaceSn == null)) ||
486 ((mySpaceSn != null) && (_mySpaceSn != null) &&
487 !mySpaceSn.equals(_mySpaceSn))) {
488 _mySpaceSn = mySpaceSn;
489 }
490 }
491
492 public String getSkypeSn() {
493 return GetterUtil.getString(_skypeSn);
494 }
495
496 public void setSkypeSn(String skypeSn) {
497 if (((skypeSn == null) && (_skypeSn != null)) ||
498 ((skypeSn != null) && (_skypeSn == null)) ||
499 ((skypeSn != null) && (_skypeSn != null) &&
500 !skypeSn.equals(_skypeSn))) {
501 _skypeSn = skypeSn;
502 }
503 }
504
505 public String getTwitterSn() {
506 return GetterUtil.getString(_twitterSn);
507 }
508
509 public void setTwitterSn(String twitterSn) {
510 if (((twitterSn == null) && (_twitterSn != null)) ||
511 ((twitterSn != null) && (_twitterSn == null)) ||
512 ((twitterSn != null) && (_twitterSn != null) &&
513 !twitterSn.equals(_twitterSn))) {
514 _twitterSn = twitterSn;
515 }
516 }
517
518 public String getYmSn() {
519 return GetterUtil.getString(_ymSn);
520 }
521
522 public void setYmSn(String ymSn) {
523 if (((ymSn == null) && (_ymSn != null)) ||
524 ((ymSn != null) && (_ymSn == null)) ||
525 ((ymSn != null) && (_ymSn != null) && !ymSn.equals(_ymSn))) {
526 _ymSn = ymSn;
527 }
528 }
529
530 public String getEmployeeStatusId() {
531 return GetterUtil.getString(_employeeStatusId);
532 }
533
534 public void setEmployeeStatusId(String employeeStatusId) {
535 if (((employeeStatusId == null) && (_employeeStatusId != null)) ||
536 ((employeeStatusId != null) && (_employeeStatusId == null)) ||
537 ((employeeStatusId != null) && (_employeeStatusId != null) &&
538 !employeeStatusId.equals(_employeeStatusId))) {
539 _employeeStatusId = employeeStatusId;
540 }
541 }
542
543 public String getEmployeeNumber() {
544 return GetterUtil.getString(_employeeNumber);
545 }
546
547 public void setEmployeeNumber(String employeeNumber) {
548 if (((employeeNumber == null) && (_employeeNumber != null)) ||
549 ((employeeNumber != null) && (_employeeNumber == null)) ||
550 ((employeeNumber != null) && (_employeeNumber != null) &&
551 !employeeNumber.equals(_employeeNumber))) {
552 _employeeNumber = employeeNumber;
553 }
554 }
555
556 public String getJobTitle() {
557 return GetterUtil.getString(_jobTitle);
558 }
559
560 public void setJobTitle(String jobTitle) {
561 if (((jobTitle == null) && (_jobTitle != null)) ||
562 ((jobTitle != null) && (_jobTitle == null)) ||
563 ((jobTitle != null) && (_jobTitle != null) &&
564 !jobTitle.equals(_jobTitle))) {
565 _jobTitle = jobTitle;
566 }
567 }
568
569 public String getJobClass() {
570 return GetterUtil.getString(_jobClass);
571 }
572
573 public void setJobClass(String jobClass) {
574 if (((jobClass == null) && (_jobClass != null)) ||
575 ((jobClass != null) && (_jobClass == null)) ||
576 ((jobClass != null) && (_jobClass != null) &&
577 !jobClass.equals(_jobClass))) {
578 _jobClass = jobClass;
579 }
580 }
581
582 public String getHoursOfOperation() {
583 return GetterUtil.getString(_hoursOfOperation);
584 }
585
586 public void setHoursOfOperation(String hoursOfOperation) {
587 if (((hoursOfOperation == null) && (_hoursOfOperation != null)) ||
588 ((hoursOfOperation != null) && (_hoursOfOperation == null)) ||
589 ((hoursOfOperation != null) && (_hoursOfOperation != null) &&
590 !hoursOfOperation.equals(_hoursOfOperation))) {
591 _hoursOfOperation = hoursOfOperation;
592 }
593 }
594
595 public Contact toEscapedModel() {
596 if (isEscapedModel()) {
597 return (Contact)this;
598 }
599 else {
600 Contact model = new ContactImpl();
601
602 model.setNew(isNew());
603 model.setEscapedModel(true);
604
605 model.setContactId(getContactId());
606 model.setCompanyId(getCompanyId());
607 model.setUserId(getUserId());
608 model.setUserName(HtmlUtil.escape(getUserName()));
609 model.setCreateDate(getCreateDate());
610 model.setModifiedDate(getModifiedDate());
611 model.setAccountId(getAccountId());
612 model.setParentContactId(getParentContactId());
613 model.setFirstName(HtmlUtil.escape(getFirstName()));
614 model.setMiddleName(HtmlUtil.escape(getMiddleName()));
615 model.setLastName(HtmlUtil.escape(getLastName()));
616 model.setPrefixId(getPrefixId());
617 model.setSuffixId(getSuffixId());
618 model.setMale(getMale());
619 model.setBirthday(getBirthday());
620 model.setSmsSn(HtmlUtil.escape(getSmsSn()));
621 model.setAimSn(HtmlUtil.escape(getAimSn()));
622 model.setFacebookSn(HtmlUtil.escape(getFacebookSn()));
623 model.setIcqSn(HtmlUtil.escape(getIcqSn()));
624 model.setJabberSn(HtmlUtil.escape(getJabberSn()));
625 model.setMsnSn(HtmlUtil.escape(getMsnSn()));
626 model.setMySpaceSn(HtmlUtil.escape(getMySpaceSn()));
627 model.setSkypeSn(HtmlUtil.escape(getSkypeSn()));
628 model.setTwitterSn(HtmlUtil.escape(getTwitterSn()));
629 model.setYmSn(HtmlUtil.escape(getYmSn()));
630 model.setEmployeeStatusId(HtmlUtil.escape(getEmployeeStatusId()));
631 model.setEmployeeNumber(HtmlUtil.escape(getEmployeeNumber()));
632 model.setJobTitle(HtmlUtil.escape(getJobTitle()));
633 model.setJobClass(HtmlUtil.escape(getJobClass()));
634 model.setHoursOfOperation(HtmlUtil.escape(getHoursOfOperation()));
635
636 model = (Contact)Proxy.newProxyInstance(Contact.class.getClassLoader(),
637 new Class[] { Contact.class },
638 new ReadOnlyBeanHandler(model));
639
640 return model;
641 }
642 }
643
644 public ExpandoBridge getExpandoBridge() {
645 if (_expandoBridge == null) {
646 _expandoBridge = new ExpandoBridgeImpl(Contact.class.getName(),
647 getPrimaryKey());
648 }
649
650 return _expandoBridge;
651 }
652
653 public Object clone() {
654 ContactImpl clone = new ContactImpl();
655
656 clone.setContactId(getContactId());
657 clone.setCompanyId(getCompanyId());
658 clone.setUserId(getUserId());
659 clone.setUserName(getUserName());
660 clone.setCreateDate(getCreateDate());
661 clone.setModifiedDate(getModifiedDate());
662 clone.setAccountId(getAccountId());
663 clone.setParentContactId(getParentContactId());
664 clone.setFirstName(getFirstName());
665 clone.setMiddleName(getMiddleName());
666 clone.setLastName(getLastName());
667 clone.setPrefixId(getPrefixId());
668 clone.setSuffixId(getSuffixId());
669 clone.setMale(getMale());
670 clone.setBirthday(getBirthday());
671 clone.setSmsSn(getSmsSn());
672 clone.setAimSn(getAimSn());
673 clone.setFacebookSn(getFacebookSn());
674 clone.setIcqSn(getIcqSn());
675 clone.setJabberSn(getJabberSn());
676 clone.setMsnSn(getMsnSn());
677 clone.setMySpaceSn(getMySpaceSn());
678 clone.setSkypeSn(getSkypeSn());
679 clone.setTwitterSn(getTwitterSn());
680 clone.setYmSn(getYmSn());
681 clone.setEmployeeStatusId(getEmployeeStatusId());
682 clone.setEmployeeNumber(getEmployeeNumber());
683 clone.setJobTitle(getJobTitle());
684 clone.setJobClass(getJobClass());
685 clone.setHoursOfOperation(getHoursOfOperation());
686
687 return clone;
688 }
689
690 public int compareTo(Object obj) {
691 if (obj == null) {
692 return -1;
693 }
694
695 ContactImpl contact = (ContactImpl)obj;
696
697 long pk = contact.getPrimaryKey();
698
699 if (getPrimaryKey() < pk) {
700 return -1;
701 }
702 else if (getPrimaryKey() > pk) {
703 return 1;
704 }
705 else {
706 return 0;
707 }
708 }
709
710 public boolean equals(Object obj) {
711 if (obj == null) {
712 return false;
713 }
714
715 ContactImpl contact = null;
716
717 try {
718 contact = (ContactImpl)obj;
719 }
720 catch (ClassCastException cce) {
721 return false;
722 }
723
724 long pk = contact.getPrimaryKey();
725
726 if (getPrimaryKey() == pk) {
727 return true;
728 }
729 else {
730 return false;
731 }
732 }
733
734 public int hashCode() {
735 return (int)getPrimaryKey();
736 }
737
738 private long _contactId;
739 private long _companyId;
740 private long _userId;
741 private String _userName;
742 private Date _createDate;
743 private Date _modifiedDate;
744 private long _accountId;
745 private long _parentContactId;
746 private String _firstName;
747 private String _middleName;
748 private String _lastName;
749 private int _prefixId;
750 private int _suffixId;
751 private boolean _male;
752 private Date _birthday;
753 private String _smsSn;
754 private String _aimSn;
755 private String _facebookSn;
756 private String _icqSn;
757 private String _jabberSn;
758 private String _msnSn;
759 private String _mySpaceSn;
760 private String _skypeSn;
761 private String _twitterSn;
762 private String _ymSn;
763 private String _employeeStatusId;
764 private String _employeeNumber;
765 private String _jobTitle;
766 private String _jobClass;
767 private String _hoursOfOperation;
768 private transient ExpandoBridge _expandoBridge;
769 }