Example #1
0
 public Resolution save() {
   song.setAlbum(musicFacade.getAlbumById(album));
   song.setArtist(musicFacade.getArtistById(artist));
   song.setGenre(musicFacade.getGenreById(genre));
   musicFacade.update(song);
   return new RedirectResolution(this.getClass(), "list");
 }
Example #2
0
 public Resolution edit() {
   albums = musicFacade.getAllAlbums();
   genres = musicFacade.getAllGenres();
   artists = musicFacade.getAllArtists();
   HttpSession session = getContext().getRequest().getSession();
   playlists = musicFacade.getPlaylistsByAccount((String) session.getAttribute("username"));
   return new ForwardResolution("/song/edit.jsp");
 }
Example #3
0
 public Resolution delete() {
   song = musicFacade.getSongById(song.getId());
   try {
     musicFacade.delete(song);
   } catch (DataAccessException ex) {
   }
   return new RedirectResolution(this.getClass(), "list");
 }
Example #4
0
 @Override
 public Resolution handleValidationErrors(ValidationErrors errors) throws Exception {
   songs = musicFacade.getAllSongs();
   albums = musicFacade.getAllAlbums();
   genres = musicFacade.getAllGenres();
   artists = musicFacade.getAllArtists();
   HttpSession session = getContext().getRequest().getSession();
   playlists = musicFacade.getPlaylistsByAccount((String) session.getAttribute("username"));
   return null;
 }
Example #5
0
 @Before(
     stages = LifecycleStage.BindingAndValidation,
     on = {"edit", "save", "details"})
 public void loadSongFromDatabase() {
   String ids = getContext().getRequest().getParameter("song.id");
   if (ids == null) {
     return;
   }
   song = musicFacade.getSongById(Long.parseLong(ids));
 }