List of usage examples for org.joda.time DateTime withWeekOfWeekyear
public DateTime withWeekOfWeekyear(int weekOfWeekyear)
From source file:org.kuali.kpme.tklm.leave.accrual.service.AccrualServiceImpl.java
License:Educational Community License
@Override public DateTime getNextAccrualIntervalDate(String earnInterval, DateTime aDate) { DateTime nextAccrualIntervalDate = null; if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.DAILY)) { nextAccrualIntervalDate = aDate; } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.WEEKLY)) { if (aDate.getDayOfWeek() != DateTimeConstants.SATURDAY) { nextAccrualIntervalDate = aDate.withDayOfWeek(DateTimeConstants.SATURDAY); } else {//from ww w . j ava 2 s .c om nextAccrualIntervalDate = aDate.withWeekOfWeekyear(1); } } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.SEMI_MONTHLY)) { if (aDate.getDayOfMonth() <= 15) { nextAccrualIntervalDate = aDate.withDayOfMonth(15); } else { nextAccrualIntervalDate = aDate.withDayOfMonth(aDate.dayOfMonth().getMaximumValue()); } } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.MONTHLY)) { nextAccrualIntervalDate = aDate.withDayOfMonth(aDate.dayOfMonth().getMaximumValue()); } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.YEARLY)) { nextAccrualIntervalDate = aDate.withDayOfYear(aDate.dayOfYear().getMaximumValue()); } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.NO_ACCRUAL)) { nextAccrualIntervalDate = aDate; } return nextAccrualIntervalDate; }