Building and running step 3

Alter the tables to add a new boolean column, and modify the application to allow users to select starred tracks.

You will now alter the track tables with a new boolean column to indicate if a track has been starred, then modify the Playlist application to allow tracks to be starred by the user.

Prerequisites

You must have set up your environment before starting this step.

Procedure

  1. In a terminal, go to the playlist workspace.
    cd playlist
  2. Check out the step3 branch using git.
    git checkout step3
  3. Run the cqlsh command.
    cqlsh
  4. In the playlist keyspace alter the track_by_artist and track_by_genre tables with a new boolean column called starred.
    use playlist;
    alter table track_by_artist add starred boolean;
    alter table track_by_genre add starred boolean;
  5. Create and populate a new track table, track_by_id used to query a track when it is being starred by the user.
    create table track_by_id (track text, artist text, track_id UUID, track_length_in_seconds int, genre text, music_file text, primary key (track_id));
    copy track_by_id (track_id, genre, artist, track, track_length_in_seconds, music_file) FROM 'scripts/songs.csv' WITH DELIMITER = '|'  AND HEADER=true;
  6. Quit cqlsh.
    exit;
  7. Build and run Playlist using mvn.
    mvn verify cargo:run
  8. In a web browser, navigate to or refresh: http://localhost:8080/playlist

    Now you can star hot tracks, and they will remain starred for one minute.

    Note that My Playlists and Statistics are not yet implemented.

What's next

Proceed to Step 4: Adding users and custom playlists.