@Override public boolean evaluate(final BillingState state, final LocalDate date) { LocalDate unpaidInvoiceTriggerDate = null; if (timeSinceEarliestUnpaidInvoiceEqualsOrExceeds != null && state.getDateOfEarliestUnpaidInvoice() != null) { // no date => no unpaid invoices unpaidInvoiceTriggerDate = state.getDateOfEarliestUnpaidInvoice().plus(timeSinceEarliestUnpaidInvoiceEqualsOrExceeds.toJodaPeriod()); } return (numberOfUnpaidInvoicesEqualsOrExceeds == null || state.getNumberOfUnpaidInvoices() >= numberOfUnpaidInvoicesEqualsOrExceeds) && (totalUnpaidInvoiceBalanceEqualsOrExceeds == null || totalUnpaidInvoiceBalanceEqualsOrExceeds.compareTo(state.getBalanceOfUnpaidInvoices()) <= 0) && (timeSinceEarliestUnpaidInvoiceEqualsOrExceeds == null || (unpaidInvoiceTriggerDate != null && !unpaidInvoiceTriggerDate.isAfter(date))) && (responseForLastFailedPayment == null || responseIsIn(state.getResponseForLastFailedPayment(), responseForLastFailedPayment)) && (controlTagInclusion == null || isTagIn(controlTagInclusion, state.getTags())) && (controlTagExclusion == null || isTagNotIn(controlTagExclusion, state.getTags())); }
public void setDateFrom(LocalDate dateFrom) { Preconditions.checkArgument(dateFrom==null || dateTo==null || dateTo.isAfter(dateFrom)); this.dateFrom = dateFrom; } public void setDateTo(LocalDate dateTo) {
public void setDateFrom(LocalDate dateFrom) { Preconditions.checkArgument(dateFrom==null || dateTo==null || dateTo.isAfter(dateFrom)); this.dateFrom = dateFrom; } public void setDateTo(LocalDate dateTo) {
public void setDateTo(LocalDate dateTo) { Preconditions.checkArgument(dateFrom==null || dateTo==null || dateTo.isAfter(dateFrom)); this.dateTo = dateTo; } public void setPersonAssigned(Boolean personAssigned) {
public boolean isValid(LocalDate value, ConstraintValidatorContext constraintValidatorContext) { //null values are valid if ( value == null ) { return true; } return (value).isAfter(new LocalDate(new Date())); } }
private LocalDate getSelectDate(LocalDate localDate) { if (localDate.isBefore(startDate)) { return startDate; } else if (localDate.isAfter(endDate)) { return endDate; } else { return localDate; } }
private boolean isDateWithinValidRange() { if(mMinDate != null && mDate.isBefore(mMinDate)) return false; if(mMaxDate != null && mDate.isAfter(mMaxDate)) return false; return true; } }
@TargetApi(11) public void setMaxDate(LocalDate date) { mMaxDate = date; if(date != null && mMinDate != null && mMinDate.isAfter(date)) throw new IllegalArgumentException("Requested max date " + date + " is after min date " + mMinDate); if(mMaxDate != null) mPicker.setMaxDate(mMaxDate.toDate().getTime()); updateMessage(); }
private LocalDate adjustTargetDate(final List<Invoice> existingInvoices, final LocalDate targetDate) { if (existingInvoices == null) { return targetDate; } LocalDate maxDate = targetDate; for (final Invoice invoice : existingInvoices) { if (invoice.getTargetDate().isAfter(maxDate)) { maxDate = invoice.getTargetDate(); } } return maxDate; }
public ActionForward searchSpaceEvents(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { SearchOccupationEventsBean bean = getRenderedObject(); if (bean.getStart().isAfter(bean.getEnd())) { request.setAttribute("startAfterEnd", true); } else { Collection<SpaceOccupationEventBean> results = run(bean); request.setAttribute("results", results); } request.setAttribute("bean", bean); return mapping.findForward("prepareSearchEvents"); }
private List<WebHookHistoryItem> findAllItemsSince(LocalDate untilDate, int numberOfDays) { List<WebHookHistoryItem> erroredItemsSince = new ArrayList<>(); LocalDate sinceDate = untilDate.minusDays(numberOfDays); for (WebHookHistoryItem item : this.webHookHistoryItems.values()) { LocalDate itemTimeStamp = item.getTimestamp().toLocalDate(); if (sinceDate.isBefore(itemTimeStamp) && untilDate.isAfter(itemTimeStamp)) { erroredItemsSince.add(item); } } return erroredItemsSince; }
@Override protected void checkBoundary(final LocalDate date) { final LocalDate early = getHolidayCalendar().getEarlyBoundary(); if (early != null && early.isAfter(date)) { throw new IndexOutOfBoundsException(date + " is before the early boundary " + early); } final LocalDate late = getHolidayCalendar().getLateBoundary(); if (late != null && late.isBefore(date)) { throw new IndexOutOfBoundsException(date + " is after the late boundary " + late); } }
static public int countWorkDaysBetween(final LocalDate startDate, final LocalDate endDate) { int result = 0; LocalDate current = startDate.plusDays(1); while (!current.isAfter(endDate)) { if (isWorkDay(current)) { result++; } current = current.plusDays(1); } return result; }
public void setWeekTimeUnit() { LocalDate origFromDate = fromDate; timeUnit = TimeUnit.WEEK; fromDate = new LocalDate(fromDate.getYear(), fromDate.getMonthOfYear(), fromDate.getDayOfMonth()) .withDayOfWeek(TimeUtils.FIRST_DAY_OF_WEEK); // Unfortunately, the above code returns the following week instead of the containing week for // every day other than Sunday. Check for this and decrement the week if needed. if(fromDate.isAfter(origFromDate)) { fromDate = fromDate.minusWeeks(1); } } }
@Override protected boolean isCoherent() { if ((hasMinComplete()) && (hasMaxComplete()) && (getMin().isAfter(getMax(false)))) { return false; } return true; }
public void validate() { if (getEndDate() != null && getStartDate().isAfter(getEndDate())) { throw(new ValidationException(MEDICINE_END_DATE_CANNOT_BE_BEFORE_START_DATE)); } } }
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; }
@Override protected boolean doesNewerVersionExist(HrBusinessObject pbo) { boolean futureEffectiveDateExists = false; GracePeriodRule gracePeriodRule = (GracePeriodRule) pbo; GracePeriodRule lastGracePeriodRule = TkServiceLocator.getGracePeriodService().getGracePeriodRule(TKUtils.END_OF_TIME); if (lastGracePeriodRule != null && lastGracePeriodRule.getEffectiveLocalDate() != null && gracePeriodRule.getEffectiveLocalDate() != null) { futureEffectiveDateExists = lastGracePeriodRule.getEffectiveLocalDate().isAfter(gracePeriodRule.getEffectiveLocalDate()); } return futureEffectiveDateExists; }
protected void validate( @NotNull E entry ) throws InvalidEntryException { if ( findEntryWithBegin( entry.getBegin() ) != null ) { throw new InvalidEntryException( "An entry with the same begin still exists " + entry.getBegin() ); } if ( entry.getBegin().isBefore( getBegin() ) ) { throw new InvalidEntryException( "Begin date does not fit. <" + entry.getBegin() + "> is before <" + getBegin() + ">" ); } if ( entry.getBegin().isAfter( getEnd() ) ) { throw new InvalidEntryException( "End date is too late. <" + entry.getBegin() + "> is after <" + getEnd() + '>' ); } }
@Override protected boolean doesNewerVersionExist(HrBusinessObject pbo) { boolean futureEffectiveDateExists = false; TimeCollectionRule timeCollectionRule = (TimeCollectionRule) pbo; TimeCollectionRule lastTimeCollectionRule = TkServiceLocator.getTimeCollectionRuleService().getTimeCollectionRule(timeCollectionRule.getDept(), timeCollectionRule.getWorkArea(), timeCollectionRule.getPayType(), timeCollectionRule.getGroupKeyCode(), TKUtils.END_OF_TIME); if (lastTimeCollectionRule != null && lastTimeCollectionRule.getEffectiveLocalDate() != null && timeCollectionRule.getEffectiveLocalDate() != null) { futureEffectiveDateExists = lastTimeCollectionRule.getEffectiveLocalDate().isAfter(timeCollectionRule.getEffectiveLocalDate()); } return futureEffectiveDateExists; }