1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.lm.accrual;
17
18 import java.util.ArrayList;
19 import java.util.Date;
20 import java.util.List;
21 import java.util.Map;
22
23 import org.kuali.hr.time.calendar.CalendarEntries;
24
25 public class RateRangeAggregate {
26 private List<RateRange> rateRanges = new ArrayList<RateRange>();
27 private RateRange currentRate;
28 private boolean rateRangeChanged;
29 private Map<String, List<CalendarEntries>> calEntryMap;
30
31 public RateRange getRate(Date date) {
32 rateRangeChanged = false;
33 if (currentRate == null) {
34 currentRate = rateRanges.get(0);
35 }
36
37 if (currentRate.getRange().contains(date.getTime())) {
38 for (RateRange rateRange : rateRanges) {
39 if (rateRange.getRange().contains(date.getTime())) {
40 rateRangeChanged = rateRange.getAccrualRatePercentageModifier() != currentRate.getAccrualRatePercentageModifier();
41 currentRate = rateRange;
42 break;
43 }
44 }
45 }
46 return currentRate;
47 }
48
49 public List<RateRange> getRateRanges() {
50 return rateRanges;
51 }
52 public void setRateRanges(List<RateRange> rateRanges) {
53 this.rateRanges = rateRanges;
54 }
55 public RateRange getCurrentRate() {
56 return currentRate;
57 }
58 public void setCurrentRate(RateRange currentRate) {
59 this.currentRate = currentRate;
60 }
61 public boolean isRateRangeChanged() {
62 return rateRangeChanged;
63 }
64 public void setRateRangeChanged(boolean rateRangeChanged) {
65 this.rateRangeChanged = rateRangeChanged;
66 }
67
68
69 public RateRange getRateOnDate(Date date) {
70 for (RateRange rateRange : rateRanges) {
71 if (rateRange.getRange().contains(date.getTime())) {
72 return rateRange;
73 }
74 }
75 return null;
76 }
77
78 public Map<String, List<CalendarEntries>> getCalEntryMap() {
79 return calEntryMap;
80 }
81
82 public void setCalEntryMap(Map<String, List<CalendarEntries>> calEntryMap) {
83 this.calEntryMap = calEntryMap;
84 }
85
86
87 }