001    /**
002     * Copyright 2004-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.hr.lm.leaveSummary;
017    
018    import java.io.Serializable;
019    import java.math.BigDecimal;
020    import java.util.SortedMap;
021    
022    public class LeaveSummaryRow implements Serializable {
023            private String accrualCategory;
024        //adding this to have a very simple means of getting the Accrual Category object
025        private String accrualCategoryId;
026        private String accrualCategoryRuleId;
027        private String infractingLeaveBlockId;
028            private BigDecimal carryOver;
029            private BigDecimal ytdAccruedBalance;
030            private BigDecimal ytdApprovedUsage;
031            private BigDecimal leaveBalance;
032            private BigDecimal pendingLeaveAccrual;
033            private BigDecimal pendingLeaveRequests;
034            private BigDecimal pendingLeaveBalance;
035            private BigDecimal pendingAvailableUsage;
036            private BigDecimal usageLimit;
037            private BigDecimal fmlaUsage;
038    
039            private boolean transferable;
040            private boolean payoutable;
041            private BigDecimal maxCarryOver;
042        private SortedMap<String, BigDecimal> priorYearsTotalAccrued;
043        private SortedMap<String, BigDecimal> priorYearsUsage;
044        private SortedMap<String, BigDecimal> yearlyCarryOver;  //key is year
045            
046            public String getAccrualCategory() {
047                    return accrualCategory;
048            }
049            public void setAccrualCategory(String accrualCategory) {
050                    this.accrualCategory = accrualCategory;
051            }
052        public String getAccrualCategoryId() {
053            return accrualCategoryId;
054        }
055        public void setAccrualCategoryId(String accrualCategoryId) {
056            this.accrualCategoryId = accrualCategoryId;
057        }
058        public String getAccrualCategoryRuleId() {
059            return accrualCategoryRuleId;
060        }
061    
062        public void setAccrualCategoryRuleId(String accrualCategoryRuleId) {
063            this.accrualCategoryRuleId = accrualCategoryRuleId;
064        }
065            public BigDecimal getCarryOver() {
066                    return carryOver;
067            }
068            public void setCarryOver(BigDecimal carryOver) {
069                    this.carryOver = carryOver;
070            }
071            public BigDecimal getYtdAccruedBalance() {
072                    return ytdAccruedBalance;
073            }
074            public void setYtdAccruedBalance(BigDecimal ytdAccruedBalance) {
075                    this.ytdAccruedBalance = ytdAccruedBalance;
076            }
077            public BigDecimal getYtdApprovedUsage() {
078                    return ytdApprovedUsage;
079            }
080            public void setYtdApprovedUsage(BigDecimal ytdApprovedUsage) {
081                    this.ytdApprovedUsage = ytdApprovedUsage;
082            }
083            public BigDecimal getLeaveBalance() {
084                    return leaveBalance;
085            }
086            public void setLeaveBalance(BigDecimal leaveBalance) {
087                    this.leaveBalance = leaveBalance;
088            }
089            public BigDecimal getPendingLeaveAccrual() {
090                    return pendingLeaveAccrual;
091            }
092            public void setPendingLeaveAccrual(BigDecimal pendingLeaveAccrual) {
093                    this.pendingLeaveAccrual = pendingLeaveAccrual;
094            }
095            public BigDecimal getPendingLeaveRequests() {
096                    return pendingLeaveRequests;
097            }
098            public void setPendingLeaveRequests(BigDecimal pendingLeaveRequests) {
099                    this.pendingLeaveRequests = pendingLeaveRequests;
100            }
101            public BigDecimal getPendingLeaveBalance() {
102                    return pendingLeaveBalance;
103            }
104            public void setPendingLeaveBalance(BigDecimal pendingLeaveBalance) {
105                    this.pendingLeaveBalance = pendingLeaveBalance;
106            }
107            public BigDecimal getPendingAvailableUsage() {
108                    return pendingAvailableUsage;
109            }
110            public void setPendingAvailableUsage(BigDecimal pendingAvailableUsage) {
111                    this.pendingAvailableUsage = pendingAvailableUsage;
112            }
113            public BigDecimal getUsageLimit() {
114                    return usageLimit;
115            }
116            public void setUsageLimit(BigDecimal usageLimit) {
117                    this.usageLimit = usageLimit;
118            }
119            public BigDecimal getFmlaUsage() {
120                    return fmlaUsage;
121            }
122            public void setFmlaUsage(BigDecimal fmlaUsage) {
123                    this.fmlaUsage = fmlaUsage;
124            }
125        public BigDecimal getAccruedBalance() {
126            BigDecimal carryOver = getCarryOver() == null ? BigDecimal.ZERO : getCarryOver();
127            BigDecimal ytdAccruedBalance = getYtdAccruedBalance() == null ? BigDecimal.ZERO : getYtdAccruedBalance();
128            BigDecimal ytdApproved = getYtdApprovedUsage() == null ? BigDecimal.ZERO : getYtdApprovedUsage();
129            return carryOver.add(ytdAccruedBalance).subtract(ytdApproved);
130        }
131            public boolean isTransferable() {
132                    //Leave summary row has all the necessary information to answer the question
133                    //"Is my accrued balance eligible for transfer?". Should implement this method
134                    //to check for rule presence, max balance flag = Y, action at max bal = T
135                    //essentially move logic from BalanceTransferService.getAccrualCategoryRuleIdsForEligibleTransfers.
136                    //having this implemented might be less costly to call on.
137                    return transferable;
138            }
139            public void setTransferable(boolean transferable) {
140                    this.transferable = transferable;
141            }
142            public boolean isPayoutable() {
143                    return payoutable;
144            }
145            public void setPayoutable(boolean payoutable) {
146                    this.payoutable = payoutable;
147            }
148    
149    
150        public SortedMap<String, BigDecimal> getPriorYearsUsage() {
151            return priorYearsUsage;
152        }
153    
154        public void setPriorYearsUsage(SortedMap<String, BigDecimal> priorYearsUsage) {
155            this.priorYearsUsage = priorYearsUsage;
156        }
157    
158        public SortedMap<String, BigDecimal> getPriorYearsTotalAccrued() {
159            return priorYearsTotalAccrued;
160        }
161    
162        public void setPriorYearsTotalAccrued(SortedMap<String, BigDecimal> priorYearsTotalAccrued) {
163            this.priorYearsTotalAccrued = priorYearsTotalAccrued;
164        }
165        
166            public BigDecimal getMaxCarryOver() {
167                    return maxCarryOver;
168            }
169            
170            public void setMaxCarryOver(BigDecimal maxCarryOver) {
171                    this.maxCarryOver = maxCarryOver;
172            }
173            
174            public String getInfractingLeaveBlockId() {
175                    return infractingLeaveBlockId;
176            }
177            
178            public void setInfractingLeaveBlockId(String infractingLeaveBlockId) {
179                    this.infractingLeaveBlockId = infractingLeaveBlockId;
180            }
181    }