|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.musicontroller.service.McServiceImpl
public class McServiceImpl
Deliver services for adding and removing Musicians to songs.
Constructor Summary | |
---|---|
McServiceImpl()
|
Method Summary | |
---|---|
Band |
addBand(java.lang.String bandName)
Adds a band with the given name to the database. |
void |
addKeywordsToPlaylist(Playlist playlist,
java.lang.String keywords,
TrackList tracks)
Adds the keywords in the comma separated list to the playlist. |
void |
addMusician(Playlist playlist,
java.lang.String artistfirstname,
java.lang.String artistlastname,
java.lang.String instruments,
java.lang.String tracks)
Adds the artist as a performer to all songs in the playlist, playing the specified instruments. |
void |
addMusician(Song song,
java.lang.String artistfirstname,
java.lang.String artistlastname,
java.lang.String instruments)
Adds the artist as a performing artist in the song. |
void |
addSongToPlaylist(Song song,
Playlist playlist,
int songIndex)
Adds the song to the playlist at the given song index. |
java.io.File |
attemptToDownloadCoverArt(long playlistid,
int size)
Test the existence of a cover art image with the required size. |
java.util.List<PlaylistMergeBean> |
constructMergeBeanList(Playlist playlist)
Construct a list of PlaylistMergeBean objects. |
java.util.List<SongBean> |
constructSongBeanList(Playlist playlist)
Construct a list with a SongBean object for each song in the playlist. |
Playlist |
createPlaylist(java.lang.String playlistname)
Creates a playlist with the given name. |
Song |
createSong(java.lang.String songname,
Band band,
int length,
java.util.Set<java.lang.String> keywords,
java.lang.String destination)
Creates a persistent song with the given name. |
void |
deleteMusician(Playlist playlist,
java.lang.String artistfirstname,
java.lang.String artistlastname,
java.lang.String instruments,
java.lang.String tracks)
Removes the artist-instrument relations specified by the argument from every song in the playlist. |
void |
deleteMusician(Song song,
java.lang.String artistfirstname,
java.lang.String artistlastname,
java.lang.String instruments)
Deletes the artist as a performing artist in the song. |
void |
editSongsOfPlaylist(Playlist playlist,
java.util.List<SongBean> songbeans)
Edit song properties according to the new values stored in the songbeans in the supplied list. |
java.util.List<Playlist> |
findImportedPlaylist(MusicArchiveBean archive)
Tries to find persistent playlists that matches the playlist name of 1 or more entries in the music archive. |
Artist |
getArtistById(long artistId)
Return the artist with the given identifier |
Band |
getBandById(long bandid)
Return the band with a given identifier. |
java.util.List<Playlist> |
getBandPlaylists(Band band)
Returns a list of playlists containing at least one song by this band. |
java.util.Collection<CoverArtSearchResult> |
getCoverArtList(Playlist playlist)
Returns a list of available cover art for the playlist. |
java.util.Collection<CoverArtSearchResult> |
getCoverArtList(java.lang.String bandName,
java.lang.String playlistName)
Returns a list of available cover art for the named playlist by the named band. |
Dao |
getDao()
Getter for the DAO. |
java.util.List<Keywordbag> |
getKeywordBagsWithKeywords(java.util.List<java.lang.Long> selectedKeywordIds)
Returns a list of all keyword bags containing all the keywords in the "selectedKeywordIds" parameter. |
Keyword |
getKeywordById(java.lang.Long id)
Returns the keyword with the id of the parameter. |
Playlist |
getPlaylistById(long playlistid)
Retrieves the playlist with the specified id. |
java.util.Set<Comment> |
getReviews(Band band)
Returns a (possibly empty) sorted set of reviews for a Band. |
java.util.Set<Comment> |
getReviews(Playlist playlist)
Returns a (possibly empty) sorted set of reviews for a Playlist. |
Song |
getSongById(long songid)
Return the song with a given identifier. |
Playlist |
getSongNeighbours(Song song,
IUser user)
Returns a playlist of songs that were played to a user close before or after a song. |
java.util.List<Playlist> |
getSongPlaylists(Song song)
Returns a list of playlist containing the song. |
Playlist |
getSongsByBand(Band band)
Returns a playlist with all songs played by the band. |
Playlist |
getUpcoming(long userid)
Return a playlist with a prediction of the next 6 songs the DJ will play for the specified user. |
java.lang.String |
guessBandNameOfArchive(MusicArchiveBean archive)
Return a guess about the band on the cover of a playlist. |
java.util.Set<Playlist> |
guessPlaylistsInArchive(MusicArchiveBean archive)
Compile a set of persistent playlists that could be the same as the contents of the music archive. |
java.util.List<java.lang.Object[]> |
listBands(IUser user)
|
java.util.List<java.lang.Object[]> |
listKeywords(IUser user,
java.util.List<Keywordbag> bags)
|
void |
mergePlaylist(Playlist playlist,
IUser user,
java.util.List<PlaylistMergeBean> mergeBeanList)
Merge the playlist with the playlist in the list of beans that have the mergeIndicator set. |
void |
removeKeywordsFromPlaylist(Playlist playlist,
java.lang.String keywords,
TrackList tracks)
Removes the keywords in the comma separated list from the playlist. |
java.util.List<Playlist> |
searchPlaylistByName(java.lang.String playlistName)
Returns a list of playlists with the same name as the parameter. |
void |
setBandProperties(Band band,
java.lang.String bandName)
Sets the band name and comments string according to the specified parameters. |
void |
setDao(Dao dao)
Setter for the DAO. |
void |
setPlaylistCoverArt(Playlist playlist,
CoverArtSearchResult selected)
Use the image in the CoverArtSearchResult to update the coverart for the playlist. |
void |
setPlaylistProperties(Playlist playlist,
java.lang.String playlistName,
java.util.Date releaseDate)
Edit basic playlist properties: name and releasedate. |
void |
setSongProperties(Song song,
java.lang.String name,
java.lang.String bandName,
int msecs,
java.lang.String keywords)
Sets the song name, the song length in milliseconds and the song keywords according to the parameters specified. |
Playlist |
songsByKeywordbags(java.util.List<Keywordbag> bags,
User user,
int maxResults)
Generates a Playlist containing songs that belong to the specified Keywordbags. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public McServiceImpl()
Method Detail |
---|
public Dao getDao()
public void setDao(Dao dao)
dao
- The DAO.public Band addBand(java.lang.String bandName)
McService
addBand
in interface McService
bandName
- The name of the new band.
public void addMusician(Playlist playlist, java.lang.String artistfirstname, java.lang.String artistlastname, java.lang.String instruments, java.lang.String tracks)
McService
addMusician
in interface McService
playlist
- The playlist to add the defined Musician-Instrument relation to. Nothing
happens if this is null.artistfirstname
- The first name of the artis to create/edit.artistlastname
- The last name of the artis to create/edit. Nothing happens if this
is null.instruments
- The Instruments the artists plays on this playlist. This is
a comma separated list of instrument names.tracks
- The tracklist. If the tracklist is null the artist will be added to
all tracks of the playlist.public void addMusician(Song song, java.lang.String artistfirstname, java.lang.String artistlastname, java.lang.String instruments)
McService
addMusician
in interface McService
song
- The song to add a performer to. Nothing happens if this is null.artistfirstname
- The first name of the artis to create/edit.artistlastname
- The last name of the artis to create/edit.instruments
- The Instruments the artists plays on this playlist. This is
a comma separated list of instrument names.public Artist getArtistById(long artistId)
McService
getArtistById
in interface McService
artistId
- The identifier of the artist sought
public void addSongToPlaylist(Song song, Playlist playlist, int songIndex)
McService
addSongToPlaylist
in interface McService
song
- The song to add. This parameter must be a persistent song object. If this parameter is null
then nothing happens.playlist
- The playlist to add the song to. This parameter must be a persistent playlist object.
If this parameter is null then nothing happens.songIndex
- The song index within the playlist. If the playlist already has a song at this
index, the song index will be set to 0.public void deleteMusician(Playlist playlist, java.lang.String artistfirstname, java.lang.String artistlastname, java.lang.String instruments, java.lang.String tracks)
McService
deleteMusician
in interface McService
playlist
- The playlist to remove the artist instrument relation from. Nothing happens if this
is null.artistfirstname
- The first name of the artist.artistlastname
- The last name of the artist. Nothing happens if this is null.instruments
- The instruments (a comma separated string). Nothing happens if this is null.tracks
- Indicates which tracks should be affected.public void deleteMusician(Song song, java.lang.String artistfirstname, java.lang.String artistlastname, java.lang.String instruments)
McService
deleteMusician
in interface McService
song
- The song to remove a performer from. Nothing happens if this is null.artistfirstname
- The first name of the artis to create/edit.artistlastname
- The last name of the artis to create/edit. Nothing happens if this is null.instruments
- The Instruments the artists plays on this playlist. This is
a comma separated list of instrument names. Nothing happens if this is null.public void editSongsOfPlaylist(Playlist playlist, java.util.List<SongBean> songbeans)
McService
editSongsOfPlaylist
in interface McService
playlist
- Specifies the playlist of the songs. Used for
storing the track index numbers of the songs
in this playlist. This parameter may be NULL,
in which case no track index numbers will be set.songbeans
- The list of songbeans containing the new
song properties.public void addKeywordsToPlaylist(Playlist playlist, java.lang.String keywords, TrackList tracks)
McService
addKeywordsToPlaylist
in interface McService
playlist
- The playlist. If this is null, nothing happens.keywords
- The comma separated list of keywords to add.tracks
- If not null, add the keywords only to the tracks in the track list.public void removeKeywordsFromPlaylist(Playlist playlist, java.lang.String keywords, TrackList tracks)
McService
removeKeywordsFromPlaylist
in interface McService
playlist
- The playlist. If this is null, nothing happens.keywords
- The comma separated list of keywords to remove.tracks
- If not null, remove the keywords only from the tracks in the track list.public void setPlaylistProperties(Playlist playlist, java.lang.String playlistName, java.util.Date releaseDate)
McService
setPlaylistProperties
in interface McService
playlist
- The playlist to alter.playlistName
- The playlist name to set. The playlist name is not changed if the
parameter is null or "".releaseDate
- The release date to set. The releasedate is not changed if
this parameter is null.public Playlist createPlaylist(java.lang.String playlistname)
McService
createPlaylist
in interface McService
playlistname
- The name of the new playlist. Empty names, names consisting only
of whitespaces and null valued playlistnames are invalid and
ignored. The result is NULL in those cases. Trailing and leading
whitespace will be trimmed.
public Playlist getPlaylistById(long playlistid)
McService
getPlaylistById
in interface McService
public void mergePlaylist(Playlist playlist, IUser user, java.util.List<PlaylistMergeBean> mergeBeanList)
McService
mergePlaylist
in interface McService
playlist
- The playlist to merge.user
- The user doing the merging.mergeBeanList
- A list of beans containing possible merge candidates.public java.util.List<SongBean> constructSongBeanList(Playlist playlist)
McService
constructSongBeanList
in interface McService
playlist
- The playlist.
public java.util.List<PlaylistMergeBean> constructMergeBeanList(Playlist playlist)
McService
constructMergeBeanList
in interface McService
playlist
- The playslist
public java.util.Collection<CoverArtSearchResult> getCoverArtList(Playlist playlist)
McService
getCoverArtList
in interface McService
playlist
- The playlist.
public java.util.Collection<CoverArtSearchResult> getCoverArtList(java.lang.String bandName, java.lang.String playlistName)
McService
getCoverArtList
in interface McService
bandName
- The band name.playlistName
- The playlist name.
public Song createSong(java.lang.String songname, Band band, int length, java.util.Set<java.lang.String> keywords, java.lang.String destination)
McService
createSong
in interface McService
songname
- The name of the song to create. The name must not be null and must
contain a non whitespace character. Otherwise, no song is created and the
result is null. Leading and trailing whitespace is removed.band
- The band of the new song. This parameter must contain a persistent band.
Otherwise, no song is created and the result is null.length
- The lenght of the song in milliseconds.keywords
- The set of keywords of the song.destination
- The file name of the media file containg the song.public Song getSongById(long songid)
McService
getSongById
in interface McService
songid
- The idenitfier.
public Playlist getUpcoming(long userid)
McService
getUpcoming
in interface McService
userid
- The user.
public void setSongProperties(Song song, java.lang.String name, java.lang.String bandName, int msecs, java.lang.String keywords)
McService
setSongProperties
in interface McService
song
- The song to change.name
- The new song name. White space will be trimmed. The name will
not change if the new name is null or empty after trimming.bandName
- The name of the band performing the song. The song will be
moved to the band with this name. A new band will be made
if it does not exist. If the bandname is null or empty after
stripping white space, the band will not change.msecs
- The new song length in milliseconds. Zero or negative values
will have no effect.keywords
- The new comma separated list of keywords.public java.util.List<Playlist> getSongPlaylists(Song song)
McService
getSongPlaylists
in interface McService
song
- The song to look for.
public Playlist getSongNeighbours(Song song, IUser user)
McService
getSongNeighbours
in interface McService
song
- The song whose neighbours must be found.user
- The user.
public Playlist getSongsByBand(Band band)
McService
getSongsByBand
in interface McService
band
- The band.
public Band getBandById(long bandid)
McService
getBandById
in interface McService
bandid
- The idenitfier.
public java.util.List<Playlist> getBandPlaylists(Band band)
McService
getBandPlaylists
in interface McService
band
- The band to look for.
public void setBandProperties(Band band, java.lang.String bandName)
McService
setBandProperties
in interface McService
band
- The band to modify.bandName
- The new band name. If a band with this name already exists,
then the 2 bands will be merged. If the trimmed band name is null or
empty, no change occurs.public java.util.List<java.lang.Object[]> listBands(IUser user)
listBands
in interface McService
user
- The User to get this list for.
public Keyword getKeywordById(java.lang.Long id)
McService
getKeywordById
in interface McService
id
- The id of the wanted keyword.
public java.util.List<Keywordbag> getKeywordBagsWithKeywords(java.util.List<java.lang.Long> selectedKeywordIds)
McService
getKeywordBagsWithKeywords
in interface McService
selectedKeywordIds
- The list of keyword ids of the keywords that have to be present in
all keyword bags in the result.
public java.util.List<java.lang.Object[]> listKeywords(IUser user, java.util.List<Keywordbag> bags)
listKeywords
in interface McService
user
- The User to get this list for.bags
- The Keywordbags to show Keywords of (or null to show all keywords)
public Playlist songsByKeywordbags(java.util.List<Keywordbag> bags, User user, int maxResults)
McService
songsByKeywordbags
in interface McService
bags
- The Keywordbag(s) the Song could be in. If this parameter is null,
an empty Playlist is returned.user
- The User-object (Used for sorting according to listening-habits). If
this parameter is null, anonymous sorting is used.maxResults
- Specifiec the maximum amount of records to return. Pass a
value >0 to show all matches.
public void setPlaylistCoverArt(Playlist playlist, CoverArtSearchResult selected) throws java.io.IOException
McService
setPlaylistCoverArt
in interface McService
playlist
- The playlist to set the cover art for. If null, the request is ignored.selected
- The selected cover art. If null, the request is ignored. If the URL inside
this is NULL, the request is ignored. If the URI is non absolute, MusiController
adds the "file:" protocol to it.
java.io.IOException
- Something went wrong when downloading the image or storing the image on disk.public java.io.File attemptToDownloadCoverArt(long playlistid, int size)
McService
attemptToDownloadCoverArt
in interface McService
playlistid
- The id of the playlist for which the cover art is requested.size
- The requested image size.public java.util.Set<Comment> getReviews(Playlist playlist)
McService
getReviews
in interface McService
playlist
- The playlist tot get the reviews for
public java.util.Set<Comment> getReviews(Band band)
McService
getReviews
in interface McService
band
- The Band tot get the reviews for
public java.util.List<Playlist> findImportedPlaylist(MusicArchiveBean archive)
McService
findImportedPlaylist
in interface McService
archive
- The music archive.
public java.util.Set<Playlist> guessPlaylistsInArchive(MusicArchiveBean archive)
McService
guessPlaylistsInArchive
in interface McService
archive
- The music archive.
public java.lang.String guessBandNameOfArchive(MusicArchiveBean archive)
McService
guessBandNameOfArchive
in interface McService
public java.util.List<Playlist> searchPlaylistByName(java.lang.String playlistName)
McService
searchPlaylistByName
in interface McService
playlistName
- The name of the playlist.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |