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 CurrencyDetail extends PersistableBusinessObjectBase {
30
31 private String documentNumber;
32 private String financialDocumentTypeCode;
33 private String cashieringStatus;
34 private KualiDecimal financialDocumentHundredDollarAmount;
35 private KualiDecimal financialDocumentFiftyDollarAmount;
36 private KualiDecimal financialDocumentTwentyDollarAmount;
37 private KualiDecimal financialDocumentTenDollarAmount;
38 private KualiDecimal financialDocumentFiveDollarAmount;
39 private KualiDecimal financialDocumentTwoDollarAmount;
40 private KualiDecimal financialDocumentOneDollarAmount;
41 private KualiDecimal financialDocumentOtherDollarAmount;
42
43
44
45
46 public CurrencyDetail() {
47
48 }
49
50
51
52
53
54
55 public String getDocumentNumber() {
56 return documentNumber;
57 }
58
59
60
61
62
63
64 public void setDocumentNumber(String documentNumber) {
65 this.documentNumber = documentNumber;
66 }
67
68
69
70
71
72
73
74 public String getFinancialDocumentTypeCode() {
75 return financialDocumentTypeCode;
76 }
77
78
79
80
81
82
83 public void setFinancialDocumentTypeCode(String financialDocumentTypeCode) {
84 this.financialDocumentTypeCode = financialDocumentTypeCode;
85 }
86
87
88
89
90
91
92
93 public String getCashieringStatus() {
94 return cashieringStatus;
95 }
96
97
98
99
100
101
102 public void setCashieringStatus(String financialDocumentColumnTypeCode) {
103 this.cashieringStatus = financialDocumentColumnTypeCode;
104 }
105
106
107
108
109
110
111
112 public KualiDecimal getFinancialDocumentHundredDollarAmount() {
113 return financialDocumentHundredDollarAmount;
114 }
115
116
117
118
119
120
121 public void setFinancialDocumentHundredDollarAmount(KualiDecimal financialDocumentHundredDollarAmount) {
122 this.financialDocumentHundredDollarAmount = financialDocumentHundredDollarAmount;
123 }
124
125
126
127
128
129
130 public Integer getHundredDollarCount() {
131 return (financialDocumentHundredDollarAmount == null) ? new Integer(0) : new Integer(financialDocumentHundredDollarAmount.divide(OLEConstants.CurrencyTypeAmounts.HUNDRED_DOLLAR_AMOUNT).intValue());
132 }
133
134
135
136
137
138
139 public void setHundredDollarCount(Integer count) {
140 if (count != null) {
141 this.financialDocumentHundredDollarAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CurrencyTypeAmounts.HUNDRED_DOLLAR_AMOUNT);
142 }
143 }
144
145
146
147
148
149
150 public KualiDecimal getFinancialDocumentFiftyDollarAmount() {
151 return financialDocumentFiftyDollarAmount;
152 }
153
154
155
156
157
158
159 public void setFinancialDocumentFiftyDollarAmount(KualiDecimal financialDocumentFiftyDollarAmount) {
160 this.financialDocumentFiftyDollarAmount = financialDocumentFiftyDollarAmount;
161 }
162
163
164
165
166
167
168 public Integer getFiftyDollarCount() {
169 return (financialDocumentFiftyDollarAmount == null) ? new Integer(0) : new Integer(financialDocumentFiftyDollarAmount.divide(OLEConstants.CurrencyTypeAmounts.FIFTY_DOLLAR_AMOUNT).intValue());
170 }
171
172
173
174
175
176
177 public void setFiftyDollarCount(Integer count) {
178 if (count != null) {
179 this.financialDocumentFiftyDollarAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CurrencyTypeAmounts.FIFTY_DOLLAR_AMOUNT);
180 }
181 }
182
183
184
185
186
187
188 public KualiDecimal getFinancialDocumentTwentyDollarAmount() {
189 return financialDocumentTwentyDollarAmount;
190 }
191
192
193
194
195
196
197 public void setFinancialDocumentTwentyDollarAmount(KualiDecimal financialDocumentTwentyDollarAmount) {
198 this.financialDocumentTwentyDollarAmount = financialDocumentTwentyDollarAmount;
199 }
200
201
202
203
204
205
206 public Integer getTwentyDollarCount() {
207 return (financialDocumentTwentyDollarAmount == null) ? new Integer(0) : new Integer(financialDocumentTwentyDollarAmount.divide(OLEConstants.CurrencyTypeAmounts.TWENTY_DOLLAR_AMOUNT).intValue());
208 }
209
210
211
212
213
214
215 public void setTwentyDollarCount(Integer count) {
216 if (count != null) {
217 this.financialDocumentTwentyDollarAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CurrencyTypeAmounts.TWENTY_DOLLAR_AMOUNT);
218 }
219 }
220
221
222
223
224
225
226 public KualiDecimal getFinancialDocumentTenDollarAmount() {
227 return financialDocumentTenDollarAmount;
228 }
229
230
231
232
233
234
235 public void setFinancialDocumentTenDollarAmount(KualiDecimal financialDocumentTenDollarAmount) {
236 this.financialDocumentTenDollarAmount = financialDocumentTenDollarAmount;
237 }
238
239
240
241
242
243
244 public Integer getTenDollarCount() {
245 return (financialDocumentTenDollarAmount == null) ? new Integer(0) : new Integer(financialDocumentTenDollarAmount.divide(OLEConstants.CurrencyTypeAmounts.TEN_DOLLAR_AMOUNT).intValue());
246 }
247
248
249
250
251
252
253 public void setTenDollarCount(Integer count) {
254 if (count != null) {
255 this.financialDocumentTenDollarAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CurrencyTypeAmounts.TEN_DOLLAR_AMOUNT);
256 }
257 }
258
259
260
261
262
263
264 public KualiDecimal getFinancialDocumentFiveDollarAmount() {
265 return financialDocumentFiveDollarAmount;
266 }
267
268
269
270
271
272
273 public void setFinancialDocumentFiveDollarAmount(KualiDecimal financialDocumentFiveDollarAmount) {
274 this.financialDocumentFiveDollarAmount = financialDocumentFiveDollarAmount;
275 }
276
277
278
279
280
281
282 public Integer getFiveDollarCount() {
283 return (financialDocumentFiveDollarAmount == null) ? new Integer(0) : new Integer(financialDocumentFiveDollarAmount.divide(OLEConstants.CurrencyTypeAmounts.FIVE_DOLLAR_AMOUNT).intValue());
284 }
285
286
287
288
289
290
291 public void setFiveDollarCount(Integer count) {
292 if (count != null) {
293 this.financialDocumentFiveDollarAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CurrencyTypeAmounts.FIVE_DOLLAR_AMOUNT);
294 }
295 }
296
297
298
299
300
301
302 public KualiDecimal getFinancialDocumentTwoDollarAmount() {
303 return financialDocumentTwoDollarAmount;
304 }
305
306
307
308
309
310
311 public void setFinancialDocumentTwoDollarAmount(KualiDecimal financialDocumentTwoDollarAmount) {
312 this.financialDocumentTwoDollarAmount = financialDocumentTwoDollarAmount;
313 }
314
315
316
317
318
319
320 public Integer getTwoDollarCount() {
321 return (financialDocumentTwoDollarAmount == null) ? new Integer(0) : new Integer(financialDocumentTwoDollarAmount.divide(OLEConstants.CurrencyTypeAmounts.TWO_DOLLAR_AMOUNT).intValue());
322 }
323
324
325
326
327
328
329 public void setTwoDollarCount(Integer count) {
330 if (count != null) {
331 this.financialDocumentTwoDollarAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CurrencyTypeAmounts.TWO_DOLLAR_AMOUNT);
332 }
333 }
334
335
336
337
338
339
340 public KualiDecimal getFinancialDocumentOneDollarAmount() {
341 return financialDocumentOneDollarAmount;
342 }
343
344
345
346
347
348
349 public void setFinancialDocumentOneDollarAmount(KualiDecimal financialDocumentOneDollarAmount) {
350 this.financialDocumentOneDollarAmount = financialDocumentOneDollarAmount;
351 }
352
353
354
355
356
357
358 public Integer getOneDollarCount() {
359 return (financialDocumentOneDollarAmount == null) ? new Integer(0) : new Integer(financialDocumentOneDollarAmount.divide(OLEConstants.CurrencyTypeAmounts.ONE_DOLLAR_AMOUNT).intValue());
360 }
361
362
363
364
365
366
367 public void setOneDollarCount(Integer count) {
368 if (count != null) {
369 this.financialDocumentOneDollarAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CurrencyTypeAmounts.ONE_DOLLAR_AMOUNT);
370 }
371 }
372
373
374
375
376
377
378 public KualiDecimal getFinancialDocumentOtherDollarAmount() {
379 return financialDocumentOtherDollarAmount;
380 }
381
382
383
384
385
386
387 public void setFinancialDocumentOtherDollarAmount(KualiDecimal financialDocumentOtherDollarAmount) {
388 this.financialDocumentOtherDollarAmount = financialDocumentOtherDollarAmount;
389 }
390
391
392
393
394
395
396 public KualiDecimal getTotalAmount() {
397 KualiDecimal result = KualiDecimal.ZERO;
398 if (this.financialDocumentHundredDollarAmount != null) {
399 result = result.add(this.financialDocumentHundredDollarAmount);
400 }
401 if (this.financialDocumentFiftyDollarAmount != null) {
402 result = result.add(this.financialDocumentFiftyDollarAmount);
403 }
404 if (this.financialDocumentTwentyDollarAmount != null) {
405 result = result.add(this.financialDocumentTwentyDollarAmount);
406 }
407 if (this.financialDocumentTenDollarAmount != null) {
408 result = result.add(this.financialDocumentTenDollarAmount);
409 }
410 if (this.financialDocumentFiveDollarAmount != null) {
411 result = result.add(this.financialDocumentFiveDollarAmount);
412 }
413 if (this.financialDocumentTwoDollarAmount != null) {
414 result = result.add(this.financialDocumentTwoDollarAmount);
415 }
416 if (this.financialDocumentOneDollarAmount != null) {
417 result = result.add(this.financialDocumentOneDollarAmount);
418 }
419 if (this.financialDocumentOtherDollarAmount != null) {
420 result = result.add(this.financialDocumentOtherDollarAmount);
421 }
422 return result;
423 }
424
425
426
427
428 public void zeroOutAmounts() {
429 this.financialDocumentHundredDollarAmount = KualiDecimal.ZERO;
430 this.financialDocumentFiftyDollarAmount = KualiDecimal.ZERO;
431 this.financialDocumentTwentyDollarAmount = KualiDecimal.ZERO;
432 this.financialDocumentTenDollarAmount = KualiDecimal.ZERO;
433 this.financialDocumentFiveDollarAmount = KualiDecimal.ZERO;
434 this.financialDocumentTwoDollarAmount = KualiDecimal.ZERO;
435 this.financialDocumentOneDollarAmount = KualiDecimal.ZERO;
436 this.financialDocumentOtherDollarAmount = KualiDecimal.ZERO;
437 }
438
439
440
441
442 public void zeroOutUnpopulatedAmounts() {
443 if (financialDocumentHundredDollarAmount == null) {
444 this.financialDocumentHundredDollarAmount = KualiDecimal.ZERO;
445 }
446 if (financialDocumentFiftyDollarAmount == null) {
447 this.financialDocumentFiftyDollarAmount = KualiDecimal.ZERO;
448 }
449 if (financialDocumentTwentyDollarAmount == null) {
450 this.financialDocumentTwentyDollarAmount = KualiDecimal.ZERO;
451 }
452 if (financialDocumentTenDollarAmount == null) {
453 this.financialDocumentTenDollarAmount = KualiDecimal.ZERO;
454 }
455 if (financialDocumentFiveDollarAmount == null) {
456 this.financialDocumentFiveDollarAmount = KualiDecimal.ZERO;
457 }
458 if (financialDocumentTwoDollarAmount == null) {
459 this.financialDocumentTwoDollarAmount = KualiDecimal.ZERO;
460 }
461 if (financialDocumentOneDollarAmount == null) {
462 this.financialDocumentOneDollarAmount = KualiDecimal.ZERO;
463 }
464 if (financialDocumentOtherDollarAmount == null) {
465 this.financialDocumentOtherDollarAmount = KualiDecimal.ZERO;
466 }
467 }
468
469
470
471
472
473
474 public void add(CurrencyDetail detail) {
475 if (detail.financialDocumentHundredDollarAmount != null) {
476 if (this.financialDocumentHundredDollarAmount == null) {
477 this.financialDocumentHundredDollarAmount = KualiDecimal.ZERO.add(detail.financialDocumentHundredDollarAmount);
478 }
479 else {
480 this.financialDocumentHundredDollarAmount = this.financialDocumentHundredDollarAmount.add(detail.financialDocumentHundredDollarAmount);
481 }
482 }
483 if (detail.financialDocumentFiftyDollarAmount != null) {
484 if (this.financialDocumentFiftyDollarAmount == null) {
485 this.financialDocumentFiftyDollarAmount = KualiDecimal.ZERO.add(detail.financialDocumentFiftyDollarAmount);
486 }
487 else {
488 this.financialDocumentFiftyDollarAmount = this.financialDocumentFiftyDollarAmount.add(detail.financialDocumentFiftyDollarAmount);
489 }
490 }
491 if (detail.financialDocumentTwentyDollarAmount != null) {
492 if (this.financialDocumentTwentyDollarAmount == null) {
493 this.financialDocumentTwentyDollarAmount = KualiDecimal.ZERO.add(detail.financialDocumentTwentyDollarAmount);
494 }
495 else {
496 this.financialDocumentTwentyDollarAmount = this.financialDocumentTwentyDollarAmount.add(detail.financialDocumentTwentyDollarAmount);
497 }
498 }
499 if (detail.financialDocumentTenDollarAmount != null) {
500 if (this.financialDocumentTenDollarAmount == null) {
501 this.financialDocumentTenDollarAmount = KualiDecimal.ZERO.add(detail.financialDocumentTenDollarAmount);
502 }
503 else {
504 this.financialDocumentTenDollarAmount = this.financialDocumentTenDollarAmount.add(detail.financialDocumentTenDollarAmount);
505 }
506 }
507 if (detail.financialDocumentFiveDollarAmount != null) {
508 if (this.financialDocumentFiveDollarAmount == null) {
509 this.financialDocumentFiveDollarAmount = KualiDecimal.ZERO.add(detail.financialDocumentFiveDollarAmount);
510 }
511 else {
512 this.financialDocumentFiveDollarAmount = this.financialDocumentFiveDollarAmount.add(detail.financialDocumentFiveDollarAmount);
513 }
514 }
515 if (detail.financialDocumentTwoDollarAmount != null) {
516 if (this.financialDocumentTwoDollarAmount == null) {
517 this.financialDocumentTwoDollarAmount = KualiDecimal.ZERO.add(detail.financialDocumentTwoDollarAmount);
518 }
519 else {
520 this.financialDocumentTwoDollarAmount = this.financialDocumentTwoDollarAmount.add(detail.financialDocumentTwoDollarAmount);
521 }
522 }
523 if (detail.financialDocumentOneDollarAmount != null) {
524 if (this.financialDocumentOneDollarAmount == null) {
525 this.financialDocumentOneDollarAmount = KualiDecimal.ZERO.add(detail.financialDocumentOneDollarAmount);
526 }
527 else {
528 this.financialDocumentOneDollarAmount = this.financialDocumentOneDollarAmount.add(detail.financialDocumentOneDollarAmount);
529 }
530 }
531 if (detail.financialDocumentOtherDollarAmount != null) {
532 if (this.financialDocumentOtherDollarAmount == null) {
533 this.financialDocumentOtherDollarAmount = KualiDecimal.ZERO.add(detail.financialDocumentOtherDollarAmount);
534 }
535 else {
536 this.financialDocumentOtherDollarAmount = this.financialDocumentOtherDollarAmount.add(detail.financialDocumentOtherDollarAmount);
537 }
538 }
539 }
540
541
542
543
544
545
546 public void subtract(CurrencyDetail detail) {
547 if (detail.financialDocumentHundredDollarAmount != null) {
548 if (this.financialDocumentHundredDollarAmount == null) {
549 this.financialDocumentHundredDollarAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentHundredDollarAmount);
550 }
551 else {
552 this.financialDocumentHundredDollarAmount = this.financialDocumentHundredDollarAmount.subtract(detail.financialDocumentHundredDollarAmount);
553 }
554 }
555 if (detail.financialDocumentFiftyDollarAmount != null) {
556 if (this.financialDocumentFiftyDollarAmount == null) {
557 this.financialDocumentFiftyDollarAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentFiftyDollarAmount);
558 }
559 else {
560 this.financialDocumentFiftyDollarAmount = this.financialDocumentFiftyDollarAmount.subtract(detail.financialDocumentFiftyDollarAmount);
561 }
562 }
563 if (detail.financialDocumentTwentyDollarAmount != null) {
564 if (this.financialDocumentTwentyDollarAmount == null) {
565 this.financialDocumentTwentyDollarAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentTwentyDollarAmount);
566 }
567 else {
568 this.financialDocumentTwentyDollarAmount = this.financialDocumentTwentyDollarAmount.subtract(detail.financialDocumentTwentyDollarAmount);
569 }
570 }
571 if (detail.financialDocumentTenDollarAmount != null) {
572 if (this.financialDocumentTenDollarAmount == null) {
573 this.financialDocumentTenDollarAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentTenDollarAmount);
574 }
575 else {
576 this.financialDocumentTenDollarAmount = this.financialDocumentTenDollarAmount.subtract(detail.financialDocumentTenDollarAmount);
577 }
578 }
579 if (detail.financialDocumentFiveDollarAmount != null) {
580 if (this.financialDocumentFiveDollarAmount == null) {
581 this.financialDocumentFiveDollarAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentFiveDollarAmount);
582 }
583 else {
584 this.financialDocumentFiveDollarAmount = this.financialDocumentFiveDollarAmount.subtract(detail.financialDocumentFiveDollarAmount);
585 }
586 }
587 if (detail.financialDocumentTwoDollarAmount != null) {
588 if (this.financialDocumentTwoDollarAmount == null) {
589 this.financialDocumentTwoDollarAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentTwoDollarAmount);
590 }
591 else {
592 this.financialDocumentTwoDollarAmount = this.financialDocumentTwoDollarAmount.subtract(detail.financialDocumentTwoDollarAmount);
593 }
594 }
595 if (detail.financialDocumentOneDollarAmount != null) {
596 if (this.financialDocumentOneDollarAmount == null) {
597 this.financialDocumentOneDollarAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentOneDollarAmount);
598 }
599 else {
600 this.financialDocumentOneDollarAmount = this.financialDocumentOneDollarAmount.subtract(detail.financialDocumentOneDollarAmount);
601 }
602 }
603 if (detail.financialDocumentOtherDollarAmount != null) {
604 if (this.financialDocumentOtherDollarAmount == null) {
605 this.financialDocumentOtherDollarAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentOtherDollarAmount);
606 }
607 else {
608 this.financialDocumentOtherDollarAmount = this.financialDocumentOtherDollarAmount.subtract(detail.financialDocumentOtherDollarAmount);
609 }
610 }
611 }
612
613
614
615
616
617
618 public boolean isEmpty() {
619 return ((this.financialDocumentHundredDollarAmount == null || this.financialDocumentHundredDollarAmount.equals(KualiDecimal.ZERO)) && (this.financialDocumentFiftyDollarAmount == null || this.financialDocumentFiftyDollarAmount.equals(KualiDecimal.ZERO)) && (this.financialDocumentTwentyDollarAmount == null || this.financialDocumentTwentyDollarAmount.equals(KualiDecimal.ZERO)) && (this.financialDocumentTenDollarAmount == null || this.financialDocumentTenDollarAmount.equals(KualiDecimal.ZERO)) && (this.financialDocumentFiveDollarAmount == null || this.financialDocumentFiveDollarAmount.equals(KualiDecimal.ZERO)) && (this.financialDocumentTwoDollarAmount == null || this.financialDocumentTwoDollarAmount.equals(KualiDecimal.ZERO)) && (this.financialDocumentOneDollarAmount == null || this.financialDocumentOneDollarAmount.equals(KualiDecimal.ZERO)) && (this.financialDocumentOtherDollarAmount == null || this.financialDocumentOtherDollarAmount.equals(KualiDecimal.ZERO)));
620 }
621
622
623
624
625 protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
626 LinkedHashMap m = new LinkedHashMap();
627 m.put(OLEPropertyConstants.DOCUMENT_NUMBER, this.documentNumber);
628 m.put("financialDocumentTypeCode", this.financialDocumentTypeCode);
629 m.put("cashieringStatus", this.cashieringStatus);
630 return m;
631 }
632 }