1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.travel.document;
17
18 import edu.sampleu.travel.bo.TravelAccount;
19 import org.kuali.rice.krad.document.SessionDocument;
20 import org.kuali.rice.krad.document.TransactionalDocumentBase;
21
22 import javax.persistence.*;
23 import java.util.ArrayList;
24 import java.util.List;
25
26
27 @Entity
28 @Table(name="TRV_DOC_2")
29 public class TravelDocument2 extends TransactionalDocumentBase implements SessionDocument {
30
31 @Column(name="traveler")
32 private String traveler;
33 @Column(name="org")
34 private String origin;
35 @Column(name="dest")
36 private String destination;
37 @Column(name="request_trav")
38 private String requestType;
39 @Transient
40 private String accountType;
41
42 @ManyToMany(fetch = FetchType.EAGER)
43 @JoinTable(name="TRAV_DOC_2_ACCOUNTS",
44 joinColumns={@JoinColumn(name="fdoc_nbr", referencedColumnName="fdoc_nbr", unique=false)},
45 inverseJoinColumns={@JoinColumn(name="acct_num", referencedColumnName="acct_num", unique=false)}
46 )
47 private List<TravelAccount> travelAccounts;
48
49 public TravelDocument2() {
50 travelAccounts = new ArrayList<TravelAccount>();
51 }
52
53 public String getDestination() {
54 return destination;
55 }
56
57 public void setDestination(String destination) {
58 this.destination = destination;
59 }
60
61 public String getOrigin() {
62 return origin;
63 }
64
65 public void setOrigin(String origin) {
66 this.origin = origin;
67 }
68
69 public String getTraveler() {
70 return traveler;
71 }
72
73 public void setTraveler(String traveler) {
74 this.traveler = traveler;
75 }
76
77 public List<TravelAccount> getTravelAccounts() {
78 return travelAccounts;
79 }
80
81 public void setTravelAccounts(List<TravelAccount> travelAccounts) {
82 this.travelAccounts = travelAccounts;
83 }
84
85 public TravelAccount getTravelAccount(int index) {
86 while(travelAccounts.size() - 1 < index) {
87 travelAccounts.add(new TravelAccount());
88 }
89 return travelAccounts.get(index);
90 }
91
92 public String getRequestType() {
93 return requestType;
94 }
95
96 public void setRequestType(String requestType) {
97 this.requestType = requestType;
98 }
99
100
101
102
103 public void setAccountType(String accountType) {
104 this.accountType = accountType;
105 }
106
107
108
109
110 public String getAccountType() {
111 return accountType;
112 }
113
114 }