Пример #1
0
 private void checkIfCanCreate(final DateTime start, final DateTime end) {
   for (final CandidacyPeriod period : Bennu.getInstance().getCandidacyPeriodsSet()) {
     if (!period.equals(this) && period.isEpflCandidacyPeriod() && period.intercept(start, end)) {
       throw new DomainException(
           "error.EPFLInstitutionPhdCandidacyPeriod.already.contains.candidacyPeriod.in.given.dates");
     }
   }
 }
Пример #2
0
  public static EPFLPhdCandidacyPeriod readEPFLPhdCandidacyPeriodForDateTime(final DateTime date) {
    for (final CandidacyPeriod period : Bennu.getInstance().getCandidacyPeriodsSet()) {
      if (period.isEpflCandidacyPeriod() && period.contains(date)) {
        return (EPFLPhdCandidacyPeriod) period;
      }
    }

    return null;
  }
Пример #3
0
  public static EPFLPhdCandidacyPeriod getMostRecentCandidacyPeriod() {
    PhdCandidacyPeriod mostRecentCandidacyPeriod = null;

    for (CandidacyPeriod candidacyPeriod : Bennu.getInstance().getCandidacyPeriodsSet()) {
      if (!candidacyPeriod.isEpflCandidacyPeriod()) {
        continue;
      }

      if (candidacyPeriod.getStart().isAfterNow()) {
        continue;
      }

      if (mostRecentCandidacyPeriod == null) {
        mostRecentCandidacyPeriod = (PhdCandidacyPeriod) candidacyPeriod;
        continue;
      }

      if (candidacyPeriod.getStart().isAfter(mostRecentCandidacyPeriod.getStart())) {
        mostRecentCandidacyPeriod = (PhdCandidacyPeriod) candidacyPeriod;
      }
    }

    return (EPFLPhdCandidacyPeriod) mostRecentCandidacyPeriod;
  }