public Collection<ElectionEvent> getUnfinishedElectionEvents() { try { return electionSessionBean.getUnfinishedElectionEvents( electionSessionBean.getElection(electionId)); } catch (ControllerException ex) { Logger.getLogger(ElectionEventManagedBean.class.getName()).log(Level.SEVERE, null, ex); return null; } }
public String changeEvent() { try { ElectionEvent electionEvent = electionSessionBean.getElectionEvent(getEventId()); electionEvent.setName(eventName); electionEvent.setInfo(info); electionSessionBean.changeEvent(electionEvent); FacesMessage m = new FacesMessage("Event was succesfully changed"); FacesContext.getCurrentInstance().addMessage("", m); } catch (ControllerException ex) { Logger.getLogger(ElectionEventManagedBean.class.getName()).log(Level.SEVERE, null, ex); return ""; } return ""; }
public List<SelectItem> getVoterSel() { Collection<Person> col = electionSessionBean.getAllPerson(); voterSel = new ArrayList<SelectItem>(); for (int i = 0; i < col.size(); i++) { voterSel.add(new SelectItem(((Person) col.toArray()[i]).getLogin())); } return voterSel; }
public Collection<Voter> getEventVoters() { try { return electionSessionBean.getEventVoters(getEventId()); } catch (ControllerException ex) { Logger.getLogger(ElectionEventManagedBean.class.getName()).log(Level.SEVERE, null, ex); } return null; }
public Collection<Election> getComElection() { String login = tellerSessionBean.getLoginLoggedUser(); try { return electionSessionBean.getCommissionerElection(login); } catch (ControllerException ex) { Logger.getLogger(ElectionEventManagedBean.class.getName()).log(Level.SEVERE, null, ex); } return null; }
public String createEvent() { try { electionSessionBean.createElectionEvent(electionId, eventName, info); FacesMessage m = new FacesMessage("Event \"" + eventName + "\" was succesfully created"); FacesContext.getCurrentInstance().addMessage("", m); } catch (ControllerException ex) { Logger.getLogger(ElectionEventManagedBean.class.getName()) .log(Level.SEVERE, "Error during event creation.", ex); return ""; } setElectionId(electionId); return "goViewEvents"; }
@PostConstruct public void init() { Integer id = getEventId(); if (id == null) { return; } try { electionEvent = electionSessionBean.getElectionEvent(id); this.eventName = electionEvent.getName(); this.info = electionEvent.getInfo(); } catch (ControllerException ex) { Logger.getLogger(ElectionEventManagedBean.class.getName()).log(Level.SEVERE, null, ex); } }
public String addVoter() { Collection<Person> personList = getPersonList(); Person finalPerson = null; for (Person p : personList) { if (p.getLogin().equals(voterLogin)) { finalPerson = p; break; } } if (finalPerson == null) { return ""; } try { electionSessionBean.addVoter(voterLogin, getEventId()); FacesMessage m = new FacesMessage("Voter " + voterLogin + " was successfully added"); FacesContext.getCurrentInstance().addMessage("", m); } catch (ControllerException ex) { Logger.getLogger(ElectionEventManagedBean.class.getName()).log(Level.SEVERE, null, ex); return ""; } return ""; }
private Collection<Person> getPersonList() { return electionSessionBean.getAllPerson(); }