Package com.tagtraum.beatunes.library
Class HibernatePlayList
- java.lang.Object
-
- com.tagtraum.beatunes.library.HibernatePlayList
-
- All Implemented Interfaces:
PlayList,SyncTempoAware,PageCacheDataSource<AudioSong>,ListModel
@Entity public class HibernatePlayList extends Object implements PlayList, PageCacheDataSource<AudioSong>
Playlist backed by Hibernate.- Author:
- Hendrik Schreiber
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.tagtraum.audiokern.PlayList
PlayList.Kind, PlayList.SortDirection, PlayList.SubstringFilterProperty
-
-
Constructor Summary
Constructors Constructor Description HibernatePlayList()No-arg constructor for Hibernate.HibernatePlayList(long id)Convenience constructor for deletion viaSession.delete(Object).HibernatePlayList(HibernateMediaLibrary library)Creates an empty playlist.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListDataListener(ListDataListener l)voidaddPropertyChangeListener(PropertyChangeListener propertyChangeListener)Add a listener.voidaddPropertyChangeListener(String property, PropertyChangeListener propertyChangeListener)Add a listener for a specific property.voidaddSongIds(int filteredIndex, List<Long> songIds)Adds the given songs at the given (filtered) index.voidaddSongIds(List<Long> songIds)Adds the songs referenced by the given ids to this playlist.voidaddSongs(int filteredIndex, String... locations)Adds songs to the playlist using only their locations.
Depending on the library implementation, the insert index may be ignored.voidaddSongs(int filteredIndex, List<AudioSong> songs)Adds the given songs at the given (filtered) index.voidaddSongs(org.hibernate.Session session, gnu.trove.TLongCollection ids)Needs to be called from open transaction/session.booleancanAddItem()Indicates whether we can add items to this playlist.booleancanInsertItem()Indicates whether we can insert items into this playlist.voidclearCaches()Clears all caches that holed info about song order, search results, and songs themselves.booleancontains(Long id)intcountSongs(Collection<? extends SongFilter> filters)Returns song count from this playlist, filtered with the given filters.org.hibernate.QuerycreatePageQuery(org.hibernate.Session session)Creates a query that selects persistent objects in the right order.booleanequals(Object obj)int[]filteredIndices(int... unfilteredIndices)Returns the filtered indices (string, order) for the given unfiltered indices.PlayListIterator<AudioSong>filteredListIterator(int firstNextFilteredIndex)Creates a dynamically updated iterator for this playlist.List<AudioSong>getCachedSongs()List<PlayList>getChildPlayLists()StringgetDescription()PlayList.KindgetDistinguishedKind()Returns the special kind of this playlist.ObjectgetElementAt(int index)longgetFileSize()Get the sum of all file sizes (with filters applied).List<Long>getFilteredSongIds()Returns song ids from this playlist, both sorted and filtered.Iterable<AudioSong>getFilteredSongs()Returns songs from this playlist, both sorted and filtered.intgetGeniusTrackID()HibernateMediaLibrary<?>getHibernateMediaLibrary()HibernateUtilgetHibernateUtil()LonggetId()This list's id.LonggetId(AudioSong song)Needs to be implemented to get the persistent id of the objects that are cached in this cache.LonggetIdAt(int index)Returns id of the song at the given index, taking sorting and filtering into account.IndexedId[]getIds(org.hibernate.Session session)A complete list of sorted ids along with their natural indices.<T> TgetImplementation(Class<T> klass)PlayListobjects are sometimes implemented by an object that acts as a facade to other objects.IndexedId[]getIndexedSongIds()A complete list of sorted ids along with their natural order indices (viaIndexedId.getIndex()).AudioSong.LikinggetLiking()StringgetName()LonggetParentId()If this is a sub-folder/playlist, this returns the parent id.PlayListgetParentPlayList()PlayList[]getPlayListPath()Returns path leading to this playlist and ending with it.intgetSize()StringgetSmartCriteria()StringgetSmartInfo()AudioSonggetSong(int index)Returns song from the given index, taking sorting and filtering into account.List<Long>getSongIds()Returns song ids from this playlist, neither sorted not filtered.List<Long>getSongIds(Set<? extends SongFilter> filters)Returns song ids from this playlist, filtered with the given filters.List<Long>getSongIds(org.hibernate.Session session)Iterable<AudioSong>getSongs()Returns songs from this playlist, neither sorted nor filtered.List<AudioSong>getSongs(Collection<? extends SongFilter> filters, int limit)Returns songs from this playlist, filtered with the given filters.Iterable<AudioSong>getSongsOrderedBy(String sortProperty, PlayList.SortDirection direction)Returns songs from this playlist, sorted by the given property.Iterable<AudioSong>getSongsOrderedBy(String sortProperty, PlayList.SortDirection direction, int limit)Returns songs from this playlist, sorted by the given property.StringgetSortColumnProperty()Returns the name of the single property the playlist is sorted by.PlayList.SortDirectiongetSortDirection()Return sort direction.String[]getSortProperties()Actual sort properties, used inORDER BYHQL/SQL clauses.StringgetSortProperty(int index)Actual sort property, used inORDER BYSQL clauses.SpecialPlayListInfogetSpecialPlayListInfo()LonggetSpecialPlayListInfoId()StringgetSubstringFilter()Current substring filter.PlayList.SubstringFilterPropertygetSubstringFilterProperty()Current property to filter.com.tagtraum.audiokern.bpm.TempogetSyncTempo()When set to a non-nullvalue,Keyvalues are displayed as if the song was played back at the given tempo.longgetTotalTime()Get time with filters applied.intgetUnfilteredSize()Unfiltered number of songs in playlist.longgetUnfilteredTime()Get time without any filters applied.AudioSonggetWithId(org.hibernate.Session session, Long id)List<AudioSong>getWithIds(org.hibernate.Session session, Long... ids)Creates a query that selects persistent objects in the right order.inthashCode()intindexOf(Long id)Returns the first index of the given song.booleanisAggregateDataAvailable()Indicates whether we currently have valid aggregate (total size, duration, etc.) data.booleanisAllItems()booleanisAudiobooks()booleanisEditable()Is this playlist editable? Only playlists created by users are editable.booleanisFolder()booleanisGeniusPlaylist()booleanisItemsEditable()Are the contained items editable? E.g., items are not editable, if they are only available online, as the metadata of some stream or online database cannot be changed locally.booleanisLibrary()Indicates that this is a library playlist, meaning one of the top level library views (e.g.booleanisMaster()Indicates whether this playlist is a master playlist.booleanisMovies()booleanisMusic()booleanisParentAFolder()booleanisPodcasts()booleanisPurchasedMusic()booleanisSmartPlaylist()booleanisSpecialPlayList()booleanisTvShows()booleanisUserPlaylist()Indicates that the playlist is just a regular user playlist.booleanisVideos()iTunes 6 playlist attribute.intmoveSongs(int[] fromIndices, int toIndex)Moves songs.voidobjectsAvailable(int index0, int index1)Notifies the data source, that the given index range has been loaded.voidrefresh()Clears the caches backing this playlist.voidrefresh(String sortPropertyName)All caches related to the given sort property are cleared.voidremoveAllSongs()Removes all songs from this playlist.voidremoveAllSongs(org.hibernate.Session session)Sets the internal persistent song array tonull.voidremoveListDataListener(ListDataListener l)voidremovePropertyChangeListener(PropertyChangeListener propertyChangeListener)Remove a listener.booleanremoveSongs(int... filteredIndices)Removes the song with the given (filtered) index from the playlist.booleanremoveSongs(Collection<Long> ids, boolean completelyDeleteSong)Removes the songs with the given ids from the list.voidsetAllItems(boolean value)voidsetAudiobooks(boolean value)voidsetChangedExternally(boolean changedExternally)Indicates that this playlist was changed by an external process.voidsetChildPlayLists(List<PlayList> childPlayLists)voidsetDescription(String description)voidsetDistinguishedKind(PlayList.Kind value)Allows setting of a special song type, likePlayList.Kind.PODCASTS.voidsetFolder(boolean value)voidsetGeniusTrackID(int value)voidsetHibernateMediaLibrary(HibernateMediaLibrary<?> hibernateMediaLibrary)voidsetId(Long value)Sets this list's id.voidsetLiking(AudioSong.Liking value)voidsetMaster(boolean value)voidsetMovies(boolean value)voidsetMusic(boolean value)voidsetName(String name)voidsetParentId(Long value)Sets the parent id.voidsetParentPlayList(PlayList value)voidsetPodcasts(boolean value)voidsetPurchasedMusic(boolean value)voidsetSize(int size)voidsetSmartCriteria(String smartCriteria)voidsetSmartInfo(String smartInfo)voidsetSongIds(List<Long> songIds)Removes all songs from this playlist and replaces them with song connected to the given ids.voidsetSongs(List<AudioSong> songs)Removes all songs from this playlist and replaces them with the given songs.voidsetSortColumnProperty(String sortColumnProperty)Sets "visual/semantic" sort property.voidsetSortDirection(PlayList.SortDirection sortDirection)Sort direction.voidsetSortProperties(String... properties)Sets sort properties.voidsetSpecialPlayListInfo(SpecialPlayListInfo value)voidsetSubstringFilter(String substring, PlayList.SubstringFilterProperty substringFilterProperty)Sets the filter and which property to filter in one swoop.voidsetSyncTempo(com.tagtraum.audiokern.bpm.Tempo syncTempo)When set to a non-nullvalue,Keyvalues are displayed as if the song was played back at the given tempo.voidsetTvShows(boolean value)voidsetVideos(boolean value)StringtoString()int[]unfilteredIndices(int... filteredIndices)Returns the unfiltered indices for the given filtered (string, order) indices.voidupdateCachedSong(AudioSong song)booleanwasChangedExternally()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.tagtraum.audiokern.PlayList
contains, getSongsOrderedBy, indexOf, removeSongs
-
-
-
-
Constructor Detail
-
HibernatePlayList
public HibernatePlayList()
No-arg constructor for Hibernate. Should not be called directly. Don't forget to also set library viasetHibernateMediaLibrary(HibernateMediaLibrary).
-
HibernatePlayList
public HibernatePlayList(HibernateMediaLibrary library)
Creates an empty playlist.- Parameters:
library- HibernateMediaLibrary that created this playlist
-
HibernatePlayList
public HibernatePlayList(long id)
Convenience constructor for deletion viaSession.delete(Object). This will not create a universally useful instance!- Parameters:
id- id
-
-
Method Detail
-
getImplementation
public <T> T getImplementation(Class<T> klass)
Description copied from interface:PlayListPlayListobjects are sometimes implemented by an object that acts as a facade to other objects. For example, this could be a proxy for an AppleScript iTunes object or a persistent object that is stored in a local database via Hibernate. While normal calls to an object implementing this interface are routed according to some internal logic, using one of the actual implementation classes allows you precise control over what your call does.Note to plugin developers: It is hardly ever a good idea to exercise this control, unless you know exactly what you are doing. :-)
- Specified by:
getImplementationin interfacePlayList- Type Parameters:
T- implementation class- Parameters:
klass- class implementing PlayList- Returns:
- object of the desired type or
null, if such an object is not available - See Also:
AudioSong.getImplementation(Class)
-
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener propertyChangeListener)
Description copied from interface:PlayListAdd a listener.- Specified by:
addPropertyChangeListenerin interfacePlayList- Parameters:
propertyChangeListener- listener
-
addPropertyChangeListener
public void addPropertyChangeListener(String property, PropertyChangeListener propertyChangeListener)
Description copied from interface:PlayListAdd a listener for a specific property.- Specified by:
addPropertyChangeListenerin interfacePlayListpropertyChangeListener- listener
-
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener propertyChangeListener)
Description copied from interface:PlayListRemove a listener.- Specified by:
removePropertyChangeListenerin interfacePlayList- Parameters:
propertyChangeListener- listener
-
addListDataListener
public void addListDataListener(ListDataListener l)
- Specified by:
addListDataListenerin interfaceListModel
-
removeListDataListener
public void removeListDataListener(ListDataListener l)
- Specified by:
removeListDataListenerin interfaceListModel
-
wasChangedExternally
public boolean wasChangedExternally()
- See Also:
setChangedExternally(boolean)
-
setChangedExternally
public void setChangedExternally(boolean changedExternally)
Indicates that this playlist was changed by an external process. Setting this flag may causePropertyChangeEvents to be fired, because of the external change.- Parameters:
changedExternally- true or false
-
getId
public Long getId(AudioSong song)
Description copied from interface:PageCacheDataSourceNeeds to be implemented to get the persistent id of the objects that are cached in this cache.- Specified by:
getIdin interfacePageCacheDataSource<AudioSong>- Parameters:
song- some persistent object- Returns:
- persistent id
-
getWithId
public AudioSong getWithId(org.hibernate.Session session, Long id)
- Specified by:
getWithIdin interfacePageCacheDataSource<AudioSong>- Parameters:
session- sessionid- id of the object we are looking for- Returns:
- the persistent object or null, if not found
- See Also:
PageCacheDataSource.getWithIds(Session, Long...)
-
getWithIds
public List<AudioSong> getWithIds(org.hibernate.Session session, Long... ids)
Description copied from interface:PageCacheDataSourceCreates a query that selects persistent objects in the right order. query.setMaxResults(..) and query.setFirstResult(..) are set by the caller.- Specified by:
getWithIdsin interfacePageCacheDataSource<AudioSong>- Parameters:
session- sessionids- ids of the objects we are looking for- Returns:
- list of objects. not found objects are
null - See Also:
PageCacheDataSource.getWithId(Session, Long)
-
getIds
public IndexedId[] getIds(org.hibernate.Session session)
Description copied from interface:PageCacheDataSourceA complete list of sorted ids along with their natural indices. Indices of filtered out objects are flipped:-(index+1)- Specified by:
getIdsin interfacePageCacheDataSource<AudioSong>- Parameters:
session- hibernate session- Returns:
- a complete list of persistent ids
-
createPageQuery
public org.hibernate.Query createPageQuery(org.hibernate.Session session)
Description copied from interface:PageCacheDataSourceCreates a query that selects persistent objects in the right order. query.setMaxResults(..) and query.setFirstResult(..) are set by the caller.- Specified by:
createPageQueryin interfacePageCacheDataSource<AudioSong>- Parameters:
session- session- Returns:
- a query that returns objects in the right order or null, if such a query cannot be constructed
-
objectsAvailable
public void objectsAvailable(int index0, int index1)Description copied from interface:PageCacheDataSourceNotifies the data source, that the given index range has been loaded.- Specified by:
objectsAvailablein interfacePageCacheDataSource<AudioSong>- Parameters:
index0- start indexindex1- end index (inclusive)
-
getHibernateUtil
public HibernateUtil getHibernateUtil()
- Specified by:
getHibernateUtilin interfacePageCacheDataSource<AudioSong>- Returns:
- hibernate utilities
-
getHibernateMediaLibrary
public HibernateMediaLibrary<?> getHibernateMediaLibrary()
-
setHibernateMediaLibrary
public void setHibernateMediaLibrary(HibernateMediaLibrary<?> hibernateMediaLibrary)
-
getLiking
public AudioSong.Liking getLiking()
-
setLiking
public void setLiking(AudioSong.Liking value)
-
isAudiobooks
public boolean isAudiobooks()
Description copied from interface:PlayList- Specified by:
isAudiobooksin interfacePlayList
-
setAudiobooks
public void setAudiobooks(boolean value)
Description copied from interface:PlayList- Specified by:
setAudiobooksin interfacePlayList
-
isMovies
public boolean isMovies()
Description copied from interface:PlayList
-
isMusic
public boolean isMusic()
Description copied from interface:PlayList
-
setMusic
public void setMusic(boolean value)
Description copied from interface:PlayList
-
isTvShows
public boolean isTvShows()
Description copied from interface:PlayList
-
setTvShows
public void setTvShows(boolean value)
Description copied from interface:PlayList- Specified by:
setTvShowsin interfacePlayList
-
isPodcasts
public boolean isPodcasts()
Description copied from interface:PlayList- Specified by:
isPodcastsin interfacePlayList
-
setPodcasts
public void setPodcasts(boolean value)
Description copied from interface:PlayList- Specified by:
setPodcastsin interfacePlayList
-
getChildPlayLists
public List<PlayList> getChildPlayLists()
- Specified by:
getChildPlayListsin interfacePlayList
-
setChildPlayLists
public void setChildPlayLists(List<PlayList> childPlayLists)
- Specified by:
setChildPlayListsin interfacePlayList
-
getParentPlayList
public PlayList getParentPlayList()
- Specified by:
getParentPlayListin interfacePlayList
-
getPlayListPath
public PlayList[] getPlayListPath()
Description copied from interface:PlayListReturns path leading to this playlist and ending with it. I.e., the path has at least the length 1.- Specified by:
getPlayListPathin interfacePlayList- Returns:
- path of playlists
-
setParentPlayList
public void setParentPlayList(PlayList value)
- Specified by:
setParentPlayListin interfacePlayList
-
getDescription
public String getDescription()
- Specified by:
getDescriptionin interfacePlayList
-
setDescription
public void setDescription(String description)
- Specified by:
setDescriptionin interfacePlayList
-
isMaster
public boolean isMaster()
Description copied from interface:PlayListIndicates whether this playlist is a master playlist. E.g. the (invisible list) Library is typically the master playlist.- Specified by:
isMasterin interfacePlayList- Returns:
- true or false
- See Also:
PlayList.isLibrary()
-
getDistinguishedKind
public PlayList.Kind getDistinguishedKind()
Description copied from interface:PlayListReturns the special kind of this playlist.- Specified by:
getDistinguishedKindin interfacePlayList- Returns:
nullif unknown
-
setDistinguishedKind
public void setDistinguishedKind(PlayList.Kind value)
Description copied from interface:PlayListAllows setting of a special song type, likePlayList.Kind.PODCASTS.- Specified by:
setDistinguishedKindin interfacePlayList- Parameters:
value- kind
-
isLibrary
public boolean isLibrary()
Description copied from interface:PlayListIndicates that this is a library playlist, meaning one of the top level library views (e.g. Music, AudioBooks, etc.).- Specified by:
isLibraryin interfacePlayList- Returns:
- true or false
- See Also:
PlayList.isMaster()
-
getGeniusTrackID
public int getGeniusTrackID()
- Specified by:
getGeniusTrackIDin interfacePlayList
-
setGeniusTrackID
public void setGeniusTrackID(int value)
- Specified by:
setGeniusTrackIDin interfacePlayList
-
isGeniusPlaylist
public boolean isGeniusPlaylist()
- Specified by:
isGeniusPlaylistin interfacePlayList
-
setId
public void setId(Long value)
Description copied from interface:PlayListSets this list's id.
-
isAllItems
public boolean isAllItems()
- Specified by:
isAllItemsin interfacePlayList
-
setAllItems
public void setAllItems(boolean value)
- Specified by:
setAllItemsin interfacePlayList
-
getSmartInfo
public String getSmartInfo()
- Specified by:
getSmartInfoin interfacePlayList
-
setSmartInfo
public void setSmartInfo(String smartInfo)
- Specified by:
setSmartInfoin interfacePlayList
-
isSmartPlaylist
public boolean isSmartPlaylist()
- Specified by:
isSmartPlaylistin interfacePlayList
-
getSmartCriteria
public String getSmartCriteria()
- Specified by:
getSmartCriteriain interfacePlayList
-
setSmartCriteria
public void setSmartCriteria(String smartCriteria)
- Specified by:
setSmartCriteriain interfacePlayList
-
isVideos
public boolean isVideos()
Description copied from interface:PlayListiTunes 6 playlist attribute.
-
getIndexedSongIds
public IndexedId[] getIndexedSongIds()
Description copied from interface:PlayListA complete list of sorted ids along with their natural order indices (viaIndexedId.getIndex()). Natural indices of filtered out objects are flipped:-(index+1)- Specified by:
getIndexedSongIdsin interfacePlayList- Returns:
- a complete list of persistent ids along with their natural indices
-
getFilteredSongIds
public List<Long> getFilteredSongIds()
Description copied from interface:PlayListReturns song ids from this playlist, both sorted and filtered.- Specified by:
getFilteredSongIdsin interfacePlayList- Returns:
- song ids
-
getSongIds
public List<Long> getSongIds()
Description copied from interface:PlayListReturns song ids from this playlist, neither sorted not filtered.- Specified by:
getSongIdsin interfacePlayList- Returns:
- song ids
-
getSongIds
public List<Long> getSongIds(Set<? extends SongFilter> filters)
Description copied from interface:PlayListReturns song ids from this playlist, filtered with the given filters.- Specified by:
getSongIdsin interfacePlayList- Returns:
- song ids
- See Also:
PlayList.getSongs(Collection, int)
-
getSongs
public List<AudioSong> getSongs(Collection<? extends SongFilter> filters, int limit)
Description copied from interface:PlayListReturns songs from this playlist, filtered with the given filters.- Specified by:
getSongsin interfacePlayList- Parameters:
filters- filterslimit- limit, -1 for no limit- Returns:
- songs
- See Also:
PlayList.getSongIds(Set)
-
countSongs
public int countSongs(Collection<? extends SongFilter> filters)
Description copied from interface:PlayListReturns song count from this playlist, filtered with the given filters.- Specified by:
countSongsin interfacePlayList- Returns:
- song count
- See Also:
PlayList.getSongIds(Set)
-
filteredListIterator
public PlayListIterator<AudioSong> filteredListIterator(int firstNextFilteredIndex)
Description copied from interface:PlayListCreates a dynamically updated iterator for this playlist. This iterator will adjust to sort/filter changes to the underlying playlist.
The iterator does not support mutable operations.- Specified by:
filteredListIteratorin interfacePlayList- Parameters:
firstNextFilteredIndex- index to start iterating from, first call toListIterator.next()orListIterator.previous()will produce the song at the given index- Returns:
- read-only, dynamically adjusting list iterator
-
getFilteredSongs
public Iterable<AudioSong> getFilteredSongs()
Description copied from interface:PlayListReturns songs from this playlist, both sorted and filtered.- Specified by:
getFilteredSongsin interfacePlayList- Returns:
- songs
-
getSongs
public Iterable<AudioSong> getSongs()
Description copied from interface:PlayListReturns songs from this playlist, neither sorted nor filtered.
-
getSongsOrderedBy
public Iterable<AudioSong> getSongsOrderedBy(String sortProperty, PlayList.SortDirection direction)
Description copied from interface:PlayListReturns songs from this playlist, sorted by the given property.- Specified by:
getSongsOrderedByin interfacePlayList- Parameters:
sortProperty- propertydirection- direction- Returns:
- songs
-
getSongsOrderedBy
public Iterable<AudioSong> getSongsOrderedBy(String sortProperty, PlayList.SortDirection direction, int limit)
Description copied from interface:PlayListReturns songs from this playlist, sorted by the given property.- Specified by:
getSongsOrderedByin interfacePlayList- Parameters:
sortProperty- propertydirection- directionlimit- max number of songs to return- Returns:
- songs
-
addSongs
public void addSongs(int filteredIndex, String... locations)Description copied from interface:PlayListAdds songs to the playlist using only their locations.
Depending on the library implementation, the insert index may be ignored. If it is ignored, the songs will be appended at the end (this is the case for iTunes libraries).- Specified by:
addSongsin interfacePlayList- Parameters:
filteredIndex- filtered index, set this to-1, if you just want to add the song to the endlocations- file or URL- See Also:
AudioSongLocation.getLocation()
-
addSongIds
public void addSongIds(List<Long> songIds)
Description copied from interface:PlayListAdds the songs referenced by the given ids to this playlist.- Specified by:
addSongIdsin interfacePlayList- Parameters:
songIds- song ids
-
setSongs
public void setSongs(List<AudioSong> songs)
Description copied from interface:PlayListRemoves all songs from this playlist and replaces them with the given songs. If the songs are not in your library yet, corresponding entries in the database are created.
-
setSongIds
public void setSongIds(List<Long> songIds)
Description copied from interface:PlayListRemoves all songs from this playlist and replaces them with song connected to the given ids.- Specified by:
setSongIdsin interfacePlayList- Parameters:
songIds- song ids
-
addSongIds
public void addSongIds(int filteredIndex, List<Long> songIds)Description copied from interface:PlayListAdds the given songs at the given (filtered) index.- Specified by:
addSongIdsin interfacePlayList- Parameters:
filteredIndex- filtered indexsongIds- songs
-
addSongs
public void addSongs(int filteredIndex, List<AudioSong> songs)Description copied from interface:PlayListAdds the given songs at the given (filtered) index.
-
moveSongs
public int moveSongs(int[] fromIndices, int toIndex)Description copied from interface:PlayListMoves songs. All indices have to be filtered.
-
addSongs
public void addSongs(org.hibernate.Session session, gnu.trove.TLongCollection ids)Needs to be called from open transaction/session.- Parameters:
session- sessionids- ids
-
unfilteredIndices
public int[] unfilteredIndices(int... filteredIndices)
Description copied from interface:PlayListReturns the unfiltered indices for the given filtered (string, order) indices.- Specified by:
unfilteredIndicesin interfacePlayList- Parameters:
filteredIndices- filtered indices- Returns:
- unfiltered equivalents
-
filteredIndices
public int[] filteredIndices(int... unfilteredIndices)
Description copied from interface:PlayListReturns the filtered indices (string, order) for the given unfiltered indices.- Specified by:
filteredIndicesin interfacePlayList- Parameters:
unfilteredIndices- unfiltered indices- Returns:
- filtered equivalents or
-1, if that does not exist, because the index was filtered out
-
indexOf
public int indexOf(Long id)
Description copied from interface:PlayListReturns the first index of the given song.
-
removeSongs
public boolean removeSongs(Collection<Long> ids, boolean completelyDeleteSong)
Description copied from interface:PlayListRemoves the songs with the given ids from the list.- Specified by:
removeSongsin interfacePlayList- Parameters:
ids- idscompletelyDeleteSong- if set totrue, the song object itself is deleted and removed from all other lists as well- Returns:
- success
-
removeSongs
public boolean removeSongs(int... filteredIndices)
Description copied from interface:PlayListRemoves the song with the given (filtered) index from the playlist. If this is a library, the file is also deleted.- Specified by:
removeSongsin interfacePlayList- Parameters:
filteredIndices- filtered indices- Returns:
- true, if the system was able to find and remove the given song
-
removeAllSongs
public void removeAllSongs(org.hibernate.Session session)
Sets the internal persistent song array tonull. This method can only be called from a transactional/session context.- Parameters:
session- session
-
removeAllSongs
public void removeAllSongs()
Description copied from interface:PlayListRemoves all songs from this playlist.- Specified by:
removeAllSongsin interfacePlayList
-
getSong
public AudioSong getSong(int index)
Description copied from interface:PlayListReturns song from the given index, taking sorting and filtering into account. This method may returnnulleven if a corresponding song exists, because it is loaded asynchronously.
UsePlayList.getIdAt(int), if you need a synchronous result.- Specified by:
getSongin interfacePlayList- Parameters:
index- index- Returns:
- song or
null, if not in the cache or the index is bad - See Also:
PlayList.getIdAt(int)
-
getIdAt
public Long getIdAt(int index)
Description copied from interface:PlayListReturns id of the song at the given index, taking sorting and filtering into account. Other thanPlayList.getSong(int), this method always returns an id, if the index is valid.- Specified by:
getIdAtin interfacePlayList- Parameters:
index- index- Returns:
- id or null, if the index it not valid
- See Also:
PlayList.getSong(int)
-
getElementAt
public Object getElementAt(int index)
- Specified by:
getElementAtin interfaceListModel
-
updateCachedSong
public void updateCachedSong(AudioSong song)
-
clearCaches
public void clearCaches()
Clears all caches that holed info about song order, search results, and songs themselves. To also invalidate aggregate data, callrefresh()orrefresh(String).
-
refresh
public void refresh()
Clears the caches backing this playlist. This forces a reload the next time it is accessed.
-
refresh
public void refresh(String sortPropertyName)
All caches related to the given sort property are cleared.
-
isParentAFolder
public boolean isParentAFolder()
- Specified by:
isParentAFolderin interfacePlayList
-
isUserPlaylist
public boolean isUserPlaylist()
Description copied from interface:PlayListIndicates that the playlist is just a regular user playlist. Note that Matchlists are not considered regular user playlists.- Specified by:
isUserPlaylistin interfacePlayList- Returns:
- true or false.
-
isPurchasedMusic
public boolean isPurchasedMusic()
Description copied from interface:PlayList- Specified by:
isPurchasedMusicin interfacePlayList
-
setPurchasedMusic
public void setPurchasedMusic(boolean value)
- Specified by:
setPurchasedMusicin interfacePlayList
-
getParentId
public Long getParentId()
Description copied from interface:PlayListIf this is a sub-folder/playlist, this returns the parent id.- Specified by:
getParentIdin interfacePlayList- Returns:
- id
-
setParentId
public void setParentId(Long value)
Description copied from interface:PlayListSets the parent id.- Specified by:
setParentIdin interfacePlayList- Parameters:
value- id
-
isItemsEditable
public boolean isItemsEditable()
Description copied from interface:PlayListAre the contained items editable? E.g., items are not editable, if they are only available online, as the metadata of some stream or online database cannot be changed locally.- Specified by:
isItemsEditablein interfacePlayList- Returns:
- true or false
-
canInsertItem
public boolean canInsertItem()
Description copied from interface:PlayListIndicates whether we can insert items into this playlist.- Specified by:
canInsertItemin interfacePlayList- Returns:
- true or false, typically false for generated lists like "Music"
-
canAddItem
public boolean canAddItem()
Description copied from interface:PlayListIndicates whether we can add items to this playlist.- Specified by:
canAddItemin interfacePlayList- Returns:
- true or false, typically false for generated lists like "Music"
-
isEditable
public boolean isEditable()
Description copied from interface:PlayListIs this playlist editable? Only playlists created by users are editable.- Specified by:
isEditablein interfacePlayList- Returns:
- true or false
-
isAggregateDataAvailable
public boolean isAggregateDataAvailable()
Description copied from interface:PlayListIndicates whether we currently have valid aggregate (total size, duration, etc.) data. If the data is not available, the asynchronous computation is triggered.- Specified by:
isAggregateDataAvailablein interfacePlayList- Returns:
- true or false
-
getFileSize
public long getFileSize()
Description copied from interface:PlayListGet the sum of all file sizes (with filters applied).- Specified by:
getFileSizein interfacePlayList- Returns:
- sum of file sizes
-
getTotalTime
public long getTotalTime()
Description copied from interface:PlayListGet time with filters applied.- Specified by:
getTotalTimein interfacePlayList- Returns:
- time
-
setSize
public void setSize(int size)
-
getUnfilteredSize
public int getUnfilteredSize()
Description copied from interface:PlayListUnfiltered number of songs in playlist. May return-1, if the number is unknown- Specified by:
getUnfilteredSizein interfacePlayList- Returns:
- number of songs in playlist
- See Also:
PlayList.setSubstringFilter(String, PlayList.SubstringFilterProperty)
-
getUnfilteredTime
public long getUnfilteredTime()
Description copied from interface:PlayListGet time without any filters applied.- Specified by:
getUnfilteredTimein interfacePlayList- Returns:
- time
-
setSortColumnProperty
public void setSortColumnProperty(String sortColumnProperty)
Description copied from interface:PlayListSets "visual/semantic" sort property.- Specified by:
setSortColumnPropertyin interfacePlayList- Parameters:
sortColumnProperty- name of the property that is marked as sorted-by in the UI- See Also:
PlayList.getSortColumnProperty()
-
getSortColumnProperty
public String getSortColumnProperty()
Description copied from interface:PlayListReturns the name of the single property the playlist is sorted by. Note that for special properties likenamethis may not be the same properties as the ones we use forORDER BYSQL clauses. But, it's the property that should be highlighted in a UI.- Specified by:
getSortColumnPropertyin interfacePlayList- Returns:
- column
-
getSortProperties
public String[] getSortProperties()
Description copied from interface:PlayListActual sort properties, used inORDER BYHQL/SQL clauses.- Specified by:
getSortPropertiesin interfacePlayList- Returns:
- sort properties
-
getSortProperty
public String getSortProperty(int index)
Description copied from interface:PlayListActual sort property, used inORDER BYSQL clauses.- Specified by:
getSortPropertyin interfacePlayList- Parameters:
index- index- Returns:
- property or
null
-
getSyncTempo
public com.tagtraum.audiokern.bpm.Tempo getSyncTempo()
Description copied from interface:PlayListWhen set to a non-nullvalue,Keyvalues are displayed as if the song was played back at the given tempo. This has consequences for the sort order.- Specified by:
getSyncTempoin interfacePlayList- Returns:
- sync tempo
- See Also:
PlayList.setSortProperties(String...)
-
setSyncTempo
public void setSyncTempo(com.tagtraum.audiokern.bpm.Tempo syncTempo)
Description copied from interface:PlayListWhen set to a non-nullvalue,Keyvalues are displayed as if the song was played back at the given tempo. This has consequences for the sort order.- Specified by:
setSyncTempoin interfacePlayList- Specified by:
setSyncTempoin interfaceSyncTempoAware- Parameters:
syncTempo- sync tempo
-
setSortProperties
public void setSortProperties(String... properties)
Description copied from interface:PlayListSets sort properties.- Specified by:
setSortPropertiesin interfacePlayList- Parameters:
properties- sort properties
-
setSortDirection
public void setSortDirection(PlayList.SortDirection sortDirection)
Description copied from interface:PlayListSort direction.- Specified by:
setSortDirectionin interfacePlayList- Parameters:
sortDirection- sort direction
-
getSortDirection
public PlayList.SortDirection getSortDirection()
Description copied from interface:PlayListReturn sort direction.- Specified by:
getSortDirectionin interfacePlayList- Returns:
- sort direction
-
getSubstringFilter
public String getSubstringFilter()
Description copied from interface:PlayListCurrent substring filter.- Specified by:
getSubstringFilterin interfacePlayList- Returns:
- filter string
-
setSubstringFilter
public void setSubstringFilter(String substring, PlayList.SubstringFilterProperty substringFilterProperty)
Description copied from interface:PlayListSets the filter and which property to filter in one swoop.- Specified by:
setSubstringFilterin interfacePlayList- Parameters:
substring- filter stringsubstringFilterProperty- property to filter
-
getSubstringFilterProperty
public PlayList.SubstringFilterProperty getSubstringFilterProperty()
Description copied from interface:PlayListCurrent property to filter.- Specified by:
getSubstringFilterPropertyin interfacePlayList- Returns:
- which property to filter (substring)
- See Also:
PlayList.setSubstringFilter(String, SubstringFilterProperty)
-
getSpecialPlayListInfo
public SpecialPlayListInfo getSpecialPlayListInfo()
- Specified by:
getSpecialPlayListInfoin interfacePlayList
-
getSpecialPlayListInfoId
public Long getSpecialPlayListInfoId()
- Specified by:
getSpecialPlayListInfoIdin interfacePlayList
-
setSpecialPlayListInfo
public void setSpecialPlayListInfo(SpecialPlayListInfo value)
- Specified by:
setSpecialPlayListInfoin interfacePlayList
-
isSpecialPlayList
public boolean isSpecialPlayList()
- Specified by:
isSpecialPlayListin interfacePlayList
-
-