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