View Javadoc
1   /**
2    * Copyright 2011 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.mobility.conference.entity;
17  
18  import java.io.Serializable;
19  
20  import javax.xml.bind.annotation.XmlRootElement;
21  
22  @XmlRootElement( name = "attendee")
23  public class Attendee implements Serializable, Comparable<Attendee> {
24  
25  	private static final long serialVersionUID = -2826816981140315473L;
26  
27  	private String id;
28  	private String firstName;
29  	private String lastName;
30  	private String email;
31  	private String workPhone;
32  	private String cellPhone;
33  	private String institution;
34  	private String campus;
35  	private String title;
36  	private String workAddress1;
37  	private String workAddress2;
38  	private String workCity;
39  	private String workState;
40  	private String workZip;
41  	private String country;
42  
43  	public String getId() {
44      	return id;
45      }
46  
47  	public void setId(String id) {
48      	this.id = id;
49      }
50  
51  	public String getFirstName() {
52  		return firstName;
53  	}
54  
55  	public void setFirstName(String firstName) {
56  		this.firstName = firstName;
57  	}
58  
59  	public String getLastName() {
60  		return lastName;
61  	}
62  
63  	public void setLastName(String lastName) {
64  		this.lastName = lastName;
65  	}
66  
67  	public String getEmail() {
68  		return email;
69  	}
70  
71  	public void setEmail(String email) {
72  		this.email = email;
73  	}
74  
75  	public String getWorkPhone() {
76  		return workPhone;
77  	}
78  
79  	public void setWorkPhone(String workPhone) {
80  		this.workPhone = workPhone;
81  	}
82  
83  	public String getCellPhone() {
84  		return cellPhone;
85  	}
86  
87  	public void setCellPhone(String cellPhone) {
88  		this.cellPhone = cellPhone;
89  	}
90  
91  	public String getInstitution() {
92  		return institution;
93  	}
94  
95  	public void setInstitution(String institution) {
96  		this.institution = institution;
97  	}
98  	
99  	public String getCampus() {
100     	return campus;
101     }
102 	
103 	public String getTitle() {
104     	return title;
105     }
106 
107 	public void setTitle(String title) {
108     	this.title = title;
109     }
110 
111 	public void setCampus(String campus) {
112     	this.campus = campus;
113     }
114 
115 	public String getWorkAddress1() {
116 		return workAddress1;
117 	}
118 
119 	public void setWorkAddress1(String workAddress1) {
120 		this.workAddress1 = workAddress1;
121 	}
122 
123 	public String getWorkAddress2() {
124 		return workAddress2;
125 	}
126 
127 	public void setWorkAddress2(String workAddress2) {
128 		this.workAddress2 = workAddress2;
129 	}
130 
131 	public String getWorkCity() {
132 		return workCity;
133 	}
134 
135 	public void setWorkCity(String workCity) {
136 		this.workCity = workCity;
137 	}
138 
139 	public String getWorkState() {
140 		return workState;
141 	}
142 
143 	public void setWorkState(String workState) {
144 		this.workState = workState;
145 	}
146 
147 	public String getWorkZip() {
148 		return workZip;
149 	}
150 
151 	public void setWorkZip(String workZip) {
152 		this.workZip = workZip;
153 	}
154 
155 	public String getCountry() {
156 		return country;
157 	}
158 
159 	public void setCountry(String country) {
160 		this.country = country;
161 	}
162 
163 	@Override
164 	public int compareTo(Attendee that) {
165 		if (that == null) {
166 			return -1;
167 		}
168 		
169 		if (this.getLastName() == null && that.getLastName() == null) {
170 			return -1;
171 		}
172 		
173 		if (this.getLastName() != null && that.getLastName() == null) {
174 			return -1;
175 		}
176 		
177 		if (this.getLastName() == null && that.getLastName() != null) {
178 			return 1;
179 		}
180 		
181 		int lastNameCompare = this.getLastName().compareTo(that.getLastName());
182 		if (lastNameCompare == 0) {
183 			
184 			if (this.getFirstName() == null && that.getFirstName() == null) {
185 				return -1;
186 			}
187 			
188 			if (this.getFirstName() != null && that.getFirstName() == null) {
189 				return -1;
190 			}
191 			
192 			if (this.getFirstName() == null && that.getFirstName() != null) {
193 				return 1;
194 			}
195 			
196 			return this.getFirstName().compareTo(that.getFirstName());	
197 		}
198 		
199 		return lastNameCompare;
200 	}
201 
202 }