public CandidacySituation nextState(String nextState) { CandidacySituationType situationType = CandidacySituationType.valueOf(nextState); if (!situationType.equals(this.getActiveCandidacySituation().getCandidacySituationType()) && getValidNextStates().contains(nextState)) { switch (situationType) { case CANCELLED: return new CancelledCandidacySituation(this); case PRE_CANDIDACY: return new PreCandidacySituation(this); case STAND_BY: return new StandByCandidacySituation(this); case STAND_BY_CONFIRMED_DATA: return new StandByConfirmedDataCandidacySituation(this); case STAND_BY_FILLED_DATA: return new StandByFilledDataCandidacySituation(this); case REGISTERED: return new RegisteredCandidacySituation(this); case ADMITTED: return new AdmittedCandidacySituation(this); case NOT_ADMITTED: return new NotAdmittedCandidacySituation(this); case SUBSTITUTE: return new SubstituteCandidacySituation(this); default: break; } } return null; }
public boolean isActive() { final CandidacySituationType situationType = getActiveCandidacySituationType(); return situationType != null && situationType.isActive(); }
private boolean isCancelling(final String nextState) { return CandidacySituationType.valueOf(nextState) == CandidacySituationType.CANCELLED; }