1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sys.web.struts;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.apache.commons.lang.StringUtils;
22 import org.kuali.ole.sys.OLEKeyConstants;
23 import org.kuali.ole.sys.businessobject.ElectronicPaymentClaim;
24 import org.kuali.ole.sys.context.SpringContext;
25 import org.kuali.ole.sys.service.ElectronicPaymentClaimingDocumentGenerationStrategy;
26 import org.kuali.ole.sys.service.ElectronicPaymentClaimingService;
27 import org.kuali.rice.kim.api.identity.Person;
28 import org.kuali.rice.kns.web.struts.form.KualiForm;
29 import org.kuali.rice.krad.util.GlobalVariables;
30
31 public class ElectronicFundTransferForm extends KualiForm {
32 private List<ElectronicPaymentClaim> claims;
33 private List<ElectronicPaymentClaimingDocumentGenerationStrategy> availableClaimingDocumentStrategies;
34 private List<ElectronicPaymentClaimClaimedHelper> claimedByCheckboxHelpers;
35 private String chosenElectronicPaymentClaimingDocumentCode;
36 private String hasDocumentation;
37
38
39
40
41 public ElectronicFundTransferForm() {
42 claims = new ArrayList<ElectronicPaymentClaim>();
43 claimedByCheckboxHelpers = new ArrayList<ElectronicPaymentClaimClaimedHelper>();
44 }
45
46
47
48
49
50 public List<ElectronicPaymentClaimingDocumentGenerationStrategy> getAvailableClaimingDocumentStrategies() {
51 return availableClaimingDocumentStrategies;
52 }
53
54
55
56
57 public void setAvailableClaimingDocumentStrategies(List<ElectronicPaymentClaimingDocumentGenerationStrategy> availableClaimingDocuments) {
58 this.availableClaimingDocumentStrategies = availableClaimingDocuments;
59 }
60
61 public boolean hasAvailableClaimingDocumentStrategies() {
62 return availableClaimingDocumentStrategies !=null && !availableClaimingDocumentStrategies.isEmpty();
63 }
64
65
66
67
68 public String getChosenElectronicPaymentClaimingDocumentCode() {
69 return chosenElectronicPaymentClaimingDocumentCode;
70 }
71
72
73
74
75 public void setChosenElectronicPaymentClaimingDocumentCode(String chosenElectronicPaymentClaimingDocumentCode) {
76 this.chosenElectronicPaymentClaimingDocumentCode = chosenElectronicPaymentClaimingDocumentCode;
77 }
78
79
80
81
82 public List<ElectronicPaymentClaim> getClaims() {
83 return claims;
84 }
85
86
87
88
89
90 public ElectronicPaymentClaim getClaim(int i) {
91 while (claims.size() <= i) {
92 claims.add(new ElectronicPaymentClaim());
93 }
94 return claims.get(i);
95 }
96
97
98
99
100
101 public void setClaim(ElectronicPaymentClaim claim, int i) {
102 while (claims.size() <= i) {
103 claims.add(new ElectronicPaymentClaim());
104 }
105 claims.add(i, claim);
106 }
107
108
109
110
111 public void setClaims(List<ElectronicPaymentClaim> claims) {
112 this.claims = claims;
113 }
114
115
116
117
118
119 public String getHasDocumentation() {
120 return hasDocumentation;
121 }
122
123
124
125
126
127 public void setHasDocumentation(String hasDocumentation) {
128 this.hasDocumentation = hasDocumentation;
129 }
130
131
132
133
134
135 public boolean isProperlyDocumented() {
136 return StringUtils.isNotBlank(this.hasDocumentation) && this.hasDocumentation.equals("Yep");
137 }
138
139
140
141
142
143 public boolean isAllowElectronicFundsTransferAdministration() {
144 Person currentUser = GlobalVariables.getUserSession().getPerson();
145
146 return SpringContext.getBean(ElectronicPaymentClaimingService.class).isAuthorizedForClaimingElectronicPayment(currentUser, null);
147 }
148
149
150
151
152 public String getDocumentationMessageKey() {
153 return OLEKeyConstants.ElectronicPaymentClaim.MESSAGE_EFT_CLAIMING_DOCUMENTATION;
154 }
155
156
157
158
159 public String getDocumentChoiceMessageKey() {
160 return OLEKeyConstants.ElectronicPaymentClaim.MESSAGE_EFT_DOCUMENT_CHOICE;
161 }
162
163
164
165
166 public String getPreviouslyClaimedHeaderKey() {
167 return OLEKeyConstants.ElectronicPaymentClaim.MESSAGE_EFT_PREVIOUSLY_CLAIMED_HEADER;
168 }
169
170
171
172
173 public String getClaimingDocumentNumberHeaderKey() {
174 return OLEKeyConstants.ElectronicPaymentClaim.MESSAGE_EFT_CLAIMING_DOCUMENT_NUMBER_HEADER;
175 }
176
177
178
179
180
181 public List<ElectronicPaymentClaimClaimedHelper> getClaimedByCheckboxHelpers() {
182 return claimedByCheckboxHelpers;
183 }
184
185
186
187
188
189 public void setClaimedByCheckboxHelpers(List<ElectronicPaymentClaimClaimedHelper> claimedByCheckboxHelpers) {
190 this.claimedByCheckboxHelpers = claimedByCheckboxHelpers;
191 }
192
193
194
195
196
197
198 public void setClaimedByCheckboxHelper(ElectronicPaymentClaimClaimedHelper claimedHelper, int index) {
199 while (claimedByCheckboxHelpers.size() <= index) {
200 claimedByCheckboxHelpers.add(new ElectronicPaymentClaimClaimedHelper());
201 }
202 claimedByCheckboxHelpers.set(index, claimedHelper);
203 }
204
205
206
207
208
209 public ElectronicPaymentClaimClaimedHelper getClaimedByCheckboxHelper(int index) {
210 while (claimedByCheckboxHelpers.size() <= index) {
211 claimedByCheckboxHelpers.add(new ElectronicPaymentClaimClaimedHelper());
212 }
213 return claimedByCheckboxHelpers.get(index);
214 }
215 }
216