001    /**
002     * Copyright 2005-2014 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package edu.sampleu.travel.dataobject;
017    
018    import org.apache.commons.lang.StringUtils;
019    import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
020    import org.kuali.rice.kim.api.identity.Person;
021    import org.kuali.rice.krad.bo.DataObjectBase;
022    import org.kuali.rice.krad.data.provider.annotation.InheritProperties;
023    import org.kuali.rice.krad.data.provider.annotation.InheritProperty;
024    import org.kuali.rice.krad.data.provider.annotation.Label;
025    import org.kuali.rice.krad.data.provider.annotation.Relationship;
026    import org.kuali.rice.krad.data.provider.annotation.UifAutoCreateViewType;
027    import org.kuali.rice.krad.data.provider.annotation.UifAutoCreateViews;
028    
029    import javax.persistence.Column;
030    import javax.persistence.Entity;
031    import javax.persistence.GeneratedValue;
032    import javax.persistence.Id;
033    import javax.persistence.SequenceGenerator;
034    import javax.persistence.Table;
035    import javax.persistence.Temporal;
036    import javax.persistence.TemporalType;
037    import javax.persistence.Transient;
038    import java.util.Date;
039    
040    
041    @Entity
042    @Table(name="TRVL_TRAVELER_DTL_T")
043    @UifAutoCreateViews({UifAutoCreateViewType.INQUIRY, UifAutoCreateViewType.LOOKUP})
044    public class TravelerDetail extends DataObjectBase implements MutableInactivatable {
045            private static final long serialVersionUID = -7169083136626617130L;
046    
047        @Id
048        @GeneratedValue(generator = "TRVL_TRAVELER_DTL_ID_S")
049        @SequenceGenerator(name = "TRVL_TRAVELER_DTL_ID_S", sequenceName = "TRVL_TRAVELER_DTL_ID_S", allocationSize = 5)
050        @Column(name = "id", length = 40, nullable = false)
051            protected String id;
052        @Column(name = "doc_nbr", length=14)
053        protected String documentNumber;
054        @Column(name = "EMP_PRINCIPAL_ID")
055        protected String principalId;
056        @Relationship(foreignKeyFields="principalId")
057        @Transient
058        @InheritProperties({
059                    @InheritProperty(name="principalName",label=@Label("Traveler User ID")),
060                    @InheritProperty(name="name",label=@Label("Traveler Name"))
061        })
062            private Person person;
063        @Column(name = "first_nm", length = 40, nullable = false)
064        protected String firstName;
065        @Column(length = 40, nullable = true)
066        protected String middleName;
067        @Column(name = "last_nm", length = 40, nullable = false)
068        protected String lastName;
069        @Column(name = "addr_line_1", length = 50, nullable = false)
070        protected String streetAddressLine1;
071        @Column(name = "addr_line_2", length = 50, nullable = true)
072        protected String streetAddressLine2;
073        @Column(name = "city_nm", length = 50, nullable = true)
074        protected String cityName;
075        @Column(name = "postal_state_cd", length = 2, nullable = false)
076        protected String stateCode;
077        @Column(name = "postal_cd", length = 11, nullable = false)
078        protected String zipCode;
079        @Column(name = "country_cd", length = 2, nullable = true)
080        protected String countryCode;
081        @Column(name = "citizenship", length = 40, nullable = true)
082        protected String citizenship;
083        @Column(name = "email_addr", length = 50, nullable = true)
084        protected String emailAddress;
085        @Transient
086        protected Date dateOfBirth;
087        @Column(name = "gender", length = 1, nullable = false)
088        protected String gender;
089        @Column(name = "phone_nbr", length = 20, nullable = true)
090        protected String phoneNumber;
091        @Column(name = "traveler_typ_cd", length = 3, nullable = false)
092        protected String travelerTypeCode;
093    //    @ManyToOne
094    //    @JoinColumn(name = "traveler_typ_cd", insertable=false, updatable=false)
095        @Transient
096        protected TravelerType travelerType;
097        @Column(name = "customer_num", length = 40, nullable = true)
098        protected String customerNumber;
099        //protected AccountsReceivableCustomer customer;
100        @Transient
101        protected boolean liabilityInsurance;
102    
103        @Column(name = "drive_lic_num", length = 20, nullable = true)
104        protected String driversLicenseNumber;
105        @Transient
106        protected String driversLicenseState;
107        @Column(name = "drive_lic_exp_dt")
108        @Temporal(TemporalType.DATE)
109        protected Date driversLicenseExpDate;
110    
111        // Notification
112        @Transient
113        protected Boolean notifyTAFinal = Boolean.FALSE;
114        @Transient
115        protected Boolean notifyTAStatusChange = Boolean.FALSE;
116        @Transient
117        protected Boolean notifyTERFinal = Boolean.FALSE;
118        @Transient
119        protected Boolean notifyTERStatusChange = Boolean.FALSE;
120    
121        @Column(name = "ACTV_IND", nullable = false, length = 1)
122        protected Boolean active = Boolean.TRUE;
123        @Column(name = "non_res_alien", length = 1, nullable = true)
124        protected Boolean nonResidentAlien = Boolean.FALSE;
125        @Transient
126        protected Boolean motorVehicleRecordCheck = Boolean.FALSE;
127    
128        /**
129         * This method returns the document number this TravelerDetail object is associated with
130         *
131         * @return document number
132         */
133        public String getDocumentNumber() {
134            return documentNumber;
135        }
136    
137        /**
138         * This method sets the document number this TravelerDetail object will be associated with
139         *
140         * @param documentNumber
141         */
142        public void setDocumentNumber(String documentNumber) {
143            this.documentNumber = documentNumber;
144        }
145    
146        public String getId() {
147            return id;
148        }
149    
150    
151        public void setId(String id) {
152            this.id = id;
153        }
154    
155        public String getFirstName() {
156            return firstName;
157        }
158    
159    
160        public void setFirstName(String firstName) {
161            this.firstName = firstName;
162        }
163    
164        public String getLastName() {
165            return lastName;
166        }
167    
168    
169        public void setLastName(String lastName) {
170            this.lastName = lastName;
171        }
172    
173        public String getMiddleName() {
174            return middleName;
175        }
176    
177        public void setMiddleName(String middleName) {
178            this.middleName = middleName;
179        }
180    
181        public String getName() {
182            String name = "";
183            if(StringUtils.isNotBlank(getFirstName()))
184                name += getFirstName();
185            if(StringUtils.isNotBlank(getMiddleName()))
186                name += " " + getMiddleName();
187            if(StringUtils.isNotBlank(getLastName()))
188                name += " " + getLastName();
189            return name;
190        }
191    
192        public String getStreetAddressLine1() {
193            return streetAddressLine1;
194        }
195    
196    
197        public void setStreetAddressLine1(String streetAddressLine1) {
198            this.streetAddressLine1 = streetAddressLine1;
199        }
200    
201        public String getStreetAddressLine2() {
202            return streetAddressLine2;
203        }
204    
205    
206        public void setStreetAddressLine2(String streetAddressLine2) {
207            this.streetAddressLine2 = streetAddressLine2;
208        }
209    
210        public String getCityName() {
211            return cityName;
212        }
213    
214    
215        public void setCityName(String cityName) {
216            this.cityName = cityName;
217        }
218    
219        public String getStateCode() {
220            return stateCode;
221        }
222    
223    
224        public void setStateCode(String stateCode) {
225            this.stateCode = stateCode;
226        }
227    
228        public String getZipCode() {
229            return zipCode;
230        }
231    
232    
233        public void setZipCode(String zipCode) {
234            this.zipCode = zipCode;
235        }
236    
237        public String getCountryCode() {
238            return countryCode;
239        }
240    
241    
242        public void setCountryCode(String countryCode) {
243            this.countryCode = countryCode;
244        }
245    
246        public String getEmailAddress() {
247            return emailAddress;
248        }
249    
250    
251        public void setEmailAddress(String emailAddress) {
252            this.emailAddress = emailAddress;
253        }
254    
255        public String getPhoneNumber() {
256            return phoneNumber;
257        }
258    
259    
260        public void setPhoneNumber(String phoneNumber) {
261            this.phoneNumber = phoneNumber;
262        }
263    
264        public String getTravelerTypeCode() {
265            return travelerTypeCode;
266        }
267    
268    
269        public void setTravelerTypeCode(String travelerTypeCode) {
270            this.travelerTypeCode = travelerTypeCode;
271        }
272    
273        public TravelerType getTravelerType() {
274            return travelerType;
275        }
276    
277        public void setTravelerType(TravelerType travelerType) {
278            this.travelerType = travelerType;
279        }
280    
281        public String getPrincipalId() {
282            return principalId;
283        }
284    
285        public void setPrincipalId(String principalId) {
286            this.principalId = principalId;
287        }
288    
289        public String getCustomerNumber() {
290            return customerNumber;
291        }
292    
293        public void setCustomerNumber(String customerNumber) {
294            this.customerNumber = customerNumber;
295        }
296    
297        public boolean isLiabilityInsurance() {
298            return liabilityInsurance;
299        }
300    
301        public void setLiabilityInsurance(boolean liabilityInsurance) {
302            this.liabilityInsurance = liabilityInsurance;
303        }
304    
305        public String getDriversLicenseNumber() {
306            return driversLicenseNumber;
307        }
308    
309        public void setDriversLicenseNumber(String driversLicenseNumber) {
310            this.driversLicenseNumber = driversLicenseNumber;
311        }
312    
313        public String getDriversLicenseState() {
314            return driversLicenseState;
315        }
316    
317        public void setDriversLicenseState(String driversLicenseState) {
318            this.driversLicenseState = driversLicenseState;
319        }
320    
321        public Date getDriversLicenseExpDate() {
322            return driversLicenseExpDate;
323        }
324    
325        public void setDriversLicenseExpDate(Date driversLicenseExpDate) {
326            this.driversLicenseExpDate = driversLicenseExpDate;
327        }
328    
329        public boolean getNotifyTAFinal() {
330            return notifyTAFinal;
331        }
332    
333        public boolean getNotifyTAStatusChange() {
334            return notifyTAStatusChange;
335        }
336    
337        public boolean getNotifyTERFinal() {
338            return notifyTERFinal;
339        }
340    
341        public boolean getNotifyTERStatusChange() {
342            return notifyTERStatusChange;
343        }
344    
345        public String getCitizenship() {
346            return citizenship;
347        }
348    
349        public void setCitizenship(String citizenship) {
350            this.citizenship = citizenship;
351        }
352    
353        public boolean isActive() {
354            return active;
355        }
356    
357        public void setActive(boolean active) {
358            this.active = active;
359        }
360    
361        public boolean isNotifyTAFinal() {
362            return notifyTAFinal;
363        }
364    
365        public void setNotifyTAFinal(boolean notifyTAFinal) {
366            this.notifyTAFinal = notifyTAFinal;
367        }
368    
369        public boolean isNotifyTAStatusChange() {
370            return notifyTAStatusChange;
371        }
372    
373        public void setNotifyTAStatusChange(boolean notifyTAStatusChange) {
374            this.notifyTAStatusChange = notifyTAStatusChange;
375        }
376    
377        public boolean isNotifyTERFinal() {
378            return notifyTERFinal;
379        }
380    
381        public void setNotifyTERFinal(boolean notifyTERFinal) {
382            this.notifyTERFinal = notifyTERFinal;
383        }
384    
385        public boolean isNotifyTERStatusChange() {
386            return notifyTERStatusChange;
387        }
388    
389        public void setNotifyTERStatusChange(boolean notifyTERStatusChange) {
390            this.notifyTERStatusChange = notifyTERStatusChange;
391        }
392    
393        public boolean isMotorVehicleRecordCheck() {
394            return motorVehicleRecordCheck;
395        }
396    
397        public void setMotorVehicleRecordCheck(boolean motorVehicleRecordCheck) {
398            this.motorVehicleRecordCheck = motorVehicleRecordCheck;
399        }
400    
401        public boolean isNonResidentAlien() {
402            return nonResidentAlien;
403        }
404    
405        public void setNonResidentAlien(boolean nonResidentAlien) {
406            this.nonResidentAlien = nonResidentAlien;
407        }
408    
409        public Date getDateOfBirth() {
410            return dateOfBirth;
411        }
412    
413        public void setDateOfBirth(Date dateOfBirth) {
414            this.dateOfBirth = dateOfBirth;
415        }
416    
417        public String getGender() {
418            return gender;
419        }
420    
421        public void setGender(String gender) {
422            this.gender = gender;
423        }
424    
425            public Person getPerson() {
426                    return person;
427            }
428    
429            public void setPerson(Person person) {
430                    this.person = person;
431            }
432    }