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