@PostConstruct public void load() { if (this.eventId != null && !this.eventId.isEmpty()) { Event event = eventBean.find(eventId); this.session = new SessionEvent(); this.session.setEvent(event); this.selectedEvent = event.getId(); this.venueSelectionMBean.setSelectedEvent(this.selectedEvent); } if (this.id != null && !this.id.isEmpty()) { this.session = sessionBean.find(this.id); Event event = this.session.getEvent(); this.selectedEvent = event.getId(); if (this.session.getTrack() != null) { this.selectedTrack = this.session.getTrack().getId(); } this.venueSelectionMBean.setSelectedEvent(this.selectedEvent); if (this.session.getRoom() != null) { this.venueSelectionMBean.setSelectedVenue(this.session.getRoom().getVenue().getId()); this.venueSelectionMBean.setSelectedRoom(this.session.getRoom().getId()); } } if (this.session == null) { this.session = new SessionEvent(); } }
public String save() { Event evt = eventBean.find(selectedEvent); this.session.setEvent(evt); this.session.setRoom(this.venueSelectionMBean.getRoom()); if (this.selectedTrack != null && !this.selectedTrack.isEmpty()) { Track track = new Track(this.selectedTrack); this.session.setTrack(track); } sessionBean.save(this.session); return "event?faces-redirect=true&tab=2&id=" + this.eventId; }