org.kuali.hr.time.overtime.weekly.rule.service
Class WeeklyOvertimeRuleServiceImpl

java.lang.Object
  extended by org.kuali.hr.time.overtime.weekly.rule.service.WeeklyOvertimeRuleServiceImpl
All Implemented Interfaces:
WeeklyOvertimeRuleService

public class WeeklyOvertimeRuleServiceImpl
extends Object
implements WeeklyOvertimeRuleService


Constructor Summary
WeeklyOvertimeRuleServiceImpl()
           
 
Method Summary
protected  BigDecimal applyNegativeOvertimeOnTimeBlock(TimeBlock timeBlock, String overtimeEarnCode, Set<String> convertFromEarnCodes, BigDecimal overtimeHours)
          Applies overtime subtractions on the indicated TimeBlock.
protected  void applyNegativeOvertimeToFlsaWeek(List<FlsaDay> flsaDays, WeeklyOvertimeRule weeklyOvertimeRule, Date asOfDate, Set<String> convertFromEarnCodes, BigDecimal overtimeHours)
          Applies negative overtime to the given FlsaDays.
protected  void applyOvertimeToFlsaWeeks(List<FlsaWeek> flsaWeeks, WeeklyOvertimeRule weeklyOvertimeRule, Date asOfDate, Set<String> convertFromEarnCodes, BigDecimal overtimeHours)
          Applies overtime to the given FlsaWeeks.
protected  BigDecimal applyPositiveOvertimeOnTimeBlock(TimeBlock timeBlock, String overtimeEarnCode, Set<String> convertFromEarnCodes, BigDecimal overtimeHours)
          Applies overtime additions to the indicated TimeBlock.
protected  void applyPositiveOvertimeToFlsaWeek(List<FlsaDay> flsaDays, WeeklyOvertimeRule weeklyOvertimeRule, Date asOfDate, Set<String> convertFromEarnCodes, BigDecimal overtimeHours)
          Applies positive overtime to the given FlsaDays.
protected  List<FlsaDay> getFlsaDays(List<FlsaWeek> flsaWeeks)
          Gets the list of FlsaDays in the given FlsaWeek.
protected  List<List<FlsaWeek>> getFlsaWeeks(String principalId, Date beginDate, Date endDate, TkTimeBlockAggregate aggregate)
          Get the list of all FlsaWeek lists for this period.
protected  BigDecimal getMaxHours(List<FlsaWeek> flsaWeeks, Set<String> maxHoursEarnCodes)
          Get the maximum worked hours for the given FlsaWeeks.
protected  String getOvertimeEarnCode(WeeklyOvertimeRule weeklyOvertimeRule, TimeBlock timeBlock, Date asOfDate)
          Returns the overtime EarnCode.
protected  TimeHourDetail getTimeHourDetailByEarnCode(List<TimeHourDetail> timeHourDetails, Collection<String> earnCodes)
           
 WeeklyOvertimeRule getWeeklyOvertimeRule(String tkWeeklyOvertimeRuleId)
          Fetch Weekly overtime rule by id
 List<WeeklyOvertimeRule> getWeeklyOvertimeRules(Date asOfDate)
          Fetch a List of WeeklyOvertimeRule as of a particular date
 void processWeeklyOvertimeRule(TimesheetDocument timesheetDocument, TkTimeBlockAggregate aggregate)
          Process weekly overtime rules for a given TkTimeBlockAggregate
protected  void removeEmptyOvertime(List<FlsaDay> flsaDays, WeeklyOvertimeRule weeklyOvertimeRule, Date asOfDate)
           
 void saveOrUpdate(List<WeeklyOvertimeRule> weeklyOvertimeRules)
          Save or Update a List of WeeklyOvertimeRules
 void saveOrUpdate(WeeklyOvertimeRule weeklyOvertimeRule)
          Save or Update a given WeeklyOvertimeRule
protected  void savePreviousNextCalendarTimeBlocks(List<List<FlsaWeek>> flsaWeeks)
          Saves the TimeBlocks from both the previous and next CalendarEntries, since these are not saved automatically by calling methods.
 void setWeeklyOvertimeRuleDao(WeeklyOvertimeRuleDao weeklyOvertimeRuleDao)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeeklyOvertimeRuleServiceImpl

