View Javadoc

1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package edu.sampleu.travel.approval.dataobject;
17  
18  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
19  import javax.persistence.Entity;
20  import javax.persistence.Table;
21  import javax.persistence.OneToMany;
22  import java.sql.Date;
23  import java.util.ArrayList;
24  import java.util.LinkedHashMap;
25  import java.util.List;
26  import javax.persistence.Column;
27  import javax.persistence.GeneratedValue;
28  import javax.persistence.Id;
29  import javax.persistence.JoinColumn;
30  import javax.persistence.ManyToOne;
31  import javax.persistence.SequenceGenerator;
32  import org.apache.commons.lang.StringUtils;
33  //import org.kuali.kfs.integration.ar.AccountsReceivableCustomer;
34  
35  
36  @Entity
37  @Table(name="TRVL_TRAVELER_DTL_T")
38  public class TravelerDetail extends PersistableBusinessObjectBase {
39  
40      protected Integer id;
41      protected String documentNumber;
42      protected String principalId;
43      protected String principalName;
44      protected String firstName;
45      protected String middleName;
46      protected String lastName;
47      protected String streetAddressLine1;
48      protected String streetAddressLine2;
49      protected String cityName;
50      protected String stateCode;
51      protected String zipCode;
52      protected String countryCode;
53      protected String citizenship;
54      protected String emailAddress;
55      protected Date dateOfBirth;
56      protected String gender;
57      protected String phoneNumber;
58      protected String travelerTypeCode;
59      protected TravelerType travelerType;
60      protected String customerNumber;
61      //protected AccountsReceivableCustomer customer;
62      protected boolean liabilityInsurance;
63  
64      protected String driversLicenseNumber;
65      protected String driversLicenseState;
66      protected Date driversLicenseExpDate;
67  
68      // Notification
69      protected boolean notifyTAFinal = Boolean.FALSE;
70      protected boolean notifyTAStatusChange = Boolean.FALSE;
71      protected boolean notifyTERFinal = Boolean.FALSE;
72      protected boolean notifyTERStatusChange = Boolean.FALSE;
73  
74      protected boolean active = Boolean.TRUE;
75      protected boolean nonResidentAlien = Boolean.FALSE;
76      protected boolean motorVehicleRecordCheck = Boolean.FALSE;
77  
78      @OneToMany(mappedBy = "id")
79      private List<TravelerDetailEmergencyContact> emergencyContacts = new ArrayList<TravelerDetailEmergencyContact>();
80  
81      /**
82       * Reset emergency contact lists when switching the traveler/tem profile
83       */
84      public void resetEmergencyContacts(){
85          emergencyContacts = new ArrayList<TravelerDetailEmergencyContact>();
86      }
87  
88      public List<TravelerDetailEmergencyContact> getEmergencyContacts() {
89          return emergencyContacts;
90      }
91  
92      public void setEmergencyContacts(List<TravelerDetailEmergencyContact> emergencyContacts) {
93          this.emergencyContacts = emergencyContacts;
94      }
95  
96      /**
97       * This method returns the document number this TravelerDetail object is associated with
98       *
99       * @return document number
100      */
101     @Column(name = "doc_nbr")
102     public String getDocumentNumber() {
103         return documentNumber;
104     }
105 
106     /**
107      * This method sets the document number this TravelerDetail object will be associated with
108      *
109      * @param documentNumber
110      */
111     public void setDocumentNumber(String documentNumber) {
112         this.documentNumber = documentNumber;
113     }
114 
115     @Id
116     @GeneratedValue(generator = "TEM_TRAVELER_DTL_ID_SEQ")
117     @SequenceGenerator(name = "TEM_TRAVELER_DTL_ID_SEQ", sequenceName = "TEM_TRAVELER_DTL_ID_SEQ", allocationSize = 5)
118     @Column(name = "id", nullable = false)
119     public Integer getId() {
120         return id;
121     }
122 
123 
124     public void setId(Integer id) {
125         this.id = id;
126     }
127 
128     @Column(name = "first_nm", length = 40, nullable = false)
129     public String getFirstName() {
130         return firstName;
131     }
132 
133 
134     public void setFirstName(String firstName) {
135         this.firstName = firstName;
136     }
137 
138     @Column(name = "last_nm", length = 40, nullable = false)
139     public String getLastName() {
140         return lastName;
141     }
142 
143 
144     public void setLastName(String lastName) {
145         this.lastName = lastName;
146     }
147 
148     /**
149      * Gets the middleName attribute.
150      *
151      * @return Returns the middleName.
152      */
153     @Column(length = 40, nullable = true)
154     public String getMiddleName() {
155         return middleName;
156     }
157 
158     /**
159      * Sets the middleName attribute value.
160      *
161      * @param middleName The middleName to set.
162      */
163     public void setMiddleName(String middleName) {
164         this.middleName = middleName;
165     }
166 
167     public String getName() {
168         String name = "";
169         if(StringUtils.isNotBlank(getFirstName()))
170             name += getFirstName();
171         if(StringUtils.isNotBlank(getMiddleName()))
172             name += " " + getMiddleName();
173         if(StringUtils.isNotBlank(getLastName()))
174             name += " " + getLastName();
175         return name;
176     }
177 
178     @Column(name = "addr_line_1", length = 50, nullable = false)
179     public String getStreetAddressLine1() {
180         return streetAddressLine1;
181     }
182 
183 
184     public void setStreetAddressLine1(String streetAddressLine1) {
185         this.streetAddressLine1 = streetAddressLine1;
186     }
187 
188     @Column(name = "addr_line_2", length = 50, nullable = true)
189     public String getStreetAddressLine2() {
190         return streetAddressLine2;
191     }
192 
193 
194     public void setStreetAddressLine2(String streetAddressLine2) {
195         this.streetAddressLine2 = streetAddressLine2;
196     }
197 
198     @Column(name = "city_nm", length = 50, nullable = true)
199     public String getCityName() {
200         return cityName;
201     }
202 
203 
204     public void setCityName(String cityName) {
205         this.cityName = cityName;
206     }
207 
208     @Column(name = "postal_state_cd", length = 50, nullable = false)
209     public String getStateCode() {
210         return stateCode;
211     }
212 
213 
214     public void setStateCode(String stateCode) {
215         this.stateCode = stateCode;
216     }
217 
218     @Column(name = "postal_cd", length = 50, nullable = false)
219     public String getZipCode() {
220         return zipCode;
221     }
222 
223 
224     public void setZipCode(String zipCode) {
225         this.zipCode = zipCode;
226     }
227 
228     @Column(name = "country_cd", length = 50, nullable = true)
229     public String getCountryCode() {
230         return countryCode;
231     }
232 
233 
234     public void setCountryCode(String countryCode) {
235         this.countryCode = countryCode;
236     }
237 
238     @Column(name = "email_addr", length = 50, nullable = true)
239     public String getEmailAddress() {
240         return emailAddress;
241     }
242 
243 
244     public void setEmailAddress(String emailAddress) {
245         this.emailAddress = emailAddress;
246     }
247 
248     @Column(name = "phone_nbr", length = 20, nullable = true)
249     public String getPhoneNumber() {
250         return phoneNumber;
251     }
252 
253 
254     public void setPhoneNumber(String phoneNumber) {
255         this.phoneNumber = phoneNumber;
256     }
257 
258     @Column(name = "traveler_typ_cd", length = 3, nullable = false)
259     public String getTravelerTypeCode() {
260         return travelerTypeCode;
261     }
262 
263 
264     public void setTravelerTypeCode(String travelerTypeCode) {
265         this.travelerTypeCode = travelerTypeCode;
266     }
267 
268     @ManyToOne
269     @JoinColumn(name = "traveler_typ_cd")
270     public TravelerType getTravelerType() {
271         return travelerType;
272     }
273 
274     public void setTravelerType(TravelerType travelerType) {
275         this.travelerType = travelerType;
276     }
277 
278     /**
279      * Gets the principalId attribute.
280      *
281      * @return Returns the principalId.
282      */
283     @Column(name = "EMP_PRINCIPAL_ID")
284     public String getPrincipalId() {
285         return principalId;
286     }
287 
288     /**
289      * Sets the principalId attribute value.
290      *
291      * @param principalId The principalId to set.
292      */
293     public void setPrincipalId(String principalId) {
294         this.principalId = principalId;
295     }
296 
297     /**
298      * Gets the principalName attribute.
299      *
300      * @return Returns the principalName.
301      */
302     @Column(name = "EMP_PRINCIPAL_ID")
303     public String getPrincipalName() {
304         return principalName;
305     }
306 
307     /**
308      * Sets the principalName attribute value.
309      *
310      * @param principalName The principalName to set.
311      */
312     public void setPrincipalName(String principalName) {
313         this.principalName = principalName;
314     }
315 
316     /**
317      * Gets the customerNumber attribute.
318      *
319      * @return Returns the customerNumber.
320      */
321     @Column(name = "customer_num", length = 40, nullable = true)
322     public String getCustomerNumber() {
323         return customerNumber;
324     }
325 
326     /**
327      * Sets the customerNumber attribute value.
328      *
329      * @param customerNumber The customerNumber to set.
330      */
331     public void setCustomerNumber(String customerNumber) {
332         this.customerNumber = customerNumber;
333     }
334 
335     /*
336     public void setCustomer(final AccountsReceivableCustomer customer) {
337 
338         this.customer = customer;
339     }
340 
341     public AccountsReceivableCustomer getCustomer() {
342         return this.customer;
343     }
344       */
345 
346     protected LinkedHashMap toStringMapper() {
347         LinkedHashMap map = new LinkedHashMap();
348         map.put("id", id);
349         map.put("firstName", firstName);
350         map.put("lastName", lastName);
351         map.put("streetAddressLine1", streetAddressLine1);
352         map.put("cityName", cityName);
353         return map;
354     }
355 
356     public boolean isLiabilityInsurance() {
357         return liabilityInsurance;
358     }
359 
360     public void setLiabilityInsurance(boolean liabilityInsurance) {
361         this.liabilityInsurance = liabilityInsurance;
362     }
363 
364     /**
365      * Gets the driversLicenseNumber attribute.
366      *
367      * @return Returns the driversLicenseNumber.
368      */
369     @Column(name = "drive_lic_num", length = 20, nullable = true)
370     public String getDriversLicenseNumber() {
371         return driversLicenseNumber;
372     }
373 
374     /**
375      * Sets the driversLicenseNumber attribute value.
376      *
377      * @param driversLicenseNumber The driversLicenseNumber to set.
378      */
379     public void setDriversLicenseNumber(String driversLicenseNumber) {
380         this.driversLicenseNumber = driversLicenseNumber;
381     }
382 
383     /**
384      * Gets the driversLicenseState attribute.
385      *
386      * @return Returns the driversLicenseState.
387      */
388     public String getDriversLicenseState() {
389         return driversLicenseState;
390     }
391 
392     /**
393      * Sets the driversLicenseState attribute value.
394      *
395      * @param driversLicenseState The driversLicenseState to set.
396      */
397     public void setDriversLicenseState(String driversLicenseState) {
398         this.driversLicenseState = driversLicenseState;
399     }
400 
401     /**
402      * Gets the driversLicenseExpDate attribute.
403      *
404      * @return Returns the driversLicenseExpDate.
405      */
406     @Column(name = "drive_lic_exp_dt", length = 10)
407     public Date getDriversLicenseExpDate() {
408         return driversLicenseExpDate;
409     }
410 
411 
412     /**
413      * Sets the driversLicenseExpDate attribute value.
414      *
415      * @param driversLicenseExpDate The driversLicenseExpDate to set.
416      */
417     public void setDriversLicenseExpDate(Date driversLicenseExpDate) {
418         this.driversLicenseExpDate = driversLicenseExpDate;
419     }
420 
421     public boolean getNotifyTAFinal() {
422         return notifyTAFinal;
423     }
424 
425     public boolean getNotifyTAStatusChange() {
426         return notifyTAStatusChange;
427     }
428 
429     public boolean getNotifyTERFinal() {
430         return notifyTERFinal;
431     }
432 
433     public boolean getNotifyTERStatusChange() {
434         return notifyTERStatusChange;
435     }
436 
437     /**
438      * Gets the citizenship attribute.
439      *
440      * @return Returns the citizenship.
441      */
442     @Column(name = "citizenship", length = 40, nullable = true)
443     public String getCitizenship() {
444         return citizenship;
445     }
446 
447     /**
448      * Sets the citizenship attribute value.
449      *
450      * @param citizenship The citizenship to set.
451      */
452     public void setCitizenship(String citizenship) {
453         this.citizenship = citizenship;
454     }
455 
456     /**
457      * Gets the active attribute.
458      *
459      * @return Returns the active.
460      */
461     @Column(name = "ACTV_IND", nullable = false, length = 1)
462     public boolean isActive() {
463         return active;
464     }
465 
466     /**
467      * Sets the active attribute value.
468      *
469      * @param active The active to set.
470      */
471     public void setActive(boolean active) {
472         this.active = active;
473     }
474 
475     /**
476      * Gets the notifyTAFinal attribute.
477      *
478      * @return Returns the notifyTAFinal.
479      */
480     public boolean isNotifyTAFinal() {
481         return notifyTAFinal;
482     }
483 
484     /**
485      * Sets the notifyTAFinal attribute value.
486      *
487      * @param notifyTAFinal The notifyTAFinal to set.
488      */
489     public void setNotifyTAFinal(boolean notifyTAFinal) {
490         this.notifyTAFinal = notifyTAFinal;
491     }
492 
493     /**
494      * Gets the notifyTAStatusChange attribute.
495      *
496      * @return Returns the notifyTAStatusChange.
497      */
498     public boolean isNotifyTAStatusChange() {
499         return notifyTAStatusChange;
500     }
501 
502     /**
503      * Sets the notifyTAStatusChange attribute value.
504      *
505      * @param notifyTAStatusChange The notifyTAStatusChange to set.
506      */
507     public void setNotifyTAStatusChange(boolean notifyTAStatusChange) {
508         this.notifyTAStatusChange = notifyTAStatusChange;
509     }
510 
511     /**
512      * Gets the notifyTERFinal attribute.
513      *
514      * @return Returns the notifyTERFinal.
515      */
516     public boolean isNotifyTERFinal() {
517         return notifyTERFinal;
518     }
519 
520     /**
521      * Sets the notifyTERFinal attribute value.
522      *
523      * @param notifyTERFinal The notifyTERFinal to set.
524      */
525     public void setNotifyTERFinal(boolean notifyTERFinal) {
526         this.notifyTERFinal = notifyTERFinal;
527     }
528 
529     /**
530      * Gets the notifyTERStatusChange attribute.
531      *
532      * @return Returns the notifyTERStatusChange.
533      */
534     public boolean isNotifyTERStatusChange() {
535         return notifyTERStatusChange;
536     }
537 
538     /**
539      * Sets the notifyTERStatusChange attribute value.
540      *
541      * @param notifyTERStatusChange The notifyTERStatusChange to set.
542      */
543     public void setNotifyTERStatusChange(boolean notifyTERStatusChange) {
544         this.notifyTERStatusChange = notifyTERStatusChange;
545     }
546 
547     public boolean isMotorVehicleRecordCheck() {
548         return motorVehicleRecordCheck;
549     }
550 
551     public void setMotorVehicleRecordCheck(boolean motorVehicleRecordCheck) {
552         this.motorVehicleRecordCheck = motorVehicleRecordCheck;
553     }
554 
555     /**
556      * Gets the nonResIdentAlien attribute.
557      *
558      * @return Returns the nonResIdentAlien.
559      */
560     @Column(name = "non_res_alien", length = 1, nullable = true)
561     public boolean isNonResidentAlien() {
562         return nonResidentAlien;
563     }
564 
565     /**
566      * Sets the nonResIdentAlien attribute value.
567      *
568      * @param nonResIdentAlien The nonResIdentAlien to set.
569      */
570     public void setNonResidentAlien(boolean nonResidentAlien) {
571         this.nonResidentAlien = nonResidentAlien;
572     }
573 
574     /**
575      * Gets the dateOfBirth attribute.
576      *
577      * @return Returns the dateOfBirth.
578      */
579     @Column(name = "date_of_birth", length = 10, nullable = false)
580     public Date getDateOfBirth() {
581         return dateOfBirth;
582     }
583 
584     /**
585      * Sets the dateOfBirth attribute value.
586      *
587      * @param dateOfBirth The dateOfBirth to set.
588      */
589     public void setDateOfBirth(Date dateOfBirth) {
590         this.dateOfBirth = dateOfBirth;
591     }
592 
593     /**
594      * Gets the gender attribute.
595      *
596      * @return Returns the gender.
597      */
598     @Column(name = "gender", length = 1, nullable = false)
599     public String getGender() {
600         return gender;
601     }
602 
603     /**
604      * Sets the gender attribute value.
605      *
606      * @param gender The gender to set.
607      */
608     public void setGender(String gender) {
609         this.gender = gender;
610     }
611 }