1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.ole.fp.businessobject;
18
19 import java.util.LinkedHashMap;
20
21 import org.kuali.ole.sys.OLEConstants;
22 import org.kuali.ole.sys.OLEPropertyConstants;
23 import org.kuali.rice.core.api.util.type.KualiDecimal;
24 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
25
26
27
28
29 public class CoinDetail extends PersistableBusinessObjectBase {
30
31 private String documentNumber;
32 private String financialDocumentTypeCode;
33 private String cashieringStatus;
34 private KualiDecimal financialDocumentFiftyCentAmount;
35 private KualiDecimal financialDocumentTwentyFiveCentAmount;
36 private KualiDecimal financialDocumentTenCentAmount;
37 private KualiDecimal financialDocumentFiveCentAmount;
38 private KualiDecimal financialDocumentOneCentAmount;
39 private KualiDecimal financialDocumentOtherCentAmount;
40 private KualiDecimal financialDocumentHundredCentAmount;
41
42
43
44
45 public CoinDetail() {
46 }
47
48
49
50
51
52
53 public String getDocumentNumber() {
54 return documentNumber;
55 }
56
57
58
59
60
61
62 public void setDocumentNumber(String documentNumber) {
63 this.documentNumber = documentNumber;
64 }
65
66
67
68
69
70
71
72 public String getFinancialDocumentTypeCode() {
73 return financialDocumentTypeCode;
74 }
75
76
77
78
79
80
81 public void setFinancialDocumentTypeCode(String financialDocumentTypeCode) {
82 this.financialDocumentTypeCode = financialDocumentTypeCode;
83 }
84
85
86
87
88
89
90
91 public String getCashieringStatus() {
92 return cashieringStatus;
93 }
94
95
96
97
98
99
100 public void setCashieringStatus(String financialDocumentColumnTypeCode) {
101 this.cashieringStatus = financialDocumentColumnTypeCode;
102 }
103
104
105
106
107
108
109 public KualiDecimal getFinancialDocumentFiftyCentAmount() {
110 return financialDocumentFiftyCentAmount;
111 }
112
113
114
115
116
117
118 public void setFinancialDocumentFiftyCentAmount(KualiDecimal financialDocumentFiftyCentAmount) {
119 this.financialDocumentFiftyCentAmount = financialDocumentFiftyCentAmount;
120 }
121
122
123
124
125
126
127 public Integer getFiftyCentCount() {
128 return (financialDocumentFiftyCentAmount == null) ? new Integer(0) : new Integer(financialDocumentFiftyCentAmount.divide(OLEConstants.CoinTypeAmounts.FIFTY_CENT_AMOUNT).intValue());
129 }
130
131
132
133
134
135
136
137 public void setFiftyCentCount(Integer count) {
138 if (count != null) {
139 financialDocumentFiftyCentAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CoinTypeAmounts.FIFTY_CENT_AMOUNT);
140 }
141 }
142
143
144
145
146
147
148 public KualiDecimal getFinancialDocumentTwentyFiveCentAmount() {
149 return financialDocumentTwentyFiveCentAmount;
150 }
151
152
153
154
155
156
157 public void setFinancialDocumentTwentyFiveCentAmount(KualiDecimal financialDocumentTwentyFiveCentAmount) {
158 this.financialDocumentTwentyFiveCentAmount = financialDocumentTwentyFiveCentAmount;
159 }
160
161
162
163
164
165
166 public Integer getTwentyFiveCentCount() {
167 return (financialDocumentTwentyFiveCentAmount == null) ? new Integer(0) : new Integer(financialDocumentTwentyFiveCentAmount.divide(OLEConstants.CoinTypeAmounts.TWENTY_FIVE_CENT_AMOUNT).intValue());
168 }
169
170
171
172
173
174
175 public void setTwentyFiveCentCount(Integer count) {
176 if (count != null) {
177 financialDocumentTwentyFiveCentAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CoinTypeAmounts.TWENTY_FIVE_CENT_AMOUNT);
178 }
179 }
180
181
182
183
184
185
186 public KualiDecimal getFinancialDocumentTenCentAmount() {
187 return financialDocumentTenCentAmount;
188 }
189
190
191
192
193
194
195 public void setFinancialDocumentTenCentAmount(KualiDecimal financialDocumentTenCentAmount) {
196 this.financialDocumentTenCentAmount = financialDocumentTenCentAmount;
197 }
198
199
200
201
202
203
204 public Integer getTenCentCount() {
205 return (financialDocumentTenCentAmount == null) ? new Integer(0) : new Integer(financialDocumentTenCentAmount.divide(OLEConstants.CoinTypeAmounts.TEN_CENT_AMOUNT).intValue());
206 }
207
208
209
210
211
212
213 public void setTenCentCount(Integer count) {
214 if (count != null) {
215 financialDocumentTenCentAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CoinTypeAmounts.TEN_CENT_AMOUNT);
216 }
217 }
218
219
220
221
222
223
224 public KualiDecimal getFinancialDocumentFiveCentAmount() {
225 return financialDocumentFiveCentAmount;
226 }
227
228
229
230
231
232
233 public void setFinancialDocumentFiveCentAmount(KualiDecimal financialDocumentFiveCentAmount) {
234 this.financialDocumentFiveCentAmount = financialDocumentFiveCentAmount;
235 }
236
237
238
239
240
241
242 public Integer getFiveCentCount() {
243 return (financialDocumentFiveCentAmount == null) ? new Integer(0) : new Integer(financialDocumentFiveCentAmount.divide(OLEConstants.CoinTypeAmounts.FIVE_CENT_AMOUNT).intValue());
244 }
245
246
247
248
249
250
251 public void setFiveCentCount(Integer count) {
252 if (count != null) {
253 financialDocumentFiveCentAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CoinTypeAmounts.FIVE_CENT_AMOUNT);
254 }
255 }
256
257
258
259
260
261
262 public KualiDecimal getFinancialDocumentOneCentAmount() {
263 return financialDocumentOneCentAmount;
264 }
265
266
267
268
269
270
271 public void setFinancialDocumentOneCentAmount(KualiDecimal financialDocumentOneCentAmount) {
272 this.financialDocumentOneCentAmount = financialDocumentOneCentAmount;
273 }
274
275
276
277
278
279
280 public Integer getOneCentCount() {
281 return (financialDocumentOneCentAmount == null) ? new Integer(0) : new Integer(financialDocumentOneCentAmount.divide(OLEConstants.CoinTypeAmounts.ONE_CENT_AMOUNT).intValue());
282 }
283
284
285
286
287
288
289 public void setOneCentCount(Integer count) {
290 if (count != null) {
291 financialDocumentOneCentAmount = new KualiDecimal(count).multiply(OLEConstants.CoinTypeAmounts.ONE_CENT_AMOUNT);
292 }
293 }
294
295
296
297
298
299
300 public KualiDecimal getFinancialDocumentOtherCentAmount() {
301 return financialDocumentOtherCentAmount;
302 }
303
304
305
306
307
308
309 public void setFinancialDocumentOtherCentAmount(KualiDecimal financialDocumentOtherCentAmount) {
310 this.financialDocumentOtherCentAmount = financialDocumentOtherCentAmount;
311 }
312
313
314
315
316
317
318
319 public KualiDecimal getFinancialDocumentHundredCentAmount() {
320 return financialDocumentHundredCentAmount;
321 }
322
323
324
325
326
327
328 public void setFinancialDocumentHundredCentAmount(KualiDecimal financialDocumentHundredCentAmount) {
329 this.financialDocumentHundredCentAmount = financialDocumentHundredCentAmount;
330 }
331
332
333
334
335
336
337 public Integer getHundredCentCount() {
338 return (financialDocumentHundredCentAmount == null) ? new Integer(0) : new Integer(financialDocumentHundredCentAmount.divide(OLEConstants.CoinTypeAmounts.HUNDRED_CENT_AMOUNT).intValue());
339 }
340
341
342
343
344
345
346 public void setHundredCentCount(Integer count) {
347 if (count != null) {
348 financialDocumentHundredCentAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CoinTypeAmounts.HUNDRED_CENT_AMOUNT);
349 }
350 }
351
352
353
354
355
356
357 public KualiDecimal getTotalAmount() {
358 KualiDecimal result = KualiDecimal.ZERO;
359 if (this.financialDocumentHundredCentAmount != null) {
360 result = result.add(this.financialDocumentHundredCentAmount);
361 }
362 if (this.financialDocumentFiftyCentAmount != null) {
363 result = result.add(this.financialDocumentFiftyCentAmount);
364 }
365 if (this.financialDocumentTwentyFiveCentAmount != null) {
366 result = result.add(this.financialDocumentTwentyFiveCentAmount);
367 }
368 if (this.financialDocumentTenCentAmount != null) {
369 result = result.add(this.financialDocumentTenCentAmount);
370 }
371 if (this.financialDocumentFiveCentAmount != null) {
372 result = result.add(this.financialDocumentFiveCentAmount);
373 }
374 if (this.financialDocumentOneCentAmount != null) {
375 result = result.add(this.financialDocumentOneCentAmount);
376 }
377 if (this.financialDocumentOtherCentAmount != null) {
378 result = result.add(this.financialDocumentOtherCentAmount);
379 }
380 return result;
381 }
382
383
384
385
386 public void zeroOutAmounts() {
387 this.financialDocumentHundredCentAmount = KualiDecimal.ZERO;
388 this.financialDocumentFiftyCentAmount = KualiDecimal.ZERO;
389 this.financialDocumentTwentyFiveCentAmount = KualiDecimal.ZERO;
390 this.financialDocumentTenCentAmount = KualiDecimal.ZERO;
391 this.financialDocumentFiveCentAmount = KualiDecimal.ZERO;
392 this.financialDocumentOneCentAmount = KualiDecimal.ZERO;
393 this.financialDocumentOtherCentAmount = KualiDecimal.ZERO;
394 }
395
396
397
398
399 public void zeroOutUnpopulatedAmounts() {
400 if (this.financialDocumentHundredCentAmount == null) {
401 this.financialDocumentHundredCentAmount = KualiDecimal.ZERO;
402 }
403 if (this.financialDocumentFiftyCentAmount == null) {
404 this.financialDocumentFiftyCentAmount = KualiDecimal.ZERO;
405 }
406 if (this.financialDocumentTwentyFiveCentAmount == null) {
407 this.financialDocumentTwentyFiveCentAmount = KualiDecimal.ZERO;
408 }
409 if (this.financialDocumentTenCentAmount == null) {
410 this.financialDocumentTenCentAmount = KualiDecimal.ZERO;
411 }
412 if (this.financialDocumentFiveCentAmount == null) {
413 this.financialDocumentFiveCentAmount = KualiDecimal.ZERO;
414 }
415 if (this.financialDocumentOneCentAmount == null) {
416 this.financialDocumentOneCentAmount = KualiDecimal.ZERO;
417 }
418 if (this.financialDocumentOtherCentAmount == null) {
419 this.financialDocumentOtherCentAmount = KualiDecimal.ZERO;
420 }
421 }
422
423 public void add(CoinDetail detail) {
424 if (detail.financialDocumentHundredCentAmount != null) {
425 if (this.financialDocumentHundredCentAmount == null) {
426 this.financialDocumentHundredCentAmount = KualiDecimal.ZERO.add(detail.financialDocumentHundredCentAmount);
427 }
428 else {
429 this.financialDocumentHundredCentAmount = this.financialDocumentHundredCentAmount.add(detail.financialDocumentHundredCentAmount);
430 }
431 }
432 if (detail.financialDocumentFiftyCentAmount != null) {
433 if (this.financialDocumentFiftyCentAmount == null) {
434 this.financialDocumentFiftyCentAmount = KualiDecimal.ZERO.add(detail.financialDocumentFiftyCentAmount);
435 }
436 else {
437 this.financialDocumentFiftyCentAmount = this.financialDocumentFiftyCentAmount.add(detail.financialDocumentFiftyCentAmount);
438 }
439 }
440 if (detail.financialDocumentTwentyFiveCentAmount != null) {
441 if (this.financialDocumentTwentyFiveCentAmount == null) {
442 this.financialDocumentTwentyFiveCentAmount = KualiDecimal.ZERO.add(detail.financialDocumentTwentyFiveCentAmount);
443 }
444 else {
445 this.financialDocumentTwentyFiveCentAmount = this.financialDocumentTwentyFiveCentAmount.add(detail.financialDocumentTwentyFiveCentAmount);
446 }
447 }
448 if (detail.financialDocumentTenCentAmount != null) {
449 if (this.financialDocumentTenCentAmount == null) {
450 this.financialDocumentTenCentAmount = KualiDecimal.ZERO.add(detail.financialDocumentTenCentAmount);
451 }
452 else {
453 this.financialDocumentTenCentAmount = this.financialDocumentTenCentAmount.add(detail.financialDocumentTenCentAmount);
454 }
455 }
456 if (detail.financialDocumentFiveCentAmount != null) {
457 if (this.financialDocumentFiveCentAmount == null) {
458 this.financialDocumentFiveCentAmount = KualiDecimal.ZERO.add(detail.financialDocumentFiveCentAmount);
459 }
460 else {
461 this.financialDocumentFiveCentAmount = this.financialDocumentFiveCentAmount.add(detail.financialDocumentFiveCentAmount);
462 }
463 }
464 if (detail.financialDocumentOneCentAmount != null) {
465 if (this.financialDocumentOneCentAmount == null) {
466 this.financialDocumentOneCentAmount = KualiDecimal.ZERO.add(detail.financialDocumentOneCentAmount);
467 }
468 else {
469 this.financialDocumentOneCentAmount = this.financialDocumentOneCentAmount.add(detail.financialDocumentOneCentAmount);
470 }
471 }
472 if (detail.financialDocumentOtherCentAmount != null) {
473 if (this.financialDocumentOtherCentAmount == null) {
474 this.financialDocumentOtherCentAmount = KualiDecimal.ZERO.add(detail.financialDocumentOtherCentAmount);
475 }
476 else {
477 this.financialDocumentOtherCentAmount = this.financialDocumentOtherCentAmount.add(detail.financialDocumentOtherCentAmount);
478 }
479 }
480 }
481
482 public void subtract(CoinDetail detail) {
483 if (detail.financialDocumentHundredCentAmount != null) {
484 if (this.financialDocumentHundredCentAmount == null) {
485 this.financialDocumentHundredCentAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentHundredCentAmount);
486 }
487 else {
488 this.financialDocumentHundredCentAmount = this.financialDocumentHundredCentAmount.subtract(detail.financialDocumentHundredCentAmount);
489 }
490 }
491 if (detail.financialDocumentFiftyCentAmount != null) {
492 if (this.financialDocumentFiftyCentAmount == null) {
493 this.financialDocumentFiftyCentAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentFiftyCentAmount);
494 }
495 else {
496 this.financialDocumentFiftyCentAmount = this.financialDocumentFiftyCentAmount.subtract(detail.financialDocumentFiftyCentAmount);
497 }
498 }
499 if (detail.financialDocumentTwentyFiveCentAmount != null) {
500 if (this.financialDocumentTwentyFiveCentAmount == null) {
501 this.financialDocumentTwentyFiveCentAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentTwentyFiveCentAmount);
502 }
503 else {
504 this.financialDocumentTwentyFiveCentAmount = this.financialDocumentTwentyFiveCentAmount.subtract(detail.financialDocumentTwentyFiveCentAmount);
505 }
506 }
507 if (detail.financialDocumentTenCentAmount != null) {
508 if (this.financialDocumentTenCentAmount == null) {
509 this.financialDocumentTenCentAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentTenCentAmount);
510 }
511 else {
512 this.financialDocumentTenCentAmount = this.financialDocumentTenCentAmount.subtract(detail.financialDocumentTenCentAmount);
513 }
514 }
515 if (detail.financialDocumentFiveCentAmount != null) {
516 if (this.financialDocumentFiveCentAmount == null) {
517 this.financialDocumentFiveCentAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentFiveCentAmount);
518 }
519 else {
520 this.financialDocumentFiveCentAmount = this.financialDocumentFiveCentAmount.subtract(detail.financialDocumentFiveCentAmount);
521 }
522 }
523 if (detail.financialDocumentOneCentAmount != null) {
524 if (this.financialDocumentOneCentAmount == null) {
525 this.financialDocumentOneCentAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentOneCentAmount);
526 }
527 else {
528 this.financialDocumentOneCentAmount = this.financialDocumentOneCentAmount.subtract(detail.financialDocumentOneCentAmount);
529 }
530 }
531 if (detail.financialDocumentOtherCentAmount != null) {
532 if (this.financialDocumentOtherCentAmount == null) {
533 this.financialDocumentOtherCentAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentOtherCentAmount);
534 }
535 else {
536 this.financialDocumentOtherCentAmount = this.financialDocumentOtherCentAmount.subtract(detail.financialDocumentOtherCentAmount);
537 }
538 }
539 }
540
541
542
543
544
545
546 public boolean isEmpty() {
547 return ((this.financialDocumentHundredCentAmount == null || this.financialDocumentHundredCentAmount.equals(KualiDecimal.ZERO)) && (this.financialDocumentFiftyCentAmount == null || this.financialDocumentFiftyCentAmount.equals(KualiDecimal.ZERO)) && (this.financialDocumentTwentyFiveCentAmount == null || this.financialDocumentTwentyFiveCentAmount.equals(KualiDecimal.ZERO)) && (this.financialDocumentTenCentAmount == null || this.financialDocumentTenCentAmount.equals(KualiDecimal.ZERO)) && (this.financialDocumentFiveCentAmount == null || this.financialDocumentFiveCentAmount.equals(KualiDecimal.ZERO)) && (this.financialDocumentOneCentAmount == null || this.financialDocumentOneCentAmount.equals(KualiDecimal.ZERO)) && (this.financialDocumentOtherCentAmount == null || this.financialDocumentOtherCentAmount.equals(KualiDecimal.ZERO)));
548 }
549
550
551
552
553 protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
554 LinkedHashMap m = new LinkedHashMap();
555 m.put(OLEPropertyConstants.DOCUMENT_NUMBER, this.documentNumber);
556 m.put("financialDocumentTypeCode", this.financialDocumentTypeCode);
557 m.put("cashieringStatus", this.cashieringStatus);
558 return m;
559 }
560 }