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