001    /**
002     * Copyright 2011 The Kuali Foundation Licensed under the
003     * Educational Community License, Version 2.0 (the "License"); you may
004     * not use this file except in compliance with the License. You may
005     * obtain a copy of the License at
006     *
007     * http://www.osedu.org/licenses/ECL-2.0
008     *
009     * Unless required by applicable law or agreed to in writing,
010     * software distributed under the License is distributed on an "AS IS"
011     * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
012     * or implied. See the License for the specific language governing
013     * permissions and limitations under the License.
014     */
015    
016    package org.kuali.mobility.conference.entity;
017    
018    import java.io.Serializable;
019    
020    public class Attendee implements Serializable, Comparable<Attendee> {
021    
022            private static final long serialVersionUID = -2826816981140315473L;
023    
024            private String id;
025            private String firstName;
026            private String lastName;
027            private String email;
028            private String workPhone;
029            private String cellPhone;
030            private String institution;
031            private String campus;
032            private String title;
033            private String workAddress1;
034            private String workAddress2;
035            private String workCity;
036            private String workState;
037            private String workZip;
038            private String country;
039    
040            public String getId() {
041            return id;
042        }
043    
044            public void setId(String id) {
045            this.id = id;
046        }
047    
048            public String getFirstName() {
049                    return firstName;
050            }
051    
052            public void setFirstName(String firstName) {
053                    this.firstName = firstName;
054            }
055    
056            public String getLastName() {
057                    return lastName;
058            }
059    
060            public void setLastName(String lastName) {
061                    this.lastName = lastName;
062            }
063    
064            public String getEmail() {
065                    return email;
066            }
067    
068            public void setEmail(String email) {
069                    this.email = email;
070            }
071    
072            public String getWorkPhone() {
073                    return workPhone;
074            }
075    
076            public void setWorkPhone(String workPhone) {
077                    this.workPhone = workPhone;
078            }
079    
080            public String getCellPhone() {
081                    return cellPhone;
082            }
083    
084            public void setCellPhone(String cellPhone) {
085                    this.cellPhone = cellPhone;
086            }
087    
088            public String getInstitution() {
089                    return institution;
090            }
091    
092            public void setInstitution(String institution) {
093                    this.institution = institution;
094            }
095            
096            public String getCampus() {
097            return campus;
098        }
099            
100            public String getTitle() {
101            return title;
102        }
103    
104            public void setTitle(String title) {
105            this.title = title;
106        }
107    
108            public void setCampus(String campus) {
109            this.campus = campus;
110        }
111    
112            public String getWorkAddress1() {
113                    return workAddress1;
114            }
115    
116            public void setWorkAddress1(String workAddress1) {
117                    this.workAddress1 = workAddress1;
118            }
119    
120            public String getWorkAddress2() {
121                    return workAddress2;
122            }
123    
124            public void setWorkAddress2(String workAddress2) {
125                    this.workAddress2 = workAddress2;
126            }
127    
128            public String getWorkCity() {
129                    return workCity;
130            }
131    
132            public void setWorkCity(String workCity) {
133                    this.workCity = workCity;
134            }
135    
136            public String getWorkState() {
137                    return workState;
138            }
139    
140            public void setWorkState(String workState) {
141                    this.workState = workState;
142            }
143    
144            public String getWorkZip() {
145                    return workZip;
146            }
147    
148            public void setWorkZip(String workZip) {
149                    this.workZip = workZip;
150            }
151    
152            public String getCountry() {
153                    return country;
154            }
155    
156            public void setCountry(String country) {
157                    this.country = country;
158            }
159    
160            @Override
161            public int compareTo(Attendee that) {
162                    if (that == null) {
163                            return -1;
164                    }
165                    
166                    if (this.getLastName() == null && that.getLastName() == null) {
167                            return -1;
168                    }
169                    
170                    if (this.getLastName() != null && that.getLastName() == null) {
171                            return -1;
172                    }
173                    
174                    if (this.getLastName() == null && that.getLastName() != null) {
175                            return 1;
176                    }
177                    
178                    int lastNameCompare = this.getLastName().compareTo(that.getLastName());
179                    if (lastNameCompare == 0) {
180                            
181                            if (this.getFirstName() == null && that.getFirstName() == null) {
182                                    return -1;
183                            }
184                            
185                            if (this.getFirstName() != null && that.getFirstName() == null) {
186                                    return -1;
187                            }
188                            
189                            if (this.getFirstName() == null && that.getFirstName() != null) {
190                                    return 1;
191                            }
192                            
193                            return this.getFirstName().compareTo(that.getFirstName());      
194                    }
195                    
196                    return lastNameCompare;
197            }
198    
199    }