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