List of usage examples for org.joda.time LocalDate isAfter
public boolean isAfter(ReadablePartial partial)
From source file:module.organization.domain.Party.java
License:Open Source License
/** * //from ww w . j a va2 s . c o m * @param child child * @param type type * @param begin begin * @param end end * @param justification an information justification/reason for the change of accountability, or null if there is none, or * none is provided * @return Accountability */ @Atomic public Accountability addChild(final Party child, final AccountabilityType type, final LocalDate begin, final LocalDate end, String justification) { Accountability intersectingAccountability = getIntersectingChildAccountability(child, type, begin, end); if (intersectingAccountability != null) { if (begin == null || (begin != null && intersectingAccountability.getBeginDate() != null && begin.isBefore(intersectingAccountability.getBeginDate()))) { intersectingAccountability.setBeginDate(begin); } if (end == null || (end != null && intersectingAccountability.getEndDate() != null && end.isAfter(intersectingAccountability.getEndDate()))) { intersectingAccountability.editDates(intersectingAccountability.getBeginDate(), end); } return intersectingAccountability; } return Accountability.create(this, child, type, begin, end, justification); }
From source file:module.siadap.domain.Siadap.java
License:Open Source License
private boolean isDuringReviewCommissionWaitingPeriod() { if (getAcknowledgeValidationDate() == null) { return false; }/* w w w . j a v a 2s. c o m*/ if (getForcedReadinessToHomologation()) { return false; } LocalDate limitDate = getAcknowledgeValidationDate() .plusDays(getSiadapYearConfiguration().getReviewCommissionWaitingPeriod()); LocalDate today = new LocalDate(); return !today.isAfter(limitDate); }
From source file:net.lshift.diffa.adapter.scanning.DateRangeConstraint.java
License:Apache License
public boolean contains(LocalDate value) { if (start != null && value.isBefore(start)) return false; if (end != null && value.isAfter(end)) return false; return true;/*from ww w . j a v a2 s . c o m*/ }
From source file:net.objectlab.kit.datecalc.joda.LocalDateCalculator.java
License:Apache License
@Override protected LocalDate compareDate(final LocalDate date1, final LocalDate date2, final boolean returnEarliest) { if (date1 == null || date2 == null) { return null; }//from w w w.j a va 2s. co m if (returnEarliest) { return date1.isAfter(date2) ? date2 : date1; } else { return date2.isAfter(date1) ? date2 : date1; } }
From source file:net.objectlab.kit.datecalc.joda.LocalDateCalculator.java
License:Apache License
@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); }// w w w .jav a 2 s . c om final LocalDate late = getHolidayCalendar().getLateBoundary(); if (late != null && late.isBefore(date)) { throw new IndexOutOfBoundsException(date + " is after the late boundary " + late); } }
From source file:net.objectlab.kit.datecalc.joda.LocalDateIMMDateCalculator.java
License:Apache License
/** * Returns a list of IMM dates between 2 dates, it will exclude the start * date if it is an IMM date but would include the end date if it is an IMM. * * @param start/*from w w w . ja v a 2 s . c om*/ * start of the interval, excluded * @param end * end of the interval, may be included. * @param period * specify when the "next" IMM is, if quarterly then it is the * conventional algorithm. * @return list of IMM dates */ public List<LocalDate> getIMMDates(final LocalDate start, final LocalDate end, final IMMPeriod period) { final List<LocalDate> dates = new ArrayList<LocalDate>(); LocalDate date = start; while (true) { date = getNextIMMDate(true, date, period); if (!date.isAfter(end)) { dates.add(date); } else { break; } } return dates; }
From source file:net.objectlab.kit.datecalc.joda.LocalDateIMMDateCalculator.java
License:Apache License
private LocalDate calculateIMMMonth(final boolean requestNextIMM, final LocalDate startDate, final int month) { int monthOffset = 0; LocalDate date = startDate; switch (month) { case MARCH:/*from w w w .j av a2 s . com*/ case JUNE: case SEPTEMBER: case DECEMBER: final LocalDate immDate = calculate3rdWednesday(date); if (requestNextIMM && !date.isBefore(immDate)) { date = date.plusMonths(MONTHS_IN_QUARTER); } else if (!requestNextIMM && !date.isAfter(immDate)) { date = date.minusMonths(MONTHS_IN_QUARTER); } break; default: if (requestNextIMM) { monthOffset = (MONTH_IN_YEAR - month) % MONTHS_IN_QUARTER; date = date.plusMonths(monthOffset); } else { monthOffset = month % MONTHS_IN_QUARTER; date = date.minusMonths(monthOffset); } break; } return date; }
From source file:net.sourceforge.fenixedu.domain.Job.java
License:Open Source License
private void checkValidDates(LocalDate beginDate, LocalDate endDate) { if (beginDate != null && endDate != null) { if (beginDate.isAfter(endDate)) { throw new DomainException("job.creation.beginDate.after.endDate"); }//from w w w. java2 s. c o m } }
From source file:net.sourceforge.fenixedu.domain.personnelSection.contracts.PersonProfessionalCategory.java
License:Open Source License
public boolean betweenDates(LocalDate beginDate, LocalDate endDate) { if (isValid()) { if (getEndDate() == null) { return endDate == null || !getBeginDate().isAfter(endDate); }/*from www .j a v a2 s . c o m*/ if (endDate == null) { return !beginDate.isAfter(getEndDate()); } Interval dateInterval = new Interval(beginDate.toDateTimeAtStartOfDay(), endDate.toDateTimeAtStartOfDay().plusDays(1)); return getInterval().overlaps(dateInterval); } return false; }
From source file:net.sourceforge.fenixedu.domain.phd.debts.PhdGratuityPaymentPeriod.java
License:Open Source License
public boolean contains(LocalDate date) { LocalDate start = new LocalDate(date.getYear(), getMonthStart(), getDayStart()); LocalDate end = new LocalDate(date.getYear(), getMonthEnd(), getDayEnd()); if ((date.equals(start) || date.isAfter(start)) && (date.equals(end) || date.isBefore(end))) { return true; } else {//from ww w .j ava 2s. c om return false; } }