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.time.flsa;
017    
018    import java.util.ArrayList;
019    import java.util.List;
020    
021    import org.joda.time.LocalTime;
022    
023    public class FlsaWeek {
024            private List<FlsaDay> flsaDays = new ArrayList<FlsaDay>();
025            private int flsaDayConstant;
026            private LocalTime flsaTime;
027            private LocalTime payPeriodBeginTime;
028            
029            public FlsaWeek() {
030                    
031            }
032            
033            public FlsaWeek(int dayConstant, LocalTime flsaTime, LocalTime payPeriodBeginTime) {
034                    this.flsaDayConstant = dayConstant;
035                    this.flsaTime = flsaTime;
036                    this.payPeriodBeginTime = payPeriodBeginTime;
037            }
038    
039            public List<FlsaDay> getFlsaDays() {
040                    return flsaDays;
041            }
042            
043            public void addFlsaDay(FlsaDay flsaDay) {
044                    flsaDays.add(flsaDay);
045            }
046    
047            /**
048             * Check to see if the first week is Full or not.
049             * 
050             * If the first week of a pay period has an FLSA starting time that is before
051             * the "Virtual Day" pay period start time, part of the time required for this
052             * first day will be in the previous pay period even if we have 7 days.
053             * 
054             * @return
055             */
056            public boolean isFirstWeekFull() {
057                    if (flsaDays.size() == 7) {
058                            return (flsaTime.isBefore(payPeriodBeginTime)) ? false : true;
059                    } else {
060                            return false;
061                    }
062            }
063            
064            /**
065             * Check to see if the last week is Full or not.
066             * 
067             * If the last week of a pay period has an FLSA starting time that is after
068             * the "Virtual Day" pay period start time, part of the time required for this
069             * last day will be in the next pay period even if we have 7 days.
070             * 
071             * @return
072             */
073            public boolean isLastWeekFull() {
074                    if (flsaDays.size() == 7) {
075                            return (flsaTime.isAfter(payPeriodBeginTime)) ? false : true;
076                    } else {
077                            return false;
078                    }
079            }
080            
081            public int getFlsaDayConstant() {
082                    return flsaDayConstant;
083            }
084    
085            public void setFlsaDayConstant(int flsaDayConstant) {
086                    this.flsaDayConstant = flsaDayConstant;
087            }
088    
089            public LocalTime getFlsaTime() {
090                    return flsaTime;
091            }
092    
093            public void setFlsaTime(LocalTime flsaTime) {
094                    this.flsaTime = flsaTime;
095            }
096    }