Exemplo n.º 1
0
  public void updateSituationOnPHDCandidacy() {
    PhdProgramCandidacyProcess process = getProcess();

    if (this.getStateDate() == null) {
      throw new DomainException("state.date.null");
    }

    PHDProgramCandidacy candidacy = process.getCandidacy();
    CandidacySituation situation = null;

    switch (this.getType()) {
      case PRE_CANDIDATE:
        situation = new PreCandidacySituation(candidacy);
        break;
      case STAND_BY_WITH_MISSING_INFORMATION:
      case STAND_BY_WITH_COMPLETE_INFORMATION:
        situation = new StandByCandidacySituation(candidacy);
        break;
      case CONCLUDED:
        situation = new AdmittedCandidacySituation(candidacy);
        break;
      case REJECTED:
        situation = new NotAdmittedCandidacySituation(candidacy);
        break;
      default:
    }

    if (situation != null) {
      situation.setSituationDate(this.getStateDate());
    }
  }
Exemplo n.º 2
0
  @Override
  protected PhdProgramCandidacyProcess executeActivity(
      PhdProgramCandidacyProcess process, IUserView userView, Object object) {
    PhdProgramCandidacyProcessBean bean = (PhdProgramCandidacyProcessBean) object;

    process.setCandidacyDate(bean.getCandidacyDate());
    process.setWhenRatified(bean.getWhenRatified());
    return process;
  }
Exemplo n.º 3
0
  @Override
  protected PhdProgramCandidacyProcess executeActivity(
      PhdProgramCandidacyProcess process, User userView, Object object) {
    final PhdProgramCandidacyProcessStateBean bean = (PhdProgramCandidacyProcessStateBean) object;
    process.createState(
        PhdProgramCandidacyProcessState.REJECTED, userView.getPerson(), bean.getRemarks());

    AlertService.alertAcademicOffice(
        process.getIndividualProgramProcess(),
        AcademicOperationType.VIEW_PHD_CANDIDACY_ALERTS,
        "message.phd.alert.candidacy.reject.subject",
        "message.phd.alert.candidacy.reject.body");

    return process;
  }
Exemplo n.º 4
0
 @Override
 protected void activityPreConditions(PhdProgramCandidacyProcess process, User userView) {
   if (PREVIOUS_STATE.contains(process.getActiveState())) {
     return;
   }
   throw new PreConditionNotValidException();
 }
Exemplo n.º 5
0
 private void checkType(
     final PhdProgramCandidacyProcess process, final PhdProgramCandidacyProcessState type) {
   final PhdProgramCandidacyProcessState currentType = process.getActiveState();
   if (currentType != null && currentType.equals(type)) {
     throw new DomainException(
         "error.PhdCandidacyProcessState.equals.previous.state", type.getLocalizedName());
   }
 }
Exemplo n.º 6
0
 @SuppressWarnings("unchecked")
 @Override
 protected PhdProgramCandidacyProcess executeActivity(
     PhdProgramCandidacyProcess process, User userView, Object object) {
   for (final PhdCandidacyRefereeBean bean : (List<PhdCandidacyRefereeBean>) object) {
     process.addCandidacyReferees(new PhdCandidacyReferee(process, bean));
   }
   return process;
 }
Exemplo n.º 7
0
  @Override
  protected void fillReport() {

    final PhdProgramCandidacyProcess candidacyProcess = getNotification().getCandidacyProcess();
    final Person person = candidacyProcess.getPerson();
    final PhdIndividualProgramProcess individualProgramProcess =
        candidacyProcess.getIndividualProgramProcess();

    addParameter(
        "administrativeOfficeCoordinator",
        individualProgramProcess
            .getPhdProgram()
            .getAdministrativeOffice()
            .getUnit()
            .getActiveUnitCoordinator()
            .getFirstAndLastName());

    addParameter("name", person.getName());
    addParameter("address", person.getAddress());
    addParameter("areaCode", person.getAreaCode());
    addParameter("areaOfAreaCode", person.getAreaOfAreaCode());
    addParameter(
        "programName",
        individualProgramProcess.getPhdProgram().getName().getContent(getLanguage()));

    addParameter("processNumber", individualProgramProcess.getProcessNumber());

    final LocalDate whenRatified = candidacyProcess.getWhenRatified();

    addParameter(
        "ratificationDate", whenRatified != null ? whenRatified.toString(getDateFormat()) : "");

    addParameter("insuranceFee", getInsuranceFee(individualProgramProcess));
    addParameter("registrationFee", getRegistrationFee(individualProgramProcess, whenRatified));

    addParameter("date", new LocalDate().toString(getDateFormat()));
    addParameter("notificationNumber", getNotification().getNotificationNumber());

    addGuidingsParameter(individualProgramProcess);
  }
