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.hr.time.flsa;
17  
18  import java.util.ArrayList;
19  import java.util.List;
20  
21  import org.joda.time.LocalTime;
22  
23  public class FlsaWeek {
24  	private List<FlsaDay> flsaDays = new ArrayList<FlsaDay>();
25  	private int flsaDayConstant;
26  	private LocalTime flsaTime;
27  	private LocalTime payPeriodBeginTime;
28  	
29  	public FlsaWeek() {
30  		
31  	}
32  	
33  	public FlsaWeek(int dayConstant, LocalTime flsaTime, LocalTime payPeriodBeginTime) {
34  		this.flsaDayConstant = dayConstant;
35  		this.flsaTime = flsaTime;
36  		this.payPeriodBeginTime = payPeriodBeginTime;
37  	}
38  
39  	public List<FlsaDay> getFlsaDays() {
40  		return flsaDays;
41  	}
42  	
43  	public void addFlsaDay(FlsaDay flsaDay) {
44  		flsaDays.add(flsaDay);
45  	}
46  
47  	/**
48  	 * Check to see if the first week is Full or not.
49  	 * 
50  	 * If the first week of a pay period has an FLSA starting time that is before
51  	 * the "Virtual Day" pay period start time, part of the time required for this
52  	 * first day will be in the previous pay period even if we have 7 days.
53  	 * 
54  	 * @return
55  	 */
56  	public boolean isFirstWeekFull() {
57  		if (flsaDays.size() == 7) {
58  			return (flsaTime.isBefore(payPeriodBeginTime)) ? false : true;
59  		} else {
60  			return false;
61  		}
62  	}
63  	
64  	/**
65  	 * Check to see if the last week is Full or not.
66  	 * 
67  	 * If the last week of a pay period has an FLSA starting time that is after
68  	 * the "Virtual Day" pay period start time, part of the time required for this
69  	 * last day will be in the next pay period even if we have 7 days.
70  	 * 
71  	 * @return
72  	 */
73  	public boolean isLastWeekFull() {
74  		if (flsaDays.size() == 7) {
75  			return (flsaTime.isAfter(payPeriodBeginTime)) ? false : true;
76  		} else {
77  			return false;
78  		}
79  	}
80  	
81  	public int getFlsaDayConstant() {
82  		return flsaDayConstant;
83  	}
84  
85  	public void setFlsaDayConstant(int flsaDayConstant) {
86  		this.flsaDayConstant = flsaDayConstant;
87  	}
88  
89  	public LocalTime getFlsaTime() {
90  		return flsaTime;
91  	}
92  
93  	public void setFlsaTime(LocalTime flsaTime) {
94  		this.flsaTime = flsaTime;
95  	}
96  }