Class AlbumRepository

java.lang.Object
NTNU.IDATT1002.repository.AbstractRepository<T,​ID>
NTNU.IDATT1002.repository.PagingAndSortingRepository<Album,​java.lang.Long>
NTNU.IDATT1002.repository.AlbumRepository
All Implemented Interfaces:
Repository<Album,​java.lang.Long>

public class AlbumRepository
extends PagingAndSortingRepository<Album,​java.lang.Long>
Album Repository. Implementation of AbstractRepository which supports regular Create, Read, Update and Delete operations. Supports paginated and sorted content through PagingAndSortingRepository.
Version:
1.0 19.03.20
  • Field Details

  • Constructor Details

    • AlbumRepository

      public AlbumRepository​(javax.persistence.EntityManager entityManager)
      Set the class type to Album
  • Method Details

    • findAllByUsername

      public java.util.List<Album> findAllByUsername​(java.lang.String username)
      Retrieves all albums of the user with the given username.
      Parameters:
      username - the username to query for
      Returns:
      the list of the users albums.
    • findAllByTags

      public java.util.List<Album> findAllByTags​(java.lang.String tag)
    • findAllByTitle

      public java.util.List<Album> findAllByTitle​(java.lang.String title)
      Find all albums by given title.
      Parameters:
      title - the title to query for
      Returns:
      a list of albums found
    • findPreviewImage

      public java.util.Optional<Image> findPreviewImage​(java.lang.Long albumId)
      Find a single preview image from album with given id. Creates a new entity manager for each call to allow concurrent fetching within the maximum connection pool size.
      Parameters:
      albumId - the id of the album
      Returns:
      Optional of image if found