View Javadoc

1   /**
2    * Copyright 2004-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.kpme.tklm.leave.accrual.bucket;
17  
18  import java.util.ArrayList;
19  import java.util.List;
20  
21  import org.joda.time.LocalDate;
22  import org.kuali.kpme.core.accrualcategory.AccrualCategory;
23  import org.kuali.kpme.core.principal.PrincipalHRAttributes;
24  import org.kuali.kpme.tklm.api.leave.accrual.bucket.FmlaLeaveBalanceContract;
25  import org.kuali.kpme.tklm.leave.accrual.bucket.exception.MaximumBalanceException;
26  import org.kuali.kpme.tklm.leave.accrual.bucket.exception.NegativeBalanceException;
27  import org.kuali.kpme.tklm.leave.accrual.bucket.exception.UsageLimitException;
28  import org.kuali.kpme.tklm.leave.block.LeaveBlock;
29  
30  public class FmlaLeaveBalance extends LeaveBalance implements FmlaLeaveBalanceContract {
31  
32  	private List<LeaveBlock> leaveBlocks;
33  
34  	public FmlaLeaveBalance(AccrualCategory accrualCategory, PrincipalHRAttributes principalCalendar) {
35  		super(accrualCategory, principalCalendar);
36  		asOfDate = LocalDate.now();
37  		leaveBlocks = new ArrayList<LeaveBlock>();
38  	}
39  
40  	private final static String BALANCE_TYPE = "FMLA_BALANCE";
41  	
42  	@Override
43  	public void add(LeaveBlock leaveBlock) throws UsageLimitException,
44  			MaximumBalanceException, NegativeBalanceException {
45  		
46  		add(leaveBlock.getLeaveAmount());
47  		
48  		leaveBlocks.add(leaveBlock);
49  	}
50  
51  	@Override
52  	public void remove(LeaveBlock leaveBlock) throws UsageLimitException,
53  			MaximumBalanceException, NegativeBalanceException {
54  		remove(leaveBlock.getLeaveAmount());
55  		
56  		leaveBlocks.remove(leaveBlock);
57  	}
58  
59  	@Override
60  	public String getBalanceType() {
61  		return BALANCE_TYPE;
62  	}
63  
64  	@Override
65  	public void adjust(LeaveBlock leaveBlock) throws UsageLimitException,
66  			MaximumBalanceException, NegativeBalanceException {
67  		// TODO Auto-generated method stub
68  		
69  	}
70  
71  	@Override
72  	public void clear() {
73  		leaveBlocks.clear();
74  		super.clear();
75  	}
76  
77  }