コード例 #1
0
  public String doSave() {
    album.setImageFilename(fileUtils.saveImageOnFilesystem(imageFile));
    album.setInterpret(interpret);
    albumService.createOrUpdate(this.album);

    return "detailAlbum.xhtml?faces-redirect=true&album=" + album.getId();
  }
コード例 #2
0
  public String init() {
    if (albumId > 0) {
      album = albumService.findById(albumId);

      if (album != null) {
        currentSongNumber = album.getSongs().size() + 1L;
        interpret = album.getInterpret();
        imageName = album.getImageFilename();
      } else {
        FacesContext context = FacesContext.getCurrentInstance();
        FacesMessage message =
            guiUtils.getFacesMessage(
                FacesContext.getCurrentInstance(),
                FacesMessage.SEVERITY_ERROR,
                "album.init.albumNotFoundError");
        context.addMessage(null, message);

        return "error";
      }
    }

    return null;
  }
コード例 #3
0
 private void initSong() {
   currentSongNumber = album.getSongs().size() + 1L;
   currentSongDuration = null;
   currentSongTitle = null;
   editSong = null;
 }
コード例 #4
0
  public String doDeleteSong(Song song) {
    LOGGER.info("Delete Song: " + song.getTitle());
    album.removeSong(song);

    return null;
  }