magoffin.matt.ma2.dao
Interface AlbumDao

All Superinterfaces:
magoffin.matt.dao.GenericDao<Album,java.lang.Long>
All Known Implementing Classes:
HibernateAlbumDao

public interface AlbumDao
extends magoffin.matt.dao.GenericDao<Album,java.lang.Long>

DAO for Album objects.

Version:
$Revision: 43 $ $Date: 2007-10-21 11:10:01 +1300 (Sun, 21 Oct 2007) $
Author:
matt.magoffin

Method Summary
 java.util.List<Album> findAlbumsForUser(java.lang.Long userId)
          Find all top-level albums owned by a given user.
 java.util.List<Album> findAlbumsForUserAndName(java.lang.Long userId, java.lang.String name)
          Find top-level albums owned by a given user named a particular name.
 java.util.List<Album> findAlbumsForUserByDate(java.lang.Long userId, java.util.Calendar since, boolean anonymousOnly, boolean browseOnly, boolean feedOnly)
          Find top-level albums owned by a given user, ordered in descending order by date, for all albums created on or since a given date.
 java.util.List<Album> findAlbumsForUserByDate(java.lang.Long userId, int max, boolean anonymousOnly, boolean browseOnly, boolean feedOnly)
          Find top-level albums owned by a given user, ordered in descending order by date, with an optional maximum number of albums to return.
 java.util.List<Album> findSharedAlbumsContainingItem(MediaItem item)
          Get a list of all Albums that contain a given MediaItem and are shared.
 Album getAlbumForKey(java.lang.String anonymousKey)
          Get an Album for an anonymous key.
 Album getAlbumWithItems(java.lang.Long albumId)
          Get an Album with it's items fully populated.
 Album getParentAlbum(java.lang.Long childAlbumId)
          Get the parent album for another album.
 int reassignAlbumsUsingTheme(Theme oldTheme, Theme newTheme)
          Reassign all Albums using a particular Theme to a new Theme.
 
Methods inherited from interface magoffin.matt.dao.GenericDao
delete, get, store
 

Method Detail

findAlbumsForUser

java.util.List<Album> findAlbumsForUser(java.lang.Long userId)
Find all top-level albums owned by a given user.

Parameters:
userId - the ID of the user to find the albums for
Returns:
list of found albums, or empty List if none found

findAlbumsForUserByDate

java.util.List<Album> findAlbumsForUserByDate(java.lang.Long userId,
                                              int max,
                                              boolean anonymousOnly,
                                              boolean browseOnly,
                                              boolean feedOnly)
Find top-level albums owned by a given user, ordered in descending order by date, with an optional maximum number of albums to return.

Parameters:
userId - the ID of the user to find the albums for
max - the maximum number of albums to return, if greater than zero (otherwise return all albums)
anonymousOnly - if true then only get albums which allow anonymous access
browseOnly - if true then only get albums which allow browse access
feedOnly - if true then only get albums which allow feed access
Returns:
list of found albums, or empty list if none found

findAlbumsForUserByDate

java.util.List<Album> findAlbumsForUserByDate(java.lang.Long userId,
                                              java.util.Calendar since,
                                              boolean anonymousOnly,
                                              boolean browseOnly,
                                              boolean feedOnly)
Find top-level albums owned by a given user, ordered in descending order by date, for all albums created on or since a given date.

Parameters:
userId - the ID of the user to find the albums for
since - the date to get albums since
anonymousOnly - if true then only get albums which allow anonymous access
browseOnly - if true then only get albums which allow browse access
feedOnly - if true then only get albums which allow feed access
Returns:
list of found albums, or empty list if none found

findAlbumsForUserAndName

java.util.List<Album> findAlbumsForUserAndName(java.lang.Long userId,
                                               java.lang.String name)
Find top-level albums owned by a given user named a particular name.

Parameters:
userId - the ID of the user to find the albums for
name - the name of the album to find
Returns:
list of found albums, or empty list if none found

getAlbumForKey

Album getAlbumForKey(java.lang.String anonymousKey)
Get an Album for an anonymous key.

Parameters:
anonymousKey - the anonymous key
Returns:
the found Album, or null if not found

getParentAlbum

Album getParentAlbum(java.lang.Long childAlbumId)
Get the parent album for another album.

Parameters:
childAlbumId - the child album ID
Returns:
the parent Album, or null if the album has no parent

getAlbumWithItems

Album getAlbumWithItems(java.lang.Long albumId)
Get an Album with it's items fully populated.

Parameters:
albumId - the ID of the album
Returns:
the Album, or null if not found

reassignAlbumsUsingTheme

int reassignAlbumsUsingTheme(Theme oldTheme,
                             Theme newTheme)
Reassign all Albums using a particular Theme to a new Theme.

Parameters:
oldTheme - the Theme to search for
newTheme - the new Theme to replace the old Theme with
Returns:
the number of Albums updated

findSharedAlbumsContainingItem

java.util.List<Album> findSharedAlbumsContainingItem(MediaItem item)
Get a list of all Albums that contain a given MediaItem and are shared.

Parameters:
item - the item
Returns:
list of albums, or empty list if none found