|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate3.support.HibernateDaoSupport
org.musicontroller.dao.HibernateDao
public class HibernateDao
Field Summary |
---|
Fields inherited from class org.springframework.dao.support.DaoSupport |
---|
logger |
Constructor Summary | |
---|---|
HibernateDao()
|
Method Summary | |
---|---|
int |
count(java.lang.String hql,
java.util.Map<java.lang.String,java.lang.Object> params)
|
void |
delete(IUser user)
Deletes a User-object. |
void |
deleteAiBag(AIBag delete)
Deletes an AIBag. |
void |
deleteArtist(Artist delete)
Deletes an artist. |
void |
evict(java.lang.Object o)
|
void |
evictSong(long songId)
|
java.util.List<IUser> |
findUserByLoginname(java.lang.String loginname)
List Users by specifying a certain loginname |
IUser |
findUserByName(java.lang.String username)
Searches for a User, and returns if, if found. |
IUser |
findUserByNamePassword(java.lang.String username,
java.lang.String password)
Get a Particpant by specifying its loginname ans encrypted password |
AIBag |
getAIBagById(long id)
Retrieves the ai_bag with the given id from the database. |
AIBag |
getArtistAppearances(long artistid)
Return a list of all appearances of an artist in songs. |
Artist |
getArtistById(long id)
Retrieves the artist with the given id from the database. |
Authority |
getAuthorityById(int authorityId)
|
Band |
getBandById(long id)
Retrieves the band with the given id from the database. |
Band |
getBandByName(java.lang.String name)
Retrieves the band with the given name from the database. |
java.util.List<java.lang.Long[]> |
getDoubleSongs()
Searches the database for songs that are stored more than one time in the database. |
protected Playlist |
getForgottenSongs(IUser user)
Lists a maximum amount of 25 Songs, with the following properties: The Songs have not been played, skipped, downloaded or requested at all during the last two years. The Songs have been played at least 10 times. The list is ordered to the plays/year ratio. |
Instrument |
getInstrumentById(long id)
Retrieves the instrument with the given id from the database. |
Keywordbag |
getKeywordBagById(long id)
Retrieves the keyword bag with the given id from the database. |
Keyword |
getKeywordById(long id)
Retrieves the keyword with the given id from the database. |
Keywordbag |
getKeywordsBag(java.util.Collection<Keyword> keywords)
|
AIBag |
getMostUsedAIBag(Band band)
Searches the database for the most used AIBag for this band. |
Playlist |
getNeighbours(long songid,
IUser user)
Returns a Playlist containing Songs that are neighbours of the given Song and User. |
Playlist |
getPlaylistById(long id,
IUser user)
Returns a specific Playlist |
Playlist |
getPlaylistByName(java.lang.String name)
Retrieves the Playlist with the given name from the database. |
Role |
getRoleById(int roleId)
|
org.hibernate.SessionFactory |
getSessionFactory2()
Returns the SessionFactory. |
Song |
getSong(Band band,
java.lang.String songname)
Find a song with the given name performed by the specified band. |
Song |
getSongById(long id)
Retrieves the song with the given id from the database. |
java.util.List<java.lang.Long> |
getSongIds()
|
java.util.List<Song> |
getSongsById(java.util.Collection<java.lang.Long> ids)
Retrieves a number of songs from the database, corresponding with the given Ids. |
org.springframework.orm.hibernate3.HibernateTemplate |
getSupport()
|
IUser |
getUserById(long userId)
Get a User by specifying its id. |
IUser |
getUserByLoginname(java.lang.String inlognaam)
Get a User by specifying its loginname |
java.util.List<AIBag> |
listAIBags()
Returns a list of all Artist-Instrument bags. |
java.util.List<Authority> |
listAuthorities()
|
java.util.List<java.lang.Object[]> |
listBands(IUser user)
|
java.util.List<Keywordbag> |
listKeywordbags()
Returns a list of all Keyword bags. |
java.util.List<Keyword> |
listKeywords()
Lists all known Keywords. |
java.util.List<java.lang.Object[]> |
listKeywords(IUser user,
java.util.List<Keywordbag> bags)
|
java.util.List<Keywordbag> |
listKeywordsBags(java.util.List<Keyword> keywords)
Returns a list with all keyword bags that contain at least all keywords given in the "keywords" parameter. |
java.util.List<java.lang.Object[]> |
listMonthlySongCounts()
|
java.util.Map<java.lang.String,java.lang.Integer> |
listMonthlyStatistics(IUser user)
Returns per-user play-statistics. |
java.util.List<java.lang.Object[]> |
listNamableItems()
|
java.util.List<Playlist> |
listPlaylists()
Lists all Playlists. |
java.util.List<Playlist> |
listPlaylists(Band band)
Lists all playlists on which a band is present. |
java.util.List<Playlist> |
listPlaylists(Song song)
|
java.util.List<Playlist> |
listPodcasts()
Lists all Playlists that contain Podcasts. |
java.util.List<Role> |
listRoles()
|
java.util.List<IUser> |
listUsers()
List all Users. |
void |
mergeBands(Band keep,
Band remove)
Merge two bands, moving all songs from one to the other. |
void |
mergePlaylists(Playlist keep,
Playlist delete)
Merge the two playlists into one. |
void |
mergeSongs(Song keep,
Song remove)
Merges two songs to one. |
void |
registerSongChangeListener(SongChangeListener listener)
Adds a SongChangeListener to the internal list of listeners. |
void |
save(AIBag aibag)
Persist the properties of this AIBag. |
void |
save(Artist artist)
Persist the properties of this artist. |
void |
save(Authority authority)
|
void |
save(Band band)
Persist the properties of this band. |
void |
save(Instrument instr)
Persist the properties of this Instrument. |
void |
save(IUser user)
Persists a User-object. |
void |
save(Keyword keyword)
Persist the properties of this keyword. |
void |
save(Keywordbag keywordbag)
Persist a keyword bag. |
void |
save(Link link)
Persist the properties of this link. |
void |
save(Playlist playlist)
Persist the properties of this playlist. |
void |
save(Role role)
|
void |
save(Song song)
Persist the properties of this song. |
java.util.List |
search(java.lang.String hql,
java.util.Map<java.lang.String,java.lang.Object> params,
int maxResults)
Searches in the Database, and returns the objects that were selected. |
java.util.List |
search(java.lang.String hql,
java.util.Map<java.lang.String,java.lang.Object> params,
int maxResults,
int offset)
Searches in the Database, and returns the objects that were selected. |
Artist |
searchArtist(java.lang.String artistfirstname,
java.lang.String artistlastname)
Find an artist matching the given first and last name. |
Band |
searchBand(java.lang.String bandname)
Locate and load the band with the given name. |
Instrument |
searchInstrument(java.lang.String instrname)
Returns the instrument with the given instrument name or NULL if there is no instrument with the given name. |
Keyword |
searchKeyword(java.lang.String keyworddesc)
Find a keyword matching the given keyword-string. |
java.util.List<Playlist> |
searchPlaylist(java.lang.String playlistname)
Find a playlist matching the given name. |
Playlist |
songsByBand(long bandid)
|
Playlist |
songsByKeyword(long keywordid)
|
Playlist |
songsByKeywordbags(java.util.List<Keywordbag> bags,
IUser user,
int maxResults)
Generates a Playlist containing songs that belong to the specified Keywordbags. |
Playlist |
songsByKeywordIds(java.util.List<java.lang.Long> keywordIds,
IUser user)
|
Playlist |
songsByKeywords(java.util.List<Keyword> keywords,
IUser user)
|
Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport |
---|
checkDaoConfig, closeSessionIfNecessary, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory |
Methods inherited from class org.springframework.dao.support.DaoSupport |
---|
afterPropertiesSet, initDao |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HibernateDao()
Method Detail |
---|
public java.util.List<java.lang.Long> getSongIds()
getSongIds
in interface Dao
public Song getSongById(long id)
Dao
getSongById
in interface Dao
id
- The song id.
public java.util.List<Song> getSongsById(java.util.Collection<java.lang.Long> ids)
Dao
getSongsById
in interface Dao
ids
- The ids to get. This must not be null.
public Band getBandById(long id)
Dao
getBandById
in interface Dao
id
- The band id.
public Band getBandByName(java.lang.String name)
Dao
getBandByName
in interface Dao
name
- The band name.
public Keyword getKeywordById(long id)
Dao
getKeywordById
in interface Dao
id
- The keyword id.
public Keywordbag getKeywordBagById(long id)
Dao
getKeywordBagById
in interface Dao
id
- The keyword bag id.
public Artist getArtistById(long id)
Dao
getArtistById
in interface Dao
id
- The artist id.
public AIBag getAIBagById(long id)
Dao
getAIBagById
in interface Dao
id
- The ai_bag id.
public Artist searchArtist(java.lang.String artistfirstname, java.lang.String artistlastname)
Dao
searchArtist
in interface Dao
artistfirstname
- The desired artist name. May be null.artistlastname
- The desired artist last name. The result is null
if this is null.
public AIBag getArtistAppearances(long artistid)
Dao
getArtistAppearances
in interface Dao
artistid
- The artist to search.
public Instrument getInstrumentById(long id)
Dao
getInstrumentById
in interface Dao
id
- The instrument id.
public Song getSong(Band band, java.lang.String songname)
Dao
getSong
in interface Dao
band
- The bandsongname
- The song name.
public Playlist songsByBand(long bandid)
songsByBand
in interface Dao
public java.util.List search(java.lang.String hql, java.util.Map<java.lang.String,java.lang.Object> params, int maxResults)
Dao
search
in interface Dao
hql
- The HQL-query.params
- Query parameters as name,value pairsmaxResults
- The maximum amount of objects to return. Use 0 for all results.
public java.util.List search(java.lang.String hql, java.util.Map<java.lang.String,java.lang.Object> params, int maxResults, int offset)
Dao
search
in interface Dao
hql
- The HQL-query.params
- Query parameters as name,value pairsmaxResults
- The maximum amount of objects to return. Use 0 for all results.offset
- The first offset objects will not be returned
public Band searchBand(java.lang.String bandname)
Dao
searchBand
in interface Dao
bandname
- The band name.
public Keyword searchKeyword(java.lang.String keyworddesc)
Dao
searchKeyword
in interface Dao
keyworddesc
- The desired keyword string.
public java.util.List<Playlist> searchPlaylist(java.lang.String playlistname)
Dao
searchPlaylist
in interface Dao
playlistname
- The desired playlist name.
public void save(Band band)
Dao
save
in interface Dao
band
- The band to persist.public void save(Keyword keyword)
Dao
save
in interface Dao
keyword
- The keyword to persist.public void save(Keywordbag keywordbag)
Dao
save
in interface Dao
keywordbag
- The keyword bag to persist.public void save(Playlist playlist)
Dao
save
in interface Dao
playlist
- The playlist to persist.public void save(Link link)
Dao
save
in interface Dao
link
- The link to persist.public void save(Song song)
Dao
save
in interface Dao
song
- The song to persist.public void save(Artist artist)
Dao
save
in interface Dao
artist
- The artist to persist.public void save(Instrument instr)
Dao
save
in interface Dao
instr
- The instrument to persist.public void save(AIBag aibag)
Dao
save
in interface Dao
aibag
- The AIBag to persist.public IUser findUserByName(java.lang.String username)
Dao
findUserByName
in interface Dao
username
- The username to search for
public Playlist getPlaylistByName(java.lang.String name)
Dao
getPlaylistByName
in interface Dao
name
- The playlist name.
public Playlist getPlaylistById(long id, IUser user)
Dao
getPlaylistById
in interface Dao
id
- The requested playlist id.user
- The user to use for retrieving "special" playlists.
protected Playlist getForgottenSongs(IUser user)
user
- The User for who to create this list for (may be null).
public IUser getUserById(long userId)
UserDao
getUserById
in interface UserDao
userId
- The id.
public IUser findUserByNamePassword(java.lang.String username, java.lang.String password)
UserDao
findUserByNamePassword
in interface UserDao
username
- The loginnamepassword
- The encrypted password
public java.util.List<IUser> listUsers()
UserDao
listUsers
in interface UserDao
public java.util.List<IUser> findUserByLoginname(java.lang.String loginname)
UserDao
findUserByLoginname
in interface UserDao
loginname
- The loginname.
public IUser getUserByLoginname(java.lang.String inlognaam)
UserDao
getUserByLoginname
in interface UserDao
inlognaam
- The loginname.
public void save(IUser user)
UserDao
save
in interface UserDao
user
- The User to persist.public void delete(IUser user)
UserDao
delete
in interface UserDao
user
- The User to purge from persistent storage.public Role getRoleById(int roleId)
public java.util.List<Role> listRoles()
listRoles
in interface UserDao
public void save(Role role)
public Authority getAuthorityById(int authorityId)
public java.util.List<Authority> listAuthorities()
public void save(Authority authority)
public java.util.List<Playlist> listPlaylists(Band band)
Dao
listPlaylists
in interface Dao
band
- The Band to search Playlists for.
public java.util.List<Playlist> listPlaylists(Song song)
listPlaylists
in interface Dao
public java.util.List<Playlist> listPlaylists()
Dao
listPlaylists
in interface Dao
public java.util.List<Playlist> listPodcasts()
Dao
listPodcasts
in interface Dao
public void evictSong(long songId)
evictSong
in interface Dao
public void evict(java.lang.Object o)
evict
in interface Dao
public java.util.List<java.lang.Object[]> listBands(IUser user)
listBands
in interface Dao
user
- The User to get this list for.
public java.util.List<Keyword> listKeywords()
Dao
listKeywords
in interface Dao
public java.util.List<java.lang.Object[]> listKeywords(IUser user, java.util.List<Keywordbag> bags)
listKeywords
in interface Dao
user
- The User to get this list for.bags
- The Keywordbags to show Keywords of (or null to show all keywords)
public java.util.List<Keywordbag> listKeywordsBags(java.util.List<Keyword> keywords)
Dao
listKeywordsBags
in interface Dao
keywords
- The list of keywords that hava to be present in each keyword bag in
the result. If this parameter is null or empty, the result is null.
public Keywordbag getKeywordsBag(java.util.Collection<Keyword> keywords)
getKeywordsBag
in interface Dao
public Playlist songsByKeywordbags(java.util.List<Keywordbag> bags, IUser user, int maxResults)
Dao
songsByKeywordbags
in interface Dao
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 Playlist songsByKeyword(long keywordid)
songsByKeyword
in interface Dao
public Playlist songsByKeywords(java.util.List<Keyword> keywords, IUser user)
songsByKeywords
in interface Dao
public Playlist songsByKeywordIds(java.util.List<java.lang.Long> keywordIds, IUser user)
songsByKeywordIds
in interface Dao
public java.util.List<Keywordbag> listKeywordbags()
Dao
listKeywordbags
in interface Dao
public Playlist getNeighbours(long songid, IUser user)
Dao
getNeighbours
in interface Dao
songid
- The Song to get the neighbours for.user
- The User for whom to inspect the played and requested-Events
public java.util.List<java.lang.Long[]> getDoubleSongs()
Dao
getDoubleSongs
in interface Dao
public void mergeSongs(Song keep, Song remove)
Dao
mergeSongs
in interface Dao
keep
- This song stays.remove
- This song will be removed.public void mergeBands(Band keep, Band remove)
Dao
mergeBands
in interface Dao
keep
- Keep this band. Add all songs of the other band to this band.remove
- The band to remove, moving all songs to the other band.public Instrument searchInstrument(java.lang.String instrname)
Dao
searchInstrument
in interface Dao
instrname
- The intsrument name.
public int count(java.lang.String hql, java.util.Map<java.lang.String,java.lang.Object> params) throws java.lang.Exception
count
in interface Dao
java.lang.Exception
public java.util.List<java.lang.Object[]> listMonthlySongCounts()
listMonthlySongCounts
in interface Dao
public java.util.Map<java.lang.String,java.lang.Integer> listMonthlyStatistics(IUser user)
Dao
listMonthlyStatistics
in interface Dao
user
- The user to gather these statistics for.
Event
public java.util.List<java.lang.Object[]> listNamableItems()
listNamableItems
in interface Dao
public AIBag getMostUsedAIBag(Band band)
Dao
getMostUsedAIBag
in interface Dao
band
- The Band
public java.util.List<AIBag> listAIBags()
Dao
listAIBags
in interface Dao
public void mergePlaylists(Playlist keep, Playlist delete)
Dao
mergePlaylists
in interface Dao
keep
- This playlist will receive all songs from the other playlist.delete
- This The songs of this playlist will be moved to the other playlist
and this playlist will be deleted.public void deleteArtist(Artist delete)
Dao
deleteArtist
in interface Dao
delete
- The artist to delete.public void deleteAiBag(AIBag delete)
Dao
deleteAiBag
in interface Dao
delete
- The AIBag to delete.public org.hibernate.SessionFactory getSessionFactory2()
Dao
getSessionFactory2
in interface Dao
public void registerSongChangeListener(SongChangeListener listener)
Dao
registerSongChangeListener
in interface Dao
listener
- The SongChangeListener to register.public org.springframework.orm.hibernate3.HibernateTemplate getSupport()
getSupport
in interface Dao
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |