@Transactional public Album getAlbum( User user, long albumSid, boolean authorInfo, boolean songsInfo, boolean resourcesInfo ) { MDOAlbum album = daoAlbum.getAlbum( albumSid, user.getLogin() ); return Album.transform( album, authorInfo, songsInfo, resourcesInfo ); }
+ daoAlbum.getAlbum( albumSid, mdouser.getLogin() ).getName() + "'. Error:" + e.getMessage() );
public List<Song> getSongsOfAlbum( User user, long albumSid, boolean includeAlbumInfo, boolean includeAuthorInfo ) throws SidNotFoundMessicException { MDOAlbum mdoalbum = daoAlbum.getAlbum( albumSid, user.getLogin() ); if ( mdoalbum != null ) { List<Song> result = new ArrayList<Song>(); List<MDOSong> songs = mdoalbum.getSongs(); for ( MDOSong mdoSong : songs ) { Song song = new Song( mdoSong, includeAlbumInfo, includeAuthorInfo ); result.add( song ); } return result; } else { throw new SidNotFoundMessicException(); } }
@Transactional public void getAlbumZip( User user, Long albumSid, OutputStream os ) throws IOException { MDOAlbum album = this.daoAlbum.getAlbum( albumSid, user.getLogin() ); if ( album != null ) { String basePath = album.calculateAbsolutePath( daoSettings.getSettings() ); Util.zipFolder( basePath + File.separatorChar, album.getAuthor().getName() + "-" + album.getName(), os ); } else { throw new IOException( "Album not found!" ); } }
@Transactional public boolean remove( User user, Long albumSid ) throws IOException { MDOAlbum album = this.daoAlbum.getAlbum( albumSid, user.getLogin() ); if ( album != null ) { MDOAuthor author = album.getAuthor(); if ( author.getAlbums().size() <= 1 ) { File fpath = new File( author.calculateAbsolutePath( daoSettings.getSettings() ) ); FileUtils.deleteDirectory( fpath ); // after, removing the author data from database daoAuthor.remove( album.getAuthor() ); return true; } else { // first, removing the album folder File fpath = new File( album.calculateAbsolutePath( daoSettings.getSettings() ) ); FileUtils.deleteDirectory( fpath ); // after, removing the album data from database this.daoAlbum.remove( album ); return false; } } return false; }
mdoAlbum = daoAlbum.getAlbum( album.getSid(), user.getLogin() ); if ( mdoAlbum != null )
MDOAlbum album = daoAlbum.getAlbum( albumSid, user.getLogin() );