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.math.BigDecimal;
019    import java.util.SortedMap;
020    
021    public class LeaveSummaryRow {
022            private String accrualCategory;
023        //adding this to have a very simple means of getting the Accrual Category object
024        private String accrualCategoryId;
025        private String accrualCategoryRuleId;
026            private BigDecimal carryOver;
027            private BigDecimal ytdAccruedBalance;
028            private BigDecimal ytdApprovedUsage;
029            private BigDecimal leaveBalance;
030            private BigDecimal pendingLeaveAccrual;
031            private BigDecimal pendingLeaveRequests;
032            private BigDecimal pendingLeaveBalance;
033            private BigDecimal pendingAvailableUsage;
034            private BigDecimal usageLimit;
035            private BigDecimal fmlaUsage;
036    
037            private boolean transferable;
038            private boolean payoutable;
039            private BigDecimal maxCarryOver;
040        private SortedMap<String, BigDecimal> priorYearsTotalAccrued;
041        private SortedMap<String, BigDecimal> priorYearsUsage;
042        private SortedMap<String, BigDecimal> yearlyCarryOver;  //key is year
043            
044            public String getAccrualCategory() {
045                    return accrualCategory;
046            }
047            public void setAccrualCategory(String accrualCategory) {
048                    this.accrualCategory = accrualCategory;
049            }
050        public String getAccrualCategoryId() {
051            return accrualCategoryId;
052        }
053        public void setAccrualCategoryId(String accrualCategoryId) {
054            this.accrualCategoryId = accrualCategoryId;
055        }
056        public String getAccrualCategoryRuleId() {
057            return accrualCategoryRuleId;
058        }
059    
060        public void setAccrualCategoryRuleId(String accrualCategoryRuleId) {
061            this.accrualCategoryRuleId = accrualCategoryRuleId;
062        }
063            public BigDecimal getCarryOver() {
064                    return carryOver;
065            }
066            public void setCarryOver(BigDecimal carryOver) {
067                    this.carryOver = carryOver;
068            }
069            public BigDecimal getYtdAccruedBalance() {
070                    return ytdAccruedBalance;
071            }
072            public void setYtdAccruedBalance(BigDecimal ytdAccruedBalance) {
073                    this.ytdAccruedBalance = ytdAccruedBalance;
074            }
075            public BigDecimal getYtdApprovedUsage() {
076                    return ytdApprovedUsage;
077            }
078            public void setYtdApprovedUsage(BigDecimal ytdApprovedUsage) {
079                    this.ytdApprovedUsage = ytdApprovedUsage;
080            }
081            public BigDecimal getLeaveBalance() {
082                    return leaveBalance;
083            }
084            public void setLeaveBalance(BigDecimal leaveBalance) {
085                    this.leaveBalance = leaveBalance;
086            }
087            public BigDecimal getPendingLeaveAccrual() {
088                    return pendingLeaveAccrual;
089            }
090            public void setPendingLeaveAccrual(BigDecimal pendingLeaveAccrual) {
091                    this.pendingLeaveAccrual = pendingLeaveAccrual;
092            }
093            public BigDecimal getPendingLeaveRequests() {
094                    return pendingLeaveRequests;
095            }
096            public void setPendingLeaveRequests(BigDecimal pendingLeaveRequests) {
097                    this.pendingLeaveRequests = pendingLeaveRequests;
098            }
099            public BigDecimal getPendingLeaveBalance() {
100                    return pendingLeaveBalance;
101            }
102            public void setPendingLeaveBalance(BigDecimal pendingLeaveBalance) {
103                    this.pendingLeaveBalance = pendingLeaveBalance;
104            }
105            public BigDecimal getPendingAvailableUsage() {
106                    return pendingAvailableUsage;
107            }
108            public void setPendingAvailableUsage(BigDecimal pendingAvailableUsage) {
109                    this.pendingAvailableUsage = pendingAvailableUsage;
110            }
111            public BigDecimal getUsageLimit() {
112                    return usageLimit;
113            }
114            public void setUsageLimit(BigDecimal usageLimit) {
115                    this.usageLimit = usageLimit;
116            }
117            public BigDecimal getFmlaUsage() {
118                    return fmlaUsage;
119            }
120            public void setFmlaUsage(BigDecimal fmlaUsage) {
121                    this.fmlaUsage = fmlaUsage;
122            }
123        public BigDecimal getAccruedBalance() {
124            BigDecimal carryOver = getCarryOver() == null ? BigDecimal.ZERO : getCarryOver();
125            BigDecimal ytdAccruedBalance = getYtdAccruedBalance() == null ? BigDecimal.ZERO : getYtdAccruedBalance();
126            BigDecimal ytdApproved = getYtdApprovedUsage() == null ? BigDecimal.ZERO : getYtdApprovedUsage();
127            return carryOver.add(ytdAccruedBalance).subtract(ytdApproved);
128        }
129            public boolean isTransferable() {
130                    //Leave summary row has all the necessary information to answer the question
131                    //"Is my accrued balance eligible for transfer?". Should implement this method
132                    //to check for rule presence, max balance flag = Y, action at max bal = T
133                    //essentially move logic from BalanceTransferService.getAccrualCategoryRuleIdsForEligibleTransfers.
134                    //having this implemented might be less costly to call on.
135                    return transferable;
136            }
137            public void setTransferable(boolean transferable) {
138                    this.transferable = transferable;
139            }
140            public boolean isPayoutable() {
141                    return payoutable;
142            }
143            public void setPayoutable(boolean payoutable) {
144                    this.payoutable = payoutable;
145            }
146    
147    
148        public SortedMap<String, BigDecimal> getPriorYearsUsage() {
149            return priorYearsUsage;
150        }
151    
152        public void setPriorYearsUsage(SortedMap<String, BigDecimal> priorYearsUsage) {
153            this.priorYearsUsage = priorYearsUsage;
154        }
155    
156        public SortedMap<String, BigDecimal> getPriorYearsTotalAccrued() {
157            return priorYearsTotalAccrued;
158        }
159    
160        public void setPriorYearsTotalAccrued(SortedMap<String, BigDecimal> priorYearsTotalAccrued) {
161            this.priorYearsTotalAccrued = priorYearsTotalAccrued;
162        }
163        
164            public BigDecimal getMaxCarryOver() {
165                    return maxCarryOver;
166            }
167            
168            public void setMaxCarryOver(BigDecimal maxCarryOver) {
169                    this.maxCarryOver = maxCarryOver;
170            }
171    }