Package com.pugh.sockso.music

Examples of com.pugh.sockso.music.Playlist


           
            // get sql for track query
            if ( type.equals(MusicItem.COLLECTION) )
                sql = Track.getSelectFromSql(); // select everything in the collection
            else if ( type.equals(MusicItem.PLAYLIST) ) {
                Playlist playlist = (Playlist) item;
                sql = Playlist.getSelectTracksSql(playlist.getId(),"");
            }
            else if ( type.equals(MusicItem.ARTIST) ) {
                Artist artist = (Artist) item;
                sql = Track.getSelectFromSql() +
                        " where t.artist_id = '" + artist.getId() + "' ";
View Full Code Here


       
        final int index = getSelectedIndex();
       
        if ( index != -1 ) {
           
            final Playlist playlist = (Playlist) model.getElementAt( index );
           
            cm.removePlaylist( playlist.getId() );

        }

    }
View Full Code Here

           
            st = db.prepare( sql );
            rs = st.executeQuery();

            while ( rs.next() )
                model.addElement( new Playlist(rs.getInt("id"),rs.getString("name")) );

        }
       
        catch ( final SQLException e ) {
            log.error( e.getMessage() );
View Full Code Here

     */
   
    public void handleRequest() throws IOException, SQLException, BadRequestException {
       
        final Database db = getDatabase();
        final Playlist playlist = Playlist.find( db, Integer.parseInt( getRequest().getUrlParam(2) ) );
       
        if ( playlist == null ) {
            throw new BadRequestException( "Invalid playlist ID" );
        }
       
        showPlaylist( playlist, playlist.getTracks(db) );
       
    }
View Full Code Here

    protected void playlist() throws SQLException, IOException, BadRequestException {
       
        final Request req = getRequest();
        final Database db = getDatabase();
        final int id = Integer.parseInt( req.getUrlParam(2)  );       
        final Playlist playlist = Playlist.find( db, id );
       
        if ( playlist == null ) {
            throw new BadRequestException( "Invalid playlist ID", 404 );
        }
       
        final List<Track> tracks = playlist.getTracks( db );

        showPlaylist( playlist, tracks );
       
    }
View Full Code Here

            st = db.prepare( sql );
            rs = st.executeQuery();
           
            final List<Playlist> userPlaylists = new ArrayList<Playlist>();
            while ( rs.next() )
                userPlaylists.add( new Playlist(
                    rs.getInt("id"), rs.getString("name"), rs.getInt("trackCount"),
                    new User( rs.getInt("userId"), rs.getString("userName") )
                ));

            return userPlaylists;
View Full Code Here

            rs = st.executeQuery();
           
            final List<Playlist> sitePlaylists = new ArrayList<Playlist>();

            while ( rs.next() )
                sitePlaylists.add( new Playlist(
                    rs.getInt("id"), rs.getString("name"), rs.getInt("trackCount")
                ));
           
            return sitePlaylists;
           
View Full Code Here

        final TestResponse res = new TestResponse();
        final Playlistser b = new Playlistser();
        final List<Playlist> sitePlaylists = new ArrayList<Playlist>();
        final List<Playlist> userPlaylists = new ArrayList<Playlist>();
        final User user = new User( 12323, "my user" );
        final Playlist sitePlaylist = new Playlist( 1, "site Play list" );
        final Playlist userPlaylist = new Playlist( 1, "USER Play list", 1, user );

        sitePlaylists.add( sitePlaylist );
        userPlaylists.add( userPlaylist );
       
        b.setResponse( res );
        b.showPlaylists( sitePlaylists, userPlaylists );
       
        final String data = res.getOutput();

        assertTrue( data.contains(sitePlaylist.getName()) );
        assertTrue( data.contains(userPlaylist.getName()) );
        assertTrue( data.contains(user.getName()) );

    }
View Full Code Here

TOP

Related Classes of com.pugh.sockso.music.Playlist

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.