Exemplo n.º 8
0
  @Override
  protected PhdProgramCandidacyProcess executeActivity(
      PhdProgramCandidacyProcess process, User userView, Object object) {

    final PhdIndividualProgramProcess mainProcess = process.getIndividualProgramProcess();
    if (mainProcess.getPhdProgram() == null) {
      throw new DomainException(
          "error.phd.candidacy.PhdProgramCandidacyProcess.RequestCandidacyReview.invalid.phd.program");
    }

    final PhdProgramCandidacyProcessStateBean bean = (PhdProgramCandidacyProcessStateBean) object;
    process.createState(
        PhdProgramCandidacyProcessState.PENDING_FOR_COORDINATOR_OPINION,
        userView.getPerson(),
        bean.getRemarks());

    if (bean.getGenerateAlert()) {
      AlertService.alertCoordinators(mainProcess, subject(), body(mainProcess));
    }

    return process;
  }
Exemplo n.º 9
0
  public static PhdCandidacyProcessState createStateWithInferredStateDate(
      final PhdProgramCandidacyProcess process,
      final PhdProgramCandidacyProcessState type,
      final Person person,
      final String remarks) {

    DateTime stateDate = null;

    PhdCandidacyProcessState mostRecentState = process.getMostRecentState();

    switch (type) {
      case PRE_CANDIDATE:
      case STAND_BY_WITH_MISSING_INFORMATION:
      case STAND_BY_WITH_COMPLETE_INFORMATION:
      case PENDING_FOR_COORDINATOR_OPINION:
      case WAITING_FOR_SCIENTIFIC_COUNCIL_RATIFICATION:
        if (mostRecentState != null) {
          stateDate = mostRecentState.getStateDate().plusMinutes(1);
        } else {
          if (process.getCandidacyDate() == null) {
            throw new PhdDomainOperationException(
                "error.phd.PhdCandidacyProcessState.candidacyDate.required");
          }

          stateDate = process.getCandidacyDate().toDateTimeAtStartOfDay();
        }

        break;
      case RATIFIED_BY_SCIENTIFIC_COUNCIL:
        if (process.getWhenRatified() == null) {
          throw new PhdDomainOperationException(
              "error.phd.PhdCandidacyProcessState.whenRatified.required");
        }

        stateDate = process.getWhenRatified().toDateTimeAtStartOfDay();
        break;
      case CONCLUDED:
        if (process.getWhenStartedStudies() == null) {
          throw new PhdDomainOperationException(
              "error.phd.PhdCandidacyProcessState.whenStartedStudies.required");
        }

        stateDate = process.getWhenStartedStudies().toDateTimeAtStartOfDay();
        break;
      case REJECTED:
        stateDate = mostRecentState.getStateDate().plusMinutes(1);
        break;
      default:
        throw new DomainException("I cant handle this");
    }

    return createStateWithGivenStateDate(process, type, person, remarks, stateDate);
  }
Exemplo n.º 10
0
 @Override
 protected void activityPreConditions(PhdProgramCandidacyProcess process, User userView) {
   if (!process.isInState(PhdProgramCandidacyProcessState.PENDING_FOR_COORDINATOR_OPINION)) {
     throw new PreConditionNotValidException();
   }
 }
Exemplo n.º 11
0
 @Override
 protected void activityPreConditions(PhdProgramCandidacyProcess process, IUserView userView) {
   if (!process.isAllowedToManageProcess(userView)) {
     throw new PreConditionNotValidException();
   }
 }