1 /***
2 Copyright (C) 2005 The Java Community
3
4 This program is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free Software
6 Foundation; either version 2 of the License, or (at your option) any later
7 version.
8
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 Place, Suite 330, Boston, MA 02111-1307 USA.
16 */
17 package org.bejug.javacareers.jobs.model;
18
19 import org.apache.commons.lang.builder.CompareToBuilder;
20 import org.apache.commons.lang.builder.EqualsBuilder;
21 import org.apache.commons.lang.builder.HashCodeBuilder;
22 import org.apache.commons.lang.builder.ToStringBuilder;
23
24 /***
25 *
26 * @author Sven Schauwvliege (Last modified by $Author: shally $)
27 * @version $Revision: 1.3 $ - $Date: 2005/12/20 15:36:45 $
28 */
29
30 public class Contact extends AbstractPersistableObject {
31
32 /***
33 * the mobile phone number.
34 */
35 private String mobile;
36 /***
37 * phone number.
38 */
39 private String phone;
40 /***
41 * the email of the user.
42 */
43 private String email;
44 /***
45 * thefax of the user.
46 */
47 private String fax;
48
49 /***
50 * @return Returns the email.
51 */
52 public String getEmail() {
53 return email;
54 }
55 /***
56 * @param email The email to set.
57 */
58 public void setEmail(String email) {
59 this.email = email;
60 }
61 /***
62 * @return Returns the mobile.
63 */
64 public String getMobile() {
65 return mobile;
66 }
67 /***
68 * @param mobile The mobile to set.
69 */
70 public void setMobile(String mobile) {
71 this.mobile = mobile;
72 }
73
74 /***
75 * @return Returns the phone.
76 */
77 public String getPhone() {
78 return phone;
79 }
80
81 /***
82 * @param phone The phone to set.
83 */
84 public void setPhone(String phone) {
85 this.phone = phone;
86 }
87
88 /***
89 * @return Returns the fax.
90 */
91 public String getFax() {
92 return fax;
93 }
94
95 /***
96 * @param fax The fax to set.
97 */
98 public void setFax(String fax) {
99 this.fax = fax;
100 }
101
102 /***
103 * {@inheritDoc}
104 */
105 public boolean equals(Object o) {
106 if (!(o instanceof Contact)) {
107 return false;
108 }
109 if (this == o) {
110 return true;
111 }
112 Contact contact = (Contact) o;
113 return new EqualsBuilder()
114 .appendSuper(super.equals(o))
115 .append(this.mobile, contact.getMobile())
116 .append(this.phone, contact.getPhone())
117 .append(this.email, contact.getEmail())
118 .append(this.fax, contact.getFax())
119 .isEquals();
120 }
121
122
123 /***
124 * {@inheritDoc}
125 */
126 public int hashCode() {
127 return new HashCodeBuilder(11, 99)
128 .append(this.mobile)
129 .append(this.phone)
130 .append(this.email)
131 .append(this.fax)
132 .toHashCode();
133 }
134
135
136 /***
137 * {@inheritDoc}
138 */
139 public int compareTo(Object o) {
140 Contact contact = (Contact) o;
141 return new CompareToBuilder()
142 .appendSuper(super.compareTo(contact))
143 .append(this.mobile, contact.getMobile())
144 .append(this.phone, contact.getPhone())
145 .append(this.email, contact.getEmail())
146 .append(this.fax, contact.getFax())
147 .toComparison();
148 }
149
150
151 /***
152 * {@inheritDoc}
153 */
154 public String toString() {
155 return new ToStringBuilder(this)
156 .appendSuper(super.toString())
157 .append("mobile", this.mobile)
158 .append("phone", this.phone)
159 .append("email", this.email)
160 .append("fax", this.fax)
161 .toString();
162 }
163 }
164
165 /***
166 * $Log: Contact.java,v $
167 * Revision 1.3 2005/12/20 15:36:45 shally
168 * CheckStyle and PMD changes.
169 *
170 * Revision 1.2 2005/08/31 12:15:09 bme_jcs
171 * refactoring and introduction of apache builders
172 *
173 * Revision 1.1 2005/08/26 07:58:26 ge0ffrey
174 * split up the sources in service, serviceimpl and webclient
175 *
176 * Revision 1.1 2005/07/05 15:13:11 schauwvliege
177 * added person/contact and location to model
178 *
179 **/