List of usage examples for org.joda.time LocalDate isAfter
public boolean isAfter(ReadablePartial partial)
From source file:org.kuali.kpme.tklm.leave.payout.validation.LeavePayoutValidation.java
License:Educational Community License
/** * Are there any rules in place for effective date? i.e. not more than one year in advance... * @param date/* www . jav a 2s .c o m*/ * @return */ private boolean validateEffectiveDate(LocalDate date) { //Limit on future dates? if (date.isAfter(LocalDate.now().plusYears(1))) { GlobalVariables.getMessageMap().putError("document.newMaintainableObject.effectiveDate", "leavePayout.effectiveDate.overOneYear"); return false; } return true; }
From source file:org.libreplan.business.calendars.entities.AvailabilityTimeLine.java
License:Open Source License
public void invalidAt(LocalDate intervalStart, LocalDate intervalEnd) { if (intervalStart.isAfter(intervalEnd)) { throw new IllegalArgumentException("end must be equal or after start"); }/* w ww . ja va 2 s. com*/ insert(Interval.create(intervalStart, intervalEnd)); }
From source file:org.libreplan.business.costcategories.entities.HourCost.java
License:Open Source License
private boolean isEqualOrBefore(LocalDate date) { return (this.getEndDate() == null || !date.isAfter(this.getEndDate())); }
From source file:org.libreplan.business.planner.chart.ContiguousDaysLine.java
License:Open Source License
public static <T> ContiguousDaysLine<T> create(LocalDate fromInclusive, LocalDate endExclusive) { if (fromInclusive.isAfter(endExclusive)) { throw new IllegalArgumentException( "fromInclusive (" + fromInclusive + ") is after endExclusive (" + endExclusive + ")"); }//from w ww. jav a 2 s . co m Days daysBetween = Days.daysBetween(fromInclusive, endExclusive); return new ContiguousDaysLine<T>(fromInclusive, daysBetween.getDays()); }
From source file:org.libreplan.business.planner.entities.OrderEarnedValueCalculator.java
License:Open Source License
private BigDecimal getValueAt(SortedMap<LocalDate, BigDecimal> map, LocalDate date) { if (map.isEmpty()) { return BigDecimal.ZERO; }// w w w. j a v a 2 s . c om BigDecimal result = map.get(date); if (result != null) { return result; } for (LocalDate each : map.keySet()) { if (date.isBefore(each)) { return map.get(each); } } if (date.isAfter(map.lastKey())) { return map.get(map.lastKey()); } return BigDecimal.ZERO; }
From source file:org.libreplan.web.limitingresources.LimitingResourceQueueModel.java
License:Open Source License
/** * Returns queue which last element is at a earliest date. * * @param potentiallyValidQueues/*from ww w .ja va2 s . c o m*/ * @return {@link LimitingResourceQueue} */ private LimitingResourceQueue earliestQueue(List<LimitingResourceQueue> potentiallyValidQueues) { LimitingResourceQueue result = null; LocalDate latestDate = null; for (LimitingResourceQueue each : potentiallyValidQueues) { SortedSet<LimitingResourceQueueElement> elements = each.getLimitingResourceQueueElements(); if (!elements.isEmpty()) { LocalDate date = elements.last().getEndDate(); if (latestDate == null || date.isAfter(latestDate)) { latestDate = date; result = each; } } } if (result == null && !potentiallyValidQueues.isEmpty()) { result = potentiallyValidQueues.get(0); } return result; }
From source file:org.mifos.accounts.business.AccountBO.java
License:Open Source License
private AccountActionDateEntity findInstallmentToUpdateFromNow() { List<AccountActionDateEntity> allInstallments = getAllInstallments(); if (allInstallments.size() == 0) { return null; }//w ww .j a v a2 s . c om LocalDate currentDate = new LocalDate(); int installmentIndex = 0; AccountActionDateEntity installment = allInstallments.get(installmentIndex); // update all installments that are after current date while (installment != null && currentDate.isAfter(new LocalDate(installment.getActionDate().getTime()))) { ++installmentIndex; // if we've iterated over all the installments, then just return null if (installmentIndex == allInstallments.size()) { installment = null; } else { installment = allInstallments.get(installmentIndex); } } return installment; }
From source file:org.mifos.accounts.business.AccountBO.java
License:Open Source License
private AccountPaymentEntity findMostRecentPaymentByPaymentDate( List<AccountPaymentEntity> recentAccountPayments) { AccountPaymentEntity mostRecentPayment = null; if (!recentAccountPayments.isEmpty()) { mostRecentPayment = recentAccountPayments.get(0); for (AccountPaymentEntity accountPaymentEntity : recentAccountPayments) { LocalDate paymentDate = new LocalDate(accountPaymentEntity.getPaymentDate()); if ((paymentDate.isAfter(new LocalDate(mostRecentPayment.getPaymentDate())) && paymentDate.isBefore(new LocalDate().plusDays(1))) || (paymentDate.isEqual(new LocalDate(mostRecentPayment.getPaymentDate())) && accountPaymentEntity.getPaymentId() != null && mostRecentPayment.getPaymentId() != null && accountPaymentEntity.getPaymentId() > mostRecentPayment.getPaymentId())) { mostRecentPayment = accountPaymentEntity; }//from w w w .ja v a 2 s .c o m } } return mostRecentPayment; }
From source file:org.mifos.accounts.business.AccountBO.java
License:Open Source License
public List<AccountActionDateEntity> getDetailsOfInstallmentsInArrearsOn(LocalDate asOf) { List<AccountActionDateEntity> installmentsInArrears = new ArrayList<AccountActionDateEntity>(); Set<AccountActionDateEntity> accountActionDates = getAccountActionDates(); if (accountActionDates != null && !accountActionDates.isEmpty()) { for (AccountActionDateEntity accountAction : accountActionDates) { LocalDate installmentDate = new LocalDate(accountAction.getActionDate()); if (asOf.isAfter(installmentDate) && !accountAction.isPaid() || asOf.isEqual(installmentDate)) { installmentsInArrears.add(accountAction); }/*w ww .ja va 2 s .c om*/ } } return installmentsInArrears; }
From source file:org.mifos.accounts.savings.business.SavingsBO.java
License:Open Source License
public AccountPaymentEntity findMostRecentDepositOrWithdrawalByDate() { AccountPaymentEntity mostRecentPayment = null; if (!this.accountPayments.isEmpty()) { for (AccountPaymentEntity accountPaymentEntity : this.accountPayments) { if (mostRecentPayment == null && accountPaymentEntity.isSavingsDepositOrWithdrawal()) { mostRecentPayment = accountPaymentEntity; } else if (mostRecentPayment != null) { LocalDate paymentDate = new LocalDate(accountPaymentEntity.getPaymentDate()); if ((paymentDate.isAfter(new LocalDate(mostRecentPayment.getPaymentDate())) && paymentDate.isBefore(new LocalDate().plusDays(1))) || (paymentDate.isEqual(new LocalDate(mostRecentPayment.getPaymentDate())) && accountPaymentEntity.getPaymentId() != null && mostRecentPayment.getPaymentId() != null && accountPaymentEntity.getPaymentId() > mostRecentPayment.getPaymentId()) && accountPaymentEntity.isSavingsDepositOrWithdrawal()) { mostRecentPayment = accountPaymentEntity; }/*from w w w.j av a2 s . c o m*/ } } } return mostRecentPayment; }