1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.pdp.businessobject;
17
18 import java.sql.Timestamp;
19 import java.text.ParseException;
20 import java.util.ArrayList;
21 import java.util.LinkedHashMap;
22 import java.util.List;
23
24 import org.kuali.ole.pdp.PdpPropertyConstants;
25 import org.kuali.ole.sys.OLEPropertyConstants;
26 import org.kuali.ole.sys.context.SpringContext;
27 import org.kuali.rice.core.api.datetime.DateTimeService;
28 import org.kuali.rice.core.api.util.type.KualiDecimal;
29 import org.kuali.rice.core.api.util.type.KualiInteger;
30 import org.kuali.rice.krad.bo.TransientBusinessObjectBase;
31
32
33
34
35 public class PaymentFileLoad extends TransientBusinessObjectBase {
36
37 private String chart;
38 private String unit;
39 private String subUnit;
40 protected Timestamp creationDate;
41
42
43 private int paymentCount;
44 private KualiDecimal paymentTotalAmount;
45
46
47 private List<PaymentGroup> paymentGroups;
48
49
50 private KualiInteger batchId;
51 private boolean fileThreshold;
52 private boolean detailThreshold;
53 private boolean taxEmailRequired;
54
55 private List<PaymentDetail> thresholdPaymentDetails;
56 private CustomerProfile customer;
57
58 private boolean passedValidation;
59
60 public PaymentFileLoad() {
61 super();
62 paymentGroups = new ArrayList<PaymentGroup>();
63 fileThreshold = false;
64 detailThreshold = false;
65 taxEmailRequired = false;
66 passedValidation = false;
67 thresholdPaymentDetails = new ArrayList<PaymentDetail>();
68 }
69
70
71
72
73 public int getActualPaymentCount() {
74 int count = 0;
75
76 for (PaymentGroup paymentGroup : paymentGroups) {
77 for (PaymentDetail paymentDetail : paymentGroup.getPaymentDetails()) {
78 count++;
79 }
80 }
81
82 return count;
83 }
84
85
86
87
88 public KualiDecimal getCalculatedPaymentTotalAmount() {
89 KualiDecimal totalAmount = KualiDecimal.ZERO;
90
91 for (PaymentGroup paymentGroup : paymentGroups) {
92 for (PaymentDetail paymentDetail : paymentGroup.getPaymentDetails()) {
93 totalAmount = totalAmount.add(paymentDetail.getAccountTotal());
94 }
95 }
96
97 return totalAmount;
98 }
99
100
101
102
103
104
105 public String getChart() {
106 return chart;
107 }
108
109
110
111
112
113
114 public void setChart(String chart) {
115 this.chart = chart;
116 }
117
118
119
120
121
122
123 public String getUnit() {
124 return unit;
125 }
126
127
128
129
130
131
132 public void setUnit(String unit) {
133 this.unit = unit;
134 }
135
136
137
138
139
140
141 public String getSubUnit() {
142 return subUnit;
143 }
144
145
146
147
148
149
150 public void setSubUnit(String subUnit) {
151 this.subUnit = subUnit;
152 }
153
154
155
156
157
158
159 public Timestamp getCreationDate() {
160 return creationDate;
161 }
162
163
164
165
166
167
168 public void setCreationDate(Timestamp creationDate) {
169 this.creationDate = creationDate;
170 }
171
172
173
174
175
176
177
178 public void setCreationDate(String creationDate) {
179 try {
180 this.creationDate = SpringContext.getBean(DateTimeService.class).convertToSqlTimestamp(creationDate);
181 }
182 catch (ParseException e) {
183 throw new RuntimeException("Unable to convert create timestamp value " + creationDate + " :" + e.getMessage(), e);
184 }
185 }
186
187
188
189
190
191
192 public int getPaymentCount() {
193 return paymentCount;
194 }
195
196
197
198
199
200
201 public void setPaymentCount(int paymentCount) {
202 this.paymentCount = paymentCount;
203 }
204
205
206
207
208
209
210 public void setPaymentCount(String paymentCount) {
211 this.paymentCount = Integer.parseInt(paymentCount);
212 }
213
214
215
216
217
218
219 public KualiDecimal getPaymentTotalAmount() {
220 return paymentTotalAmount;
221 }
222
223
224
225
226
227
228 public void setPaymentTotalAmount(KualiDecimal paymentTotalAmount) {
229 this.paymentTotalAmount = paymentTotalAmount;
230 }
231
232 public void setPaymentTotalAmount(String paymentTotalAmount) {
233 this.paymentTotalAmount = new KualiDecimal(paymentTotalAmount);
234 }
235
236
237
238
239
240
241 public List<PaymentGroup> getPaymentGroups() {
242 return paymentGroups;
243 }
244
245
246
247
248
249
250 public void setPaymentGroups(List<PaymentGroup> paymentGroups) {
251 this.paymentGroups = paymentGroups;
252 }
253
254
255
256
257
258
259 public void addPaymentGroup(PaymentGroup paymentGroup) {
260 this.paymentGroups.add(paymentGroup);
261 }
262
263
264
265
266
267
268 public boolean isFileThreshold() {
269 return fileThreshold;
270 }
271
272
273
274
275
276
277 public void setFileThreshold(boolean fileThreshold) {
278 this.fileThreshold = fileThreshold;
279 }
280
281
282
283
284
285
286 public boolean isDetailThreshold() {
287 return detailThreshold;
288 }
289
290
291
292
293
294
295 public void setDetailThreshold(boolean detailThreshold) {
296 this.detailThreshold = detailThreshold;
297 }
298
299
300
301
302
303
304
305 public KualiInteger getBatchId() {
306 return batchId;
307 }
308
309
310
311
312
313
314 public void setBatchId(KualiInteger batchId) {
315 this.batchId = batchId;
316 }
317
318
319
320
321
322
323 public boolean isTaxEmailRequired() {
324 return taxEmailRequired;
325 }
326
327
328
329
330
331
332 public void setTaxEmailRequired(boolean taxEmailRequired) {
333 this.taxEmailRequired = taxEmailRequired;
334 }
335
336
337
338
339
340
341 public List<PaymentDetail> getThresholdPaymentDetails() {
342 return thresholdPaymentDetails;
343 }
344
345
346
347
348
349
350 public void setThresholdPaymentDetails(List<PaymentDetail> thresholdPaymentDetails) {
351 this.thresholdPaymentDetails = thresholdPaymentDetails;
352 }
353
354
355
356
357
358
359 public boolean isPassedValidation() {
360 return passedValidation;
361 }
362
363
364
365
366
367
368 public void setPassedValidation(boolean passedValidation) {
369 this.passedValidation = passedValidation;
370 }
371
372
373
374
375
376
377
378 public CustomerProfile getCustomer() {
379 return customer;
380 }
381
382
383
384
385
386
387 public void setCustomer(CustomerProfile customer) {
388 this.customer = customer;
389 }
390
391
392 protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
393 LinkedHashMap m = new LinkedHashMap();
394
395 m.put(OLEPropertyConstants.CHART, this.chart);
396 m.put(PdpPropertyConstants.UNIT, this.unit);
397 m.put(PdpPropertyConstants.SUB_UNIT, this.subUnit);
398 m.put(PdpPropertyConstants.CREATION_DATE, this.creationDate);
399
400 return m;
401 }
402
403 }