Esempio n. 1
0
  @Override
  public void deleteVotingPeriod(
      DelegateElectionVotingPeriod votingPeriod, boolean removeElection) {

    if (!votingPeriod.isPastPeriod() && !votingPeriod.isCurrentPeriod()) {
      super.deleteVotingPeriod(votingPeriod);
      if (removeElection) {
        this.deleteCandidacyPeriod();
      }
    } else {
      throw new DomainException(
          "error.yearDelegateElections.delete.pastPeriod",
          new String[] {
            getDegree().getSigla(),
            getCurricularYear().getYear().toString(),
            getVotingPeriod(votingPeriod.getStartDate(), votingPeriod.getEndDate()).getPeriod()
          });
    }
  }
Esempio n. 2
0
  @Override
  public void editVotingPeriod(
      YearMonthDay startDate, YearMonthDay endDate, DelegateElectionVotingPeriod votingPeriod) {
    if (!endDate.isAfter(getLastVotingEndDate())) {
      throw new DomainException(
          "error.elections.edit.newEndDateMustBeGreater",
          getDegree().getSigla(),
          getCurricularYear().getYear().toString());
    }

    if (!votingPeriod.isPastPeriod()) {
      votingPeriod.setEndDate(endDate);
    } else {
      throw new DomainException(
          "error.yearDelegateElections.edit.pastPeriod",
          new String[] {
            getDegree().getSigla(),
            getCurricularYear().getYear().toString(),
            votingPeriod.getPeriod()
          });
    }
  }