Package NTNU.IDATT1002.repository
Class ImageRepository
java.lang.Object
NTNU.IDATT1002.repository.AbstractRepository<T,ID>
NTNU.IDATT1002.repository.PagingAndSortingRepository<Image,java.lang.Long>
NTNU.IDATT1002.repository.ImageRepository
- All Implemented Interfaces:
Repository<Image,java.lang.Long>
public class ImageRepository extends PagingAndSortingRepository<Image,java.lang.Long>
Image Repository.
Implements
Repository
which supports regular Create, Read, Update and Delete operations.- Version:
- 1.0 19.03.20
- Author:
- Lars Østby
- See Also:
Repository
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
IMAGE_FIND_BY_QUERY_STRING
static java.lang.String
IMAGE_FIND_BY_TAG
static java.lang.String
IMAGE_FIND_BY_USERNAME
Mapping toNamedQuery
defined inImage
Fields inherited from class NTNU.IDATT1002.repository.AbstractRepository
entityClass, entityManager, logger
-
Constructor Summary
Constructors Constructor Description ImageRepository(javax.persistence.EntityManager entityManager)
Set the class type toImage
-
Method Summary
Modifier and Type Method Description java.util.List<Image>
findAllByQueryString(java.lang.String query)
Find all images based on a string.java.util.List<Image>
findAllByUsername(java.lang.String username)
Retrieves all albums of the user with the given username.Methods inherited from class NTNU.IDATT1002.repository.AbstractRepository
delete, deleteById, findAll, findById, save, setEntityClass, update
-
Field Details
-
IMAGE_FIND_BY_USERNAME
public static final java.lang.String IMAGE_FIND_BY_USERNAMEMapping toNamedQuery
defined inImage
- See Also:
- Constant Field Values
-
IMAGE_FIND_BY_TAG
public static final java.lang.String IMAGE_FIND_BY_TAG- See Also:
- Constant Field Values
-
IMAGE_FIND_BY_QUERY_STRING
public static final java.lang.String IMAGE_FIND_BY_QUERY_STRING- See Also:
- Constant Field Values
-
-
Constructor Details
-
ImageRepository
public ImageRepository(javax.persistence.EntityManager entityManager)Set the class type toImage
-
-
Method Details
-
findAllByUsername
Retrieves all albums of the user with the given username.- Parameters:
username
- the username to query for- Returns:
- the list of the users albums.
-
findAllByQueryString
Find all images based on a string. Combined result of title, tag and author search- Parameters:
query
-- Returns:
-