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