public ActionForward manageSingleYearDelegateVotingPeriod( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { final DelegateElection election = FenixFramework.getDomainObject(request.getParameter("selectedPeriod")); request.setAttribute("selectedPeriod", election); if (election.hasLastVotingPeriod() && !election.getLastVotingPeriod().isPastPeriod()) { return mapping.findForward("editYearDelegateVotingPeriod"); } else { return mapping.findForward("createYearDelegateVotingPeriod"); } }
public ActionForward secondRoundElections( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { final DelegateElection election = FenixFramework.getDomainObject(request.getParameter("selectedPeriod")); List<Student> candidatesHadVoted = new LinkedList<Student>(); List<Student> candidatesHadNotVoted = new LinkedList<Student>(); ElectionPeriodBean bean = new ElectionPeriodBean(); bean.setDegree(election.getDegree()); bean.setDegreeType(election.getDegree().getDegreeType()); bean.setCurricularYear(((YearDelegateElection) election).getCurricularYear()); bean.setElection(election); DelegateElectionVotingPeriod votingPeriod = election.getLastVotingPeriod(); request.setAttribute("electionPeriodBean", bean); request.setAttribute("newElectionPeriodBean", bean); request.setAttribute( "secondRoundElectionsCandidatesBean", new NewRoundElectionBean(candidatesHadVoted, election)); request.setAttribute( "secondRoundElectionsNotCandidatesBean", new NewRoundElectionBean(candidatesHadNotVoted, election)); if (!votingPeriod.isFirstRoundElections()) { return mapping.findForward("secondRoundElections"); } for (Student candidate : election.getCandidaciesHadVoted(votingPeriod)) { candidatesHadVoted.add(candidate); } for (Student candidate : election.getNotCandidaciesHadVoted(votingPeriod)) { candidatesHadNotVoted.add(candidate); } return mapping.findForward("secondRoundElections"); }