001/**
002 * Copyright 2005-2016 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 */
016package edu.sampleu.travel.dataobject;
017
018import org.apache.commons.lang.StringUtils;
019import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
020import org.kuali.rice.kim.api.identity.Person;
021import org.kuali.rice.krad.bo.DataObjectBase;
022import org.kuali.rice.krad.data.provider.annotation.InheritProperties;
023import org.kuali.rice.krad.data.provider.annotation.InheritProperty;
024import org.kuali.rice.krad.data.provider.annotation.Label;
025import org.kuali.rice.krad.data.provider.annotation.Relationship;
026import org.kuali.rice.krad.data.provider.annotation.UifAutoCreateViewType;
027import org.kuali.rice.krad.data.provider.annotation.UifAutoCreateViews;
028
029import javax.persistence.Column;
030import javax.persistence.Entity;
031import javax.persistence.GeneratedValue;
032import javax.persistence.Id;
033import javax.persistence.SequenceGenerator;
034import javax.persistence.Table;
035import javax.persistence.Temporal;
036import javax.persistence.TemporalType;
037import javax.persistence.Transient;
038import java.util.Date;
039
040
041@Entity
042@Table(name="TRVL_TRAVELER_DTL_T")
043@UifAutoCreateViews({UifAutoCreateViewType.INQUIRY, UifAutoCreateViewType.LOOKUP})
044public 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
096    @Relationship(foreignKeyFields="travelerTypeCode")
097    @Transient
098    protected TravelerType travelerType;
099    @Column(name = "customer_num", length = 40, nullable = true)
100    protected String customerNumber;
101    //protected AccountsReceivableCustomer customer;
102    @Transient
103    protected boolean liabilityInsurance;
104
105    @Column(name = "drive_lic_num", length = 20, nullable = true)
106    protected String driversLicenseNumber;
107    @Transient
108    protected String driversLicenseState;
109    @Column(name = "drive_lic_exp_dt")
110    @Temporal(TemporalType.DATE)
111    protected Date driversLicenseExpDate;
112
113    // Notification
114    @Transient
115    protected Boolean notifyTAFinal = Boolean.FALSE;
116    @Transient
117    protected Boolean notifyTAStatusChange = Boolean.FALSE;
118    @Transient
119    protected Boolean notifyTERFinal = Boolean.FALSE;
120    @Transient
121    protected Boolean notifyTERStatusChange = Boolean.FALSE;
122
123    @Column(name = "ACTV_IND", nullable = false, length = 1)
124    protected Boolean active = Boolean.TRUE;
125    @Column(name = "non_res_alien", length = 1, nullable = true)
126    protected Boolean nonResidentAlien = Boolean.FALSE;
127    @Transient
128    protected Boolean motorVehicleRecordCheck = Boolean.FALSE;
129
130    /**
131     * This method returns the document number this TravelerDetail object is associated with
132     *
133     * @return document number
134     */
135    public String getDocumentNumber() {
136        return documentNumber;
137    }
138
139    /**
140     * This method sets the document number this TravelerDetail object will be associated with
141     *
142     * @param documentNumber
143     */
144    public void setDocumentNumber(String documentNumber) {
145        this.documentNumber = documentNumber;
146    }
147
148    public String getId() {
149        return id;
150    }
151
152
153    public void setId(String id) {
154        this.id = id;
155    }
156
157    public String getFirstName() {
158        return firstName;
159    }
160
161
162    public void setFirstName(String firstName) {
163        this.firstName = firstName;
164    }
165
166    public String getLastName() {
167        return lastName;
168    }
169
170
171    public void setLastName(String lastName) {
172        this.lastName = lastName;
173    }
174
175    public String getMiddleName() {
176        return middleName;
177    }
178
179    public void setMiddleName(String middleName) {
180        this.middleName = middleName;
181    }
182
183    public String getName() {
184        String name = "";
185        if(StringUtils.isNotBlank(getFirstName()))
186            name += getFirstName();
187        if(StringUtils.isNotBlank(getMiddleName()))
188            name += " " + getMiddleName();
189        if(StringUtils.isNotBlank(getLastName()))
190            name += " " + getLastName();
191        return name;
192    }
193
194    public String getStreetAddressLine1() {
195        return streetAddressLine1;
196    }
197
198
199    public void setStreetAddressLine1(String streetAddressLine1) {
200        this.streetAddressLine1 = streetAddressLine1;
201    }
202
203    public String getStreetAddressLine2() {
204        return streetAddressLine2;
205    }
206
207
208    public void setStreetAddressLine2(String streetAddressLine2) {
209        this.streetAddressLine2 = streetAddressLine2;
210    }
211
212    public String getCityName() {
213        return cityName;
214    }
215
216
217    public void setCityName(String cityName) {
218        this.cityName = cityName;
219    }
220
221    public String getStateCode() {
222        return stateCode;
223    }
224
225
226    public void setStateCode(String stateCode) {
227        this.stateCode = stateCode;
228    }
229
230    public String getZipCode() {
231        return zipCode;
232    }
233
234
235    public void setZipCode(String zipCode) {
236        this.zipCode = zipCode;
237    }
238
239    public String getCountryCode() {
240        return countryCode;
241    }
242
243
244    public void setCountryCode(String countryCode) {
245        this.countryCode = countryCode;
246    }
247
248    public String getEmailAddress() {
249        return emailAddress;
250    }
251
252
253    public void setEmailAddress(String emailAddress) {
254        this.emailAddress = emailAddress;
255    }
256
257    public String getPhoneNumber() {
258        return phoneNumber;
259    }
260
261
262    public void setPhoneNumber(String phoneNumber) {
263        this.phoneNumber = phoneNumber;
264    }
265
266    public String getTravelerTypeCode() {
267        return travelerTypeCode;
268    }
269
270
271    public void setTravelerTypeCode(String travelerTypeCode) {
272        this.travelerTypeCode = travelerTypeCode;
273    }
274
275    public TravelerType getTravelerType() {
276        return travelerType;
277    }
278
279    public void setTravelerType(TravelerType travelerType) {
280        this.travelerType = travelerType;
281    }
282
283    public String getPrincipalId() {
284        return principalId;
285    }
286
287    public void setPrincipalId(String principalId) {
288        this.principalId = principalId;
289    }
290
291    public String getCustomerNumber() {
292        return customerNumber;
293    }
294
295    public void setCustomerNumber(String customerNumber) {
296        this.customerNumber = customerNumber;
297    }
298
299    public boolean isLiabilityInsurance() {
300        return liabilityInsurance;
301    }
302
303    public void setLiabilityInsurance(boolean liabilityInsurance) {
304        this.liabilityInsurance = liabilityInsurance;
305    }
306
307    public String getDriversLicenseNumber() {
308        return driversLicenseNumber;
309    }
310
311    public void setDriversLicenseNumber(String driversLicenseNumber) {
312        this.driversLicenseNumber = driversLicenseNumber;
313    }
314
315    public String getDriversLicenseState() {
316        return driversLicenseState;
317    }
318
319    public void setDriversLicenseState(String driversLicenseState) {
320        this.driversLicenseState = driversLicenseState;
321    }
322
323    public Date getDriversLicenseExpDate() {
324        return driversLicenseExpDate;
325    }
326
327    public void setDriversLicenseExpDate(Date driversLicenseExpDate) {
328        this.driversLicenseExpDate = driversLicenseExpDate;
329    }
330
331    public boolean getNotifyTAFinal() {
332        return notifyTAFinal;
333    }
334
335    public boolean getNotifyTAStatusChange() {
336        return notifyTAStatusChange;
337    }
338
339    public boolean getNotifyTERFinal() {
340        return notifyTERFinal;
341    }
342
343    public boolean getNotifyTERStatusChange() {
344        return notifyTERStatusChange;
345    }
346
347    public String getCitizenship() {
348        return citizenship;
349    }
350
351    public void setCitizenship(String citizenship) {
352        this.citizenship = citizenship;
353    }
354
355    public boolean isActive() {
356        return active;
357    }
358
359    public void setActive(boolean active) {
360        this.active = active;
361    }
362
363    public boolean isNotifyTAFinal() {
364        return notifyTAFinal;
365    }
366
367    public void setNotifyTAFinal(boolean notifyTAFinal) {
368        this.notifyTAFinal = notifyTAFinal;
369    }
370
371    public boolean isNotifyTAStatusChange() {
372        return notifyTAStatusChange;
373    }
374
375    public void setNotifyTAStatusChange(boolean notifyTAStatusChange) {
376        this.notifyTAStatusChange = notifyTAStatusChange;
377    }
378
379    public boolean isNotifyTERFinal() {
380        return notifyTERFinal;
381    }
382
383    public void setNotifyTERFinal(boolean notifyTERFinal) {
384        this.notifyTERFinal = notifyTERFinal;
385    }
386
387    public boolean isNotifyTERStatusChange() {
388        return notifyTERStatusChange;
389    }
390
391    public void setNotifyTERStatusChange(boolean notifyTERStatusChange) {
392        this.notifyTERStatusChange = notifyTERStatusChange;
393    }
394
395    public boolean isMotorVehicleRecordCheck() {
396        return motorVehicleRecordCheck;
397    }
398
399    public void setMotorVehicleRecordCheck(boolean motorVehicleRecordCheck) {
400        this.motorVehicleRecordCheck = motorVehicleRecordCheck;
401    }
402
403    public boolean isNonResidentAlien() {
404        return nonResidentAlien;
405    }
406
407    public void setNonResidentAlien(boolean nonResidentAlien) {
408        this.nonResidentAlien = nonResidentAlien;
409    }
410
411    public Date getDateOfBirth() {
412        return dateOfBirth;
413    }
414
415    public void setDateOfBirth(Date dateOfBirth) {
416        this.dateOfBirth = dateOfBirth;
417    }
418
419    public String getGender() {
420        return gender;
421    }
422
423    public void setGender(String gender) {
424        this.gender = gender;
425    }
426
427        public Person getPerson() {
428                return person;
429        }
430
431        public void setPerson(Person person) {
432                this.person = person;
433        }
434}