public WeeklyOvertimeRuleServiceImpl()
Method Detail

processWeeklyOvertimeRule

public void processWeeklyOvertimeRule(TimesheetDocument timesheetDocument,
                                      TkTimeBlockAggregate aggregate)
Description copied from interface: WeeklyOvertimeRuleService
Process weekly overtime rules for a given TkTimeBlockAggregate

Specified by:
processWeeklyOvertimeRule in interface WeeklyOvertimeRuleService

getFlsaWeeks

protected List<List<FlsaWeek>> getFlsaWeeks(String principalId,
                                            Date beginDate,
                                            Date endDate,
                                            TkTimeBlockAggregate aggregate)
Get the list of all FlsaWeek lists for this period. An FlsaWeek list is a set of partial FlsaWeeks that overlap a CalendarEntry boundary. The total of all days in an FlsaWeek list adds up to one complete week. This is done so WeeklyOvertimeRule calculations are done for multiple Calendar periods.

Parameters:
principalId - The principal id to apply the rules to
beginDate - The begin date of the CalendarEntry
endDate - The end date of the CalendarEntry
aggregate - The aggregate of the applicable TimeBlocks
Returns:
the list of all FlsaWeek lists for this period

getMaxHours

protected BigDecimal getMaxHours(List<FlsaWeek> flsaWeeks,
                                 Set<String> maxHoursEarnCodes)
Get the maximum worked hours for the given FlsaWeeks.

Parameters:
flsaWeeks - The FlsaWeeks to get the hours from
maxHoursEarnCodes - The EarnCodes used to determine what is applicable as a max hour
Returns:
the maximum worked hours for the given FlsaWeeks

getOvertimeEarnCode

protected String getOvertimeEarnCode(WeeklyOvertimeRule weeklyOvertimeRule,
                                     TimeBlock timeBlock,
                                     Date asOfDate)
Returns the overtime EarnCode. Defaults to the EarnCode on the WeeklyOvertimeRule but overrides with the WorkArea default overtime EarnCode and the TimeBlock overtime preference EarnCode in that order if they exist.

Parameters:
weeklyOvertimeRule - The WeeklyOvertimeRule to use when calculating the overtime EarnCode
timeBlock - The TimeBlock to use when calculating the overtime EarnCode
asOfDate - The effectiveDate of the WorkArea
Returns:
the overtime EarnCode

applyOvertimeToFlsaWeeks

protected void applyOvertimeToFlsaWeeks(List<FlsaWeek> flsaWeeks,
                                        WeeklyOvertimeRule weeklyOvertimeRule,
                                        Date asOfDate,
                                        Set<String> convertFromEarnCodes,
                                        BigDecimal overtimeHours)
Applies overtime to the given FlsaWeeks.

Parameters:
flsaWeeks - The FlsaWeeks to apply the overtime to
weeklyOvertimeRule - The WeeklyOvertimeRule in effective
asOfDate - The effectiveDate of the WorkArea
convertFromEarnCodes - The EarnCodes to convert to overtime
overtimeHours - The number of overtime hours to apply

getFlsaDays

protected List<FlsaDay> getFlsaDays(List<FlsaWeek> flsaWeeks)
Gets the list of FlsaDays in the given FlsaWeek.

Parameters:
flsaWeeks - The FlsaWeek to fetch the FlsaDays from
Returns:
the list of FlsaDays in the given FlsaWeek

applyPositiveOvertimeToFlsaWeek

protected void applyPositiveOvertimeToFlsaWeek(List<FlsaDay> flsaDays,
                                               WeeklyOvertimeRule weeklyOvertimeRule,
                                               Date asOfDate,
                                               Set<String> convertFromEarnCodes,
                                               BigDecimal overtimeHours)
Applies positive overtime to the given FlsaDays.

Parameters:
flsaDays - The FlsaDays to apply the overtime to
weeklyOvertimeRule - The WeeklyOvertimeRule in effective
asOfDate - The effectiveDate of the WorkArea
convertFromEarnCodes - The EarnCodes to convert to overtime
overtimeHours - The number of overtime hours to apply

applyNegativeOvertimeToFlsaWeek

