1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
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.model.Contact;
28  import com.liferay.portal.util.PropsUtil;
29  
30  import com.liferay.util.Html;
31  
32  import java.io.Serializable;
33  
34  import java.lang.reflect.Proxy;
35  
36  import java.sql.Types;
37  
38  import java.util.Date;
39  
40  /**
41   * <a href="ContactModelImpl.java.html"><b><i>View Source</i></b></a>
42   *
43   * <p>
44   * ServiceBuilder generated this class. Modifications in this class will be
45   * overwritten the next time is generated.
46   * </p>
47   *
48   * <p>
49   * This class is a model that represents the <code>Contact</code> table
50   * in the database.
51   * </p>
52   *
53   * @author Brian Wing Shun Chan
54   *
55   * @see com.liferay.portal.service.model.Contact
56   * @see com.liferay.portal.service.model.ContactModel
57   * @see com.liferay.portal.service.model.impl.ContactImpl
58   *
59   */
60  public class ContactModelImpl extends BaseModelImpl {
61      public static final String TABLE_NAME = "Contact_";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "contactId", new Integer(Types.BIGINT) },
64              
65  
66              { "companyId", new Integer(Types.BIGINT) },
67              
68  
69              { "userId", new Integer(Types.BIGINT) },
70              
71  
72              { "userName", new Integer(Types.VARCHAR) },
73              
74  
75              { "createDate", new Integer(Types.TIMESTAMP) },
76              
77  
78              { "modifiedDate", new Integer(Types.TIMESTAMP) },
79              
80  
81              { "accountId", new Integer(Types.BIGINT) },
82              
83  
84              { "parentContactId", new Integer(Types.BIGINT) },
85              
86  
87              { "firstName", new Integer(Types.VARCHAR) },
88              
89  
90              { "middleName", new Integer(Types.VARCHAR) },
91              
92  
93              { "lastName", new Integer(Types.VARCHAR) },
94              
95  
96              { "prefixId", new Integer(Types.INTEGER) },
97              
98  
99              { "suffixId", new Integer(Types.INTEGER) },
100             
101 
102             { "male", new Integer(Types.BOOLEAN) },
103             
104 
105             { "birthday", new Integer(Types.TIMESTAMP) },
106             
107 
108             { "smsSn", new Integer(Types.VARCHAR) },
109             
110 
111             { "aimSn", new Integer(Types.VARCHAR) },
112             
113 
114             { "icqSn", new Integer(Types.VARCHAR) },
115             
116 
117             { "jabberSn", new Integer(Types.VARCHAR) },
118             
119 
120             { "msnSn", new Integer(Types.VARCHAR) },
121             
122 
123             { "skypeSn", new Integer(Types.VARCHAR) },
124             
125 
126             { "ymSn", new Integer(Types.VARCHAR) },
127             
128 
129             { "employeeStatusId", new Integer(Types.VARCHAR) },
130             
131 
132             { "employeeNumber", new Integer(Types.VARCHAR) },
133             
134 
135             { "jobTitle", new Integer(Types.VARCHAR) },
136             
137 
138             { "jobClass", new Integer(Types.VARCHAR) },
139             
140 
141             { "hoursOfOperation", new Integer(Types.VARCHAR) }
142         };
143     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)";
144     public static final String TABLE_SQL_DROP = "drop table Contact_";
145     public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
146                 "value.object.finder.cache.enabled.com.liferay.portal.model.Contact"),
147             true);
148     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
149                 "lock.expiration.time.com.liferay.portal.model.Contact"));
150 
151     public ContactModelImpl() {
152     }
153 
154     public long getPrimaryKey() {
155         return _contactId;
156     }
157 
158     public void setPrimaryKey(long pk) {
159         setContactId(pk);
160     }
161 
162     public Serializable getPrimaryKeyObj() {
163         return new Long(_contactId);
164     }
165 
166     public long getContactId() {
167         return _contactId;
168     }
169 
170     public void setContactId(long contactId) {
171         if (contactId != _contactId) {
172             _contactId = contactId;
173         }
174     }
175 
176     public long getCompanyId() {
177         return _companyId;
178     }
179 
180     public void setCompanyId(long companyId) {
181         if (companyId != _companyId) {
182             _companyId = companyId;
183         }
184     }
185 
186     public long getUserId() {
187         return _userId;
188     }
189 
190     public void setUserId(long userId) {
191         if (userId != _userId) {
192             _userId = userId;
193         }
194     }
195 
196     public String getUserName() {
197         return GetterUtil.getString(_userName);
198     }
199 
200     public void setUserName(String userName) {
201         if (((userName == null) && (_userName != null)) ||
202                 ((userName != null) && (_userName == null)) ||
203                 ((userName != null) && (_userName != null) &&
204                 !userName.equals(_userName))) {
205             _userName = userName;
206         }
207     }
208 
209     public Date getCreateDate() {
210         return _createDate;
211     }
212 
213     public void setCreateDate(Date createDate) {
214         if (((createDate == null) && (_createDate != null)) ||
215                 ((createDate != null) && (_createDate == null)) ||
216                 ((createDate != null) && (_createDate != null) &&
217                 !createDate.equals(_createDate))) {
218             _createDate = createDate;
219         }
220     }
221 
222     public Date getModifiedDate() {
223         return _modifiedDate;
224     }
225 
226     public void setModifiedDate(Date modifiedDate) {
227         if (((modifiedDate == null) && (_modifiedDate != null)) ||
228                 ((modifiedDate != null) && (_modifiedDate == null)) ||
229                 ((modifiedDate != null) && (_modifiedDate != null) &&
230                 !modifiedDate.equals(_modifiedDate))) {
231             _modifiedDate = modifiedDate;
232         }
233     }
234 
235     public long getAccountId() {
236         return _accountId;
237     }
238 
239     public void setAccountId(long accountId) {
240         if (accountId != _accountId) {
241             _accountId = accountId;
242         }
243     }
244 
245     public long getParentContactId() {
246         return _parentContactId;
247     }
248 
249     public void setParentContactId(long parentContactId) {
250         if (parentContactId != _parentContactId) {
251             _parentContactId = parentContactId;
252         }
253     }
254 
255     public String getFirstName() {
256         return GetterUtil.getString(_firstName);
257     }
258 
259     public void setFirstName(String firstName) {
260         if (((firstName == null) && (_firstName != null)) ||
261                 ((firstName != null) && (_firstName == null)) ||
262                 ((firstName != null) && (_firstName != null) &&
263                 !firstName.equals(_firstName))) {
264             _firstName = firstName;
265         }
266     }
267 
268     public String getMiddleName() {
269         return GetterUtil.getString(_middleName);
270     }
271 
272     public void setMiddleName(String middleName) {
273         if (((middleName == null) && (_middleName != null)) ||
274                 ((middleName != null) && (_middleName == null)) ||
275                 ((middleName != null) && (_middleName != null) &&
276                 !middleName.equals(_middleName))) {
277             _middleName = middleName;
278         }
279     }
280 
281     public String getLastName() {
282         return GetterUtil.getString(_lastName);
283     }
284 
285     public void setLastName(String lastName) {
286         if (((lastName == null) && (_lastName != null)) ||
287                 ((lastName != null) && (_lastName == null)) ||
288                 ((lastName != null) && (_lastName != null) &&
289                 !lastName.equals(_lastName))) {
290             _lastName = lastName;
291         }
292     }
293 
294     public int getPrefixId() {
295         return _prefixId;
296     }
297 
298     public void setPrefixId(int prefixId) {
299         if (prefixId != _prefixId) {
300             _prefixId = prefixId;
301         }
302     }
303 
304     public int getSuffixId() {
305         return _suffixId;
306     }
307 
308     public void setSuffixId(int suffixId) {
309         if (suffixId != _suffixId) {
310             _suffixId = suffixId;
311         }
312     }
313 
314     public boolean getMale() {
315         return _male;
316     }
317 
318     public boolean isMale() {
319         return _male;
320     }
321 
322     public void setMale(boolean male) {
323         if (male != _male) {
324             _male = male;
325         }
326     }
327 
328     public Date getBirthday() {
329         return _birthday;
330     }
331 
332     public void setBirthday(Date birthday) {
333         if (((birthday == null) && (_birthday != null)) ||
334                 ((birthday != null) && (_birthday == null)) ||
335                 ((birthday != null) && (_birthday != null) &&
336                 !birthday.equals(_birthday))) {
337             _birthday = birthday;
338         }
339     }
340 
341     public String getSmsSn() {
342         return GetterUtil.getString(_smsSn);
343     }
344 
345     public void setSmsSn(String smsSn) {
346         if (((smsSn == null) && (_smsSn != null)) ||
347                 ((smsSn != null) && (_smsSn == null)) ||
348                 ((smsSn != null) && (_smsSn != null) && !smsSn.equals(_smsSn))) {
349             _smsSn = smsSn;
350         }
351     }
352 
353     public String getAimSn() {
354         return GetterUtil.getString(_aimSn);
355     }
356 
357     public void setAimSn(String aimSn) {
358         if (((aimSn == null) && (_aimSn != null)) ||
359                 ((aimSn != null) && (_aimSn == null)) ||
360                 ((aimSn != null) && (_aimSn != null) && !aimSn.equals(_aimSn))) {
361             _aimSn = aimSn;
362         }
363     }
364 
365     public String getIcqSn() {
366         return GetterUtil.getString(_icqSn);
367     }
368 
369     public void setIcqSn(String icqSn) {
370         if (((icqSn == null) && (_icqSn != null)) ||
371                 ((icqSn != null) && (_icqSn == null)) ||
372                 ((icqSn != null) && (_icqSn != null) && !icqSn.equals(_icqSn))) {
373             _icqSn = icqSn;
374         }
375     }
376 
377     public String getJabberSn() {
378         return GetterUtil.getString(_jabberSn);
379     }
380 
381     public void setJabberSn(String jabberSn) {
382         if (((jabberSn == null) && (_jabberSn != null)) ||
383                 ((jabberSn != null) && (_jabberSn == null)) ||
384                 ((jabberSn != null) && (_jabberSn != null) &&
385                 !jabberSn.equals(_jabberSn))) {
386             _jabberSn = jabberSn;
387         }
388     }
389 
390     public String getMsnSn() {
391         return GetterUtil.getString(_msnSn);
392     }
393 
394     public void setMsnSn(String msnSn) {
395         if (((msnSn == null) && (_msnSn != null)) ||
396                 ((msnSn != null) && (_msnSn == null)) ||
397                 ((msnSn != null) && (_msnSn != null) && !msnSn.equals(_msnSn))) {
398             _msnSn = msnSn;
399         }
400     }
401 
402     public String getSkypeSn() {
403         return GetterUtil.getString(_skypeSn);
404     }
405 
406     public void setSkypeSn(String skypeSn) {
407         if (((skypeSn == null) && (_skypeSn != null)) ||
408                 ((skypeSn != null) && (_skypeSn == null)) ||
409                 ((skypeSn != null) && (_skypeSn != null) &&
410                 !skypeSn.equals(_skypeSn))) {
411             _skypeSn = skypeSn;
412         }
413     }
414 
415     public String getYmSn() {
416         return GetterUtil.getString(_ymSn);
417     }
418 
419     public void setYmSn(String ymSn) {
420         if (((ymSn == null) && (_ymSn != null)) ||
421                 ((ymSn != null) && (_ymSn == null)) ||
422                 ((ymSn != null) && (_ymSn != null) && !ymSn.equals(_ymSn))) {
423             _ymSn = ymSn;
424         }
425     }
426 
427     public String getEmployeeStatusId() {
428         return GetterUtil.getString(_employeeStatusId);
429     }
430 
431     public void setEmployeeStatusId(String employeeStatusId) {
432         if (((employeeStatusId == null) && (_employeeStatusId != null)) ||
433                 ((employeeStatusId != null) && (_employeeStatusId == null)) ||
434                 ((employeeStatusId != null) && (_employeeStatusId != null) &&
435                 !employeeStatusId.equals(_employeeStatusId))) {
436             _employeeStatusId = employeeStatusId;
437         }
438     }
439 
440     public String getEmployeeNumber() {
441         return GetterUtil.getString(_employeeNumber);
442     }
443 
444     public void setEmployeeNumber(String employeeNumber) {
445         if (((employeeNumber == null) && (_employeeNumber != null)) ||
446                 ((employeeNumber != null) && (_employeeNumber == null)) ||
447                 ((employeeNumber != null) && (_employeeNumber != null) &&
448                 !employeeNumber.equals(_employeeNumber))) {
449             _employeeNumber = employeeNumber;
450         }
451     }
452 
453     public String getJobTitle() {
454         return GetterUtil.getString(_jobTitle);
455     }
456 
457     public void setJobTitle(String jobTitle) {
458         if (((jobTitle == null) && (_jobTitle != null)) ||
459                 ((jobTitle != null) && (_jobTitle == null)) ||
460                 ((jobTitle != null) && (_jobTitle != null) &&
461                 !jobTitle.equals(_jobTitle))) {
462             _jobTitle = jobTitle;
463         }
464     }
465 
466     public String getJobClass() {
467         return GetterUtil.getString(_jobClass);
468     }
469 
470     public void setJobClass(String jobClass) {
471         if (((jobClass == null) && (_jobClass != null)) ||
472                 ((jobClass != null) && (_jobClass == null)) ||
473                 ((jobClass != null) && (_jobClass != null) &&
474                 !jobClass.equals(_jobClass))) {
475             _jobClass = jobClass;
476         }
477     }
478 
479     public String getHoursOfOperation() {
480         return GetterUtil.getString(_hoursOfOperation);
481     }
482 
483     public void setHoursOfOperation(String hoursOfOperation) {
484         if (((hoursOfOperation == null) && (_hoursOfOperation != null)) ||
485                 ((hoursOfOperation != null) && (_hoursOfOperation == null)) ||
486                 ((hoursOfOperation != null) && (_hoursOfOperation != null) &&
487                 !hoursOfOperation.equals(_hoursOfOperation))) {
488             _hoursOfOperation = hoursOfOperation;
489         }
490     }
491 
492     public Contact toEscapedModel() {
493         if (isEscapedModel()) {
494             return (Contact)this;
495         }
496         else {
497             Contact model = new ContactImpl();
498 
499             model.setEscapedModel(true);
500 
501             model.setContactId(getContactId());
502             model.setCompanyId(getCompanyId());
503             model.setUserId(getUserId());
504             model.setUserName(Html.escape(getUserName()));
505             model.setCreateDate(getCreateDate());
506             model.setModifiedDate(getModifiedDate());
507             model.setAccountId(getAccountId());
508             model.setParentContactId(getParentContactId());
509             model.setFirstName(Html.escape(getFirstName()));
510             model.setMiddleName(Html.escape(getMiddleName()));
511             model.setLastName(Html.escape(getLastName()));
512             model.setPrefixId(getPrefixId());
513             model.setSuffixId(getSuffixId());
514             model.setMale(getMale());
515             model.setBirthday(getBirthday());
516             model.setSmsSn(Html.escape(getSmsSn()));
517             model.setAimSn(Html.escape(getAimSn()));
518             model.setIcqSn(Html.escape(getIcqSn()));
519             model.setJabberSn(Html.escape(getJabberSn()));
520             model.setMsnSn(Html.escape(getMsnSn()));
521             model.setSkypeSn(Html.escape(getSkypeSn()));
522             model.setYmSn(Html.escape(getYmSn()));
523             model.setEmployeeStatusId(Html.escape(getEmployeeStatusId()));
524             model.setEmployeeNumber(Html.escape(getEmployeeNumber()));
525             model.setJobTitle(Html.escape(getJobTitle()));
526             model.setJobClass(Html.escape(getJobClass()));
527             model.setHoursOfOperation(Html.escape(getHoursOfOperation()));
528 
529             model = (Contact)Proxy.newProxyInstance(Contact.class.getClassLoader(),
530                     new Class[] { Contact.class },
531                     new ReadOnlyBeanHandler(model));
532 
533             return model;
534         }
535     }
536 
537     public Object clone() {
538         ContactImpl clone = new ContactImpl();
539 
540         clone.setContactId(getContactId());
541         clone.setCompanyId(getCompanyId());
542         clone.setUserId(getUserId());
543         clone.setUserName(getUserName());
544         clone.setCreateDate(getCreateDate());
545         clone.setModifiedDate(getModifiedDate());
546         clone.setAccountId(getAccountId());
547         clone.setParentContactId(getParentContactId());
548         clone.setFirstName(getFirstName());
549         clone.setMiddleName(getMiddleName());
550         clone.setLastName(getLastName());
551         clone.setPrefixId(getPrefixId());
552         clone.setSuffixId(getSuffixId());
553         clone.setMale(getMale());
554         clone.setBirthday(getBirthday());
555         clone.setSmsSn(getSmsSn());
556         clone.setAimSn(getAimSn());
557         clone.setIcqSn(getIcqSn());
558         clone.setJabberSn(getJabberSn());
559         clone.setMsnSn(getMsnSn());
560         clone.setSkypeSn(getSkypeSn());
561         clone.setYmSn(getYmSn());
562         clone.setEmployeeStatusId(getEmployeeStatusId());
563         clone.setEmployeeNumber(getEmployeeNumber());
564         clone.setJobTitle(getJobTitle());
565         clone.setJobClass(getJobClass());
566         clone.setHoursOfOperation(getHoursOfOperation());
567 
568         return clone;
569     }
570 
571     public int compareTo(Object obj) {
572         if (obj == null) {
573             return -1;
574         }
575 
576         ContactImpl contact = (ContactImpl)obj;
577 
578         long pk = contact.getPrimaryKey();
579 
580         if (getPrimaryKey() < pk) {
581             return -1;
582         }
583         else if (getPrimaryKey() > pk) {
584             return 1;
585         }
586         else {
587             return 0;
588         }
589     }
590 
591     public boolean equals(Object obj) {
592         if (obj == null) {
593             return false;
594         }
595 
596         ContactImpl contact = null;
597 
598         try {
599             contact = (ContactImpl)obj;
600         }
601         catch (ClassCastException cce) {
602             return false;
603         }
604 
605         long pk = contact.getPrimaryKey();
606 
607         if (getPrimaryKey() == pk) {
608             return true;
609         }
610         else {
611             return false;
612         }
613     }
614 
615     public int hashCode() {
616         return (int)getPrimaryKey();
617     }
618 
619     private long _contactId;
620     private long _companyId;
621     private long _userId;
622     private String _userName;
623     private Date _createDate;
624     private Date _modifiedDate;
625     private long _accountId;
626     private long _parentContactId;
627     private String _firstName;
628     private String _middleName;
629     private String _lastName;
630     private int _prefixId;
631     private int _suffixId;
632     private boolean _male;
633     private Date _birthday;
634     private String _smsSn;
635     private String _aimSn;
636     private String _icqSn;
637     private String _jabberSn;
638     private String _msnSn;
639     private String _skypeSn;
640     private String _ymSn;
641     private String _employeeStatusId;
642     private String _employeeNumber;
643     private String _jobTitle;
644     private String _jobClass;
645     private String _hoursOfOperation;
646 }