public boolean isEditMode() { if (userBean.getLoggedIn()) { return performancesSessionBean.isEditMode(); } else { return false; } }
public void setEditMode(boolean editMode) { if (userBean.getLoggedIn()) { performancesSessionBean.setEditMode(editMode); } else { performancesSessionBean.setEditMode(false); } }
public void onSelectedArtistChange(int viewId, int time) { // check login if (!userBean.getLoggedIn()) { return; } // execute action Performance p = performances.get(viewId).get(time); UltimateFestivalOrganizerSoap ufo = UFOService.getInstance(); if (p.getId() == 0 && p.getArtist().getId() == 0) { return; } // send to server boolean success = true; if (p.getId() == 0 && p.getArtist().getId() != 0) { success = ufo.addPerformance(p); } else if (p.getId() != 0 && p.getArtist().getId() == 0) { ufo.deletePerformance(p); success = true; } else if (p.getId() != 0 && p.getArtist().getId() != 0) { success = ufo.updatePerformance(p); } // message FacesContext facesContext = FacesContext.getCurrentInstance(); FacesMessage facesMessage; if (success) { facesMessage = new FacesMessage(FacesMessage.SEVERITY_INFO, "Saved", "Data was saved on the server."); } else { facesMessage = new FacesMessage( FacesMessage.SEVERITY_ERROR, "Error", "The selected artist was invalid. The item will be reset."); reload(); } facesContext.addMessage(null, facesMessage); }