protected void applyNegativeOvertimeToFlsaWeek(List<FlsaDay> flsaDays,
                                               WeeklyOvertimeRule weeklyOvertimeRule,
                                               Date asOfDate,
                                               Set<String> convertFromEarnCodes,
                                               BigDecimal overtimeHours)
Applies negative overtime to the given FlsaDays.

Parameters:
flsaDays - The FlsaDays to apply the overtime to
weeklyOvertimeRule - The WeeklyOvertimeRule in effective
asOfDate - The effectiveDate of the WorkArea
convertFromEarnCodes - The EarnCodes to convert to overtime
overtimeHours - The number of overtime hours to apply

removeEmptyOvertime

protected void removeEmptyOvertime(List<FlsaDay> flsaDays,
                                   WeeklyOvertimeRule weeklyOvertimeRule,
                                   Date asOfDate)

applyPositiveOvertimeOnTimeBlock

protected BigDecimal applyPositiveOvertimeOnTimeBlock(TimeBlock timeBlock,
                                                      String overtimeEarnCode,
                                                      Set<String> convertFromEarnCodes,
                                                      BigDecimal overtimeHours)
Applies overtime additions to the indicated TimeBlock.

Parameters:
timeBlock - The time block to apply the overtime on.
overtimeEarnCode - The overtime earn code to apply overtime to.
convertFromEarnCodes - The other earn codes on the time block.
overtimeHours - The overtime hours to apply.
Returns:
the amount of overtime hours remaining to be applied.

applyNegativeOvertimeOnTimeBlock

protected BigDecimal applyNegativeOvertimeOnTimeBlock(TimeBlock timeBlock,
                                                      String overtimeEarnCode,
                                                      Set<String> convertFromEarnCodes,
                                                      BigDecimal overtimeHours)
Applies overtime subtractions on the indicated TimeBlock.

Parameters:
timeBlock - The time block to reset the overtime on.
overtimeEarnCode - The overtime earn code to apply overtime to.
convertFromEarnCodes - The other earn codes on the time block.
overtimeHours - The overtime hours to apply.
Returns:
the amount of overtime hours remaining to be applied.

getTimeHourDetailByEarnCode

protected TimeHourDetail getTimeHourDetailByEarnCode(List<TimeHourDetail> timeHourDetails,
                                                     Collection<String> earnCodes)

savePreviousNextCalendarTimeBlocks

protected void savePreviousNextCalendarTimeBlocks(List<List<FlsaWeek>> flsaWeeks)
Saves the TimeBlocks from both the previous and next CalendarEntries, since these are not saved automatically by calling methods.

Parameters:
flsaWeeks - The list of FlsaWeek lists

getWeeklyOvertimeRules

public List<WeeklyOvertimeRule> getWeeklyOvertimeRules(Date asOfDate)
Description copied from interface: WeeklyOvertimeRuleService
Fetch a List of WeeklyOvertimeRule as of a particular date

Specified by:
getWeeklyOvertimeRules in interface WeeklyOvertimeRuleService
Returns:

saveOrUpdate

public void saveOrUpdate(WeeklyOvertimeRule weeklyOvertimeRule)
Description copied from interface: WeeklyOvertimeRuleService
Save or Update a given WeeklyOvertimeRule

Specified by:
saveOrUpdate in interface WeeklyOvertimeRuleService

saveOrUpdate

public void saveOrUpdate(List<WeeklyOvertimeRule> weeklyOvertimeRules)
Description copied from interface: WeeklyOvertimeRuleService
Save or Update a List of WeeklyOvertimeRules

Specified by:
saveOrUpdate in interface WeeklyOvertimeRuleService

setWeeklyOvertimeRuleDao

public void setWeeklyOvertimeRuleDao(WeeklyOvertimeRuleDao weeklyOvertimeRuleDao)

getWeeklyOvertimeRule

public WeeklyOvertimeRule getWeeklyOvertimeRule(String tkWeeklyOvertimeRuleId)
Description copied from interface: WeeklyOvertimeRuleService
Fetch Weekly overtime rule by id

Specified by:
getWeeklyOvertimeRule in interface WeeklyOvertimeRuleService
Returns:


Copyright © 2004-2013 The Kuali Foundation. All Rights Reserved.