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.kns.document.SessionDocument; |
20 | |
import org.kuali.rice.kns.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 | 0 | public TravelDocument2() { |
50 | 0 | travelAccounts = new ArrayList<TravelAccount>(); |
51 | 0 | } |
52 | |
|
53 | |
public String getDestination() { |
54 | 0 | return destination; |
55 | |
} |
56 | |
|
57 | |
public void setDestination(String destination) { |
58 | 0 | this.destination = destination; |
59 | 0 | } |
60 | |
|
61 | |
public String getOrigin() { |
62 | 0 | return origin; |
63 | |
} |
64 | |
|
65 | |
public void setOrigin(String origin) { |
66 | 0 | this.origin = origin; |
67 | 0 | } |
68 | |
|
69 | |
public String getTraveler() { |
70 | 0 | return traveler; |
71 | |
} |
72 | |
|
73 | |
public void setTraveler(String traveler) { |
74 | 0 | this.traveler = traveler; |
75 | 0 | } |
76 | |
|
77 | |
public List<TravelAccount> getTravelAccounts() { |
78 | 0 | return travelAccounts; |
79 | |
} |
80 | |
|
81 | |
public void setTravelAccounts(List<TravelAccount> travelAccounts) { |
82 | 0 | this.travelAccounts = travelAccounts; |
83 | 0 | } |
84 | |
|
85 | |
public TravelAccount getTravelAccount(int index) { |
86 | 0 | while(travelAccounts.size() - 1 < index) { |
87 | 0 | travelAccounts.add(new TravelAccount()); |
88 | |
} |
89 | 0 | return travelAccounts.get(index); |
90 | |
} |
91 | |
|
92 | |
public String getRequestType() { |
93 | 0 | return requestType; |
94 | |
} |
95 | |
|
96 | |
public void setRequestType(String requestType) { |
97 | 0 | this.requestType = requestType; |
98 | 0 | } |
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
public void setAccountType(String accountType) { |
104 | 0 | this.accountType = accountType; |
105 | 0 | } |
106 | |
|
107 | |
|
108 | |
|
109 | |
|
110 | |
public String getAccountType() { |
111 | 0 | return accountType; |
112 | |
} |
113 | |
|
114 | |
} |