List of usage examples for org.joda.time LocalDate isAfter
public boolean isAfter(ReadablePartial partial)
From source file:com.axelor.apps.tool.date.DateTool.java
License:Open Source License
public static boolean isProrata(LocalDate dateFrame1, LocalDate dateFrame2, LocalDate date1, LocalDate date2) { if (date2 == null && (date1.isBefore(dateFrame2) || date1.isEqual(dateFrame2))) { return true; } else if (date2 == null) { return false; }//from w ww .jav a 2 s . co m if (((date1.isAfter(dateFrame1) || date1.isEqual(dateFrame1)) && (date1.isBefore(dateFrame2) || date1.isEqual(dateFrame2))) || ((date2.isAfter(dateFrame1) || date2.isEqual(dateFrame1)) && (date2.isBefore(dateFrame2) || date2.isEqual(dateFrame2))) || (date1.isBefore(dateFrame1) && date2.isAfter(dateFrame2))) { return true; } return false; }
From source file:com.axelor.apps.tool.date.DateTool.java
License:Open Source License
public static boolean isBetween(LocalDate dateFrame1, LocalDate dateFrame2, LocalDate date) { if (dateFrame2 == null && (date.isAfter(dateFrame1) || date.isEqual(dateFrame1))) { return true; } else if (dateFrame2 != null && (date.isAfter(dateFrame1) || date.isEqual(dateFrame1)) && (date.isBefore(dateFrame2) || date.isEqual(dateFrame2))) { return true; } else {/*ww w . jav a2 s. c o m*/ return false; } }
From source file:com.axelor.apps.tool.date.DateTool.java
License:Open Source License
/** * Calculer la date de la prochaine occurence d'un vnement suivant le calcul suivant : * Supprimer autant de fois que possible la frquence en mois la date vise * tout en tant suprieure la date de dbut * /*from ww w . ja va2 s .c o m*/ * @param startDate * La date de dbut * * @param goalDate * La date vise * * @param frequencyInMonth * Nombre de mois reprsentant la frquence de l'vnement */ public static LocalDate nextOccurency(LocalDate startDate, LocalDate goalDate, int frequencyInMonth) { if (frequencyInMonth == 0) { LOG.debug("La frquence ne doit pas etre gale 0."); return null; } else { if (startDate == null && goalDate == null) { return null; } else { if (startDate.isAfter(goalDate)) { return goalDate; } return minusMonths(goalDate, days360MonthsBetween(startDate.plusDays(1), goalDate.minusDays(1)) / frequencyInMonth * frequencyInMonth); } } }
From source file:com.axelor.apps.tool.date.DateTool.java
License:Open Source License
/** * Calculer la date de la prochaine occurence d'un vnement suivant le calcul suivant : * Supprimer autant de fois que possible la frquence en mois la date vise * tout en tant suprieure ou gale la date de dbut * /*from w ww .j ava2s. c om*/ * @param startDate * La date de dbut * * @param goalDate * La date vise * * @param frequencyInMonth * Nombre de mois reprsentant la frquence de l'vnement */ public LocalDate nextOccurencyStartDateIncluded(LocalDate startDate, LocalDate goalDate, int frequencyInMonth) { if (frequencyInMonth == 0) { LOG.debug("La frquence ne doit pas etre gale 0."); return null; } else { if (startDate == null && goalDate == null) { return null; } else { if (startDate.isAfter(goalDate)) { return goalDate; } return minusMonths(goalDate, days360MonthsBetween(startDate, goalDate.minusDays(1)) / frequencyInMonth * frequencyInMonth); } } }
From source file:com.axelor.apps.tool.date.DateTool.java
License:Open Source License
/** * Calculer la date de la dernire occurence d'un vnement suivant le calcul suivant : * Ajouter autant de fois que possible la frquence en mois la date de dbut * tout en tant infrieure ou gale la date de fin * @param startDate//from w ww . j av a 2s . c om * La date de dbut * * @param endDate * La date de fin * * @param frequencyInMonth * Nombre de mois reprsentant la frquence de l'vnement */ public static LocalDate lastOccurency(LocalDate startDate, LocalDate endDate, int frequencyInMonth) { if (frequencyInMonth == 0) { LOG.debug("La frquence ne doit pas etre gale 0."); return null; } else { if ((startDate == null && endDate == null) || startDate.isAfter(endDate)) { return null; } else { return plusMonths(startDate, days360MonthsBetween(startDate, endDate) / frequencyInMonth * frequencyInMonth); } } }
From source file:com.axelor.apps.tool.date.Period.java
License:Open Source License
public Period prorata(LocalDate date1, LocalDate date2) { Period p = null;//w ww. ja va 2s .c o m if (DateTool.isProrata(this.from, this.to, date1, date2)) { p = new Period(this); if (date1.isAfter(this.from)) { p.setFrom(date1); } if (date2 != null && date2.isBefore(this.to)) { p.setTo(date2); } } return p; }
From source file:com.axelor.auth.AuthUtils.java
License:Open Source License
public static boolean isActive(final User user) { if (user.getArchived() == Boolean.TRUE || user.getBlocked() == Boolean.TRUE) { return false; }/*from w w w . j a va2 s .c o m*/ final LocalDate from = user.getActivateOn(); final LocalDate till = user.getExpiresOn(); final LocalDate now = LocalDate.now(); if ((from != null && from.isAfter(now)) || (till != null && till.isBefore(now))) { return false; } return true; }
From source file:com.cedarsoft.history.core.AbstractTimeEntry.java
License:Open Source License
/** * {@inheritDoc}// ww w. j a v a 2 s . c om */ @Override public boolean isActiveAt(@Nonnull LocalDate date) { if (!getBegin().isBefore(date)) { return false; } LocalDate theEnd = end; if (theEnd == null) { return true; } else { return theEnd.isAfter(date); } }
From source file:com.cedarsoft.history.core.ContinuousEntriesInformation.java
License:Open Source License
/** * <p>findEntries</p>//w ww . j av a 2s . c o m * * @param begin a LocalDate object. * @param end a LocalDate object. * @return a List object. */ @Nonnull public List<? extends E> findEntries(@Nonnull LocalDate begin, @Nonnull LocalDate end) { if (end.isBefore(this.begin)) { throw new IllegalArgumentException("End " + end + " is before beginning of the history: " + this.begin); } if (begin.isAfter(this.end)) { throw new IllegalArgumentException("Begin " + begin + " is after ending of the history: " + this.end); } List<E> foundEntries = new ArrayList<E>(); lock.readLock().lock(); try { for (E entry : this.entries) { if (DateUtils.isBetween(entry.getBegin(), begin, end)) { foundEntries.add(entry); } } } finally { lock.readLock().unlock(); } return foundEntries; }
From source file:com.cedarsoft.history.core.DateUtils.java
License:Open Source License
/** * Returns true if the given date is after/same than the begin and before the end * * @param date the date//from www .ja v a2 s . c o m * @param begin the begin (inclusive) * @param end the end (exclusive) * @return whether the given date is between the two given dates */ public static boolean isBetween(@Nonnull LocalDate date, @Nonnull LocalDate begin, @Nonnull LocalDate end) { if (begin.isAfter(date)) { return false; } return date.isBefore(end); }