コード例 #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");
 }
コード例 #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");
 }
コード例 #3
0
 public Resolution delete() {
   song = musicFacade.getSongById(song.getId());
   try {
     musicFacade.delete(song);
   } catch (DataAccessException ex) {
   }
   return new RedirectResolution(this.getClass(), "list");
 }
コード例 #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;
 }
コード例 #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));
 }