1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.pdp.web.struts;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import javax.servlet.http.HttpServletRequest;
22
23 import org.apache.struts.action.ActionMapping;
24 import org.kuali.ole.pdp.businessobject.CustomerProfile;
25 import org.kuali.ole.pdp.businessobject.DisbursementNumberFormatter;
26 import org.kuali.ole.pdp.businessobject.DisbursementNumberRange;
27 import org.kuali.ole.pdp.businessobject.FormatProcessSummary;
28 import org.kuali.rice.core.web.format.CurrencyFormatter;
29 import org.kuali.rice.kns.web.struts.form.KualiForm;
30
31
32
33
34 public class FormatForm extends KualiForm {
35
36 private String campus;
37 private String paymentDate;
38 private String paymentTypes;
39
40 private FormatProcessSummary formatProcessSummary;
41
42 private List<CustomerProfile> customers;
43 private List<DisbursementNumberRange> ranges;
44
45
46
47
48 public FormatForm() {
49 super();
50 customers = new ArrayList<CustomerProfile>();
51 ranges = new ArrayList<DisbursementNumberRange>();
52
53 this.setFormatterType("range.lastAssignedDisbNbr", DisbursementNumberFormatter.class);
54 }
55
56
57
58
59
60
61 public String getCampus() {
62 return campus;
63 }
64
65
66
67
68
69
70 public void setCampus(String campus) {
71 this.campus = campus;
72 }
73
74
75
76
77
78
79 public String getPaymentTypes() {
80 return paymentTypes;
81 }
82
83
84
85
86
87
88 public void setPaymentTypes(String paymentTypes) {
89 this.paymentTypes = paymentTypes;
90 }
91
92
93
94
95
96
97 public List<CustomerProfile> getCustomers() {
98 return customers;
99 }
100
101
102
103
104
105
106 public void setCustomers(List<CustomerProfile> customers) {
107 this.customers = customers;
108 }
109
110
111
112
113
114
115
116 public CustomerProfile getCustomer(int index) {
117 if (index >= customers.size()) {
118 for (int i = customers.size(); i <= index; i++) {
119 customers.add(new CustomerProfile());
120 }
121 }
122 return (CustomerProfile) customers.get(index);
123 }
124
125
126
127
128
129
130
131 public void setCustomer(int key, CustomerProfile value) {
132 customers.set(key, value);
133 }
134
135
136
137
138
139
140
141 public List<DisbursementNumberRange> getRanges() {
142 return ranges;
143 }
144
145
146
147
148
149
150 public void setRanges(List<DisbursementNumberRange> ranges) {
151 this.ranges = ranges;
152 }
153
154
155
156
157
158
159
160 public DisbursementNumberRange getRange(int index) {
161 if (index >= ranges.size()) {
162 for (int i = ranges.size(); i <= index; i++) {
163 ranges.add(new DisbursementNumberRange());
164 }
165 }
166 return (DisbursementNumberRange) ranges.get(index);
167 }
168
169
170
171
172
173
174 public String getCurrencyFormattedTotalAmount() {
175 return (String) new CurrencyFormatter().format(formatProcessSummary.getTotalAmount());
176 }
177
178
179
180
181
182
183 public String getPaymentDate() {
184 return paymentDate;
185 }
186
187
188
189
190
191
192 public void setPaymentDate(String paymentDate) {
193 this.paymentDate = paymentDate;
194 }
195
196
197
198
199
200
201 public FormatProcessSummary getFormatProcessSummary() {
202 return formatProcessSummary;
203 }
204
205
206
207
208
209
210 public void setFormatProcessSummary(FormatProcessSummary formatProcessSummary) {
211 this.formatProcessSummary = formatProcessSummary;
212 }
213
214
215
216
217 @Override
218 public void reset(ActionMapping arg0, HttpServletRequest arg1) {
219 super.reset(arg0, arg1);
220
221 for (CustomerProfile customer : customers) {
222 customer.setSelectedForFormat(false);
223 }
224 }
225 }