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()); } }
@Override protected PhdProgramCandidacyProcess executeActivity( PhdProgramCandidacyProcess process, IUserView userView, Object object) { PhdProgramCandidacyProcessBean bean = (PhdProgramCandidacyProcessBean) object; process.setCandidacyDate(bean.getCandidacyDate()); process.setWhenRatified(bean.getWhenRatified()); return process; }
@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; }
@Override protected void activityPreConditions(PhdProgramCandidacyProcess process, User userView) { if (PREVIOUS_STATE.contains(process.getActiveState())) { return; } throw new PreConditionNotValidException(); }
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()); } }
@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; }
@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); }
@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; }
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); }
@Override protected void activityPreConditions(PhdProgramCandidacyProcess process, User userView) { if (!process.isInState(PhdProgramCandidacyProcessState.PENDING_FOR_COORDINATOR_OPINION)) { throw new PreConditionNotValidException(); } }
@Override protected void activityPreConditions(PhdProgramCandidacyProcess process, IUserView userView) { if (!process.isAllowedToManageProcess(userView)) { throw new PreConditionNotValidException(); } }