@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 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 ""; }