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.
Procedure
-
In a terminal, go to the playlist workspace.
-
Check out the
step3
branch using git.
-
Run the cqlsh command.
-
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;
-
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;
-
Quit cqlsh.
-
Build and run Playlist using mvn.
-
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.