Interface FridgeMemberRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<FridgeMember,
,FridgeMemberId> org.springframework.data.jpa.repository.JpaRepository<FridgeMember,
,FridgeMemberId> org.springframework.data.jpa.repository.JpaSpecificationExecutor<FridgeMember>
,org.springframework.data.repository.ListCrudRepository<FridgeMember,
,FridgeMemberId> org.springframework.data.repository.ListPagingAndSortingRepository<FridgeMember,
,FridgeMemberId> org.springframework.data.repository.PagingAndSortingRepository<FridgeMember,
,FridgeMemberId> org.springframework.data.repository.query.QueryByExampleExecutor<FridgeMember>
,org.springframework.data.repository.Repository<FridgeMember,
FridgeMemberId>
@Repository
public interface FridgeMemberRepository
extends org.springframework.data.jpa.repository.JpaRepository<FridgeMember,FridgeMemberId>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<FridgeMember>
This repository provides CRUD operations for the RecipeItem entity.
It extends JpaRepository and JpaSpecificationExecutor interfaces.
JpaRepository provides basic CRUD operations while JpaSpecificationExecutor provides search functionality using specifications.
- Author:
- Trym Hamer Gudvangen
-
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteFridgeMemberByFridge_FridgeIdAndUser_Username
(Long fridgeId, String username) This method deletes the user attached to a given fridge id and which has a given username.boolean
existsFridgeMemberByFridge_FridgeIdAndUser_Username
(Long fridgeId, String username) This method tries to find whether an entry with a given user and fridge exists, by checking the fridge id and the username in the table.boolean
existsFridgeMemberByFridge_FridgeIdAndUser_UsernameAndSuperUserIs
(Long fridgeId, String username, boolean isSuperUser) This method tries to find whether an entry with a given user and fridge exists, by checking the fridge id and the username in the table, and where the user is a super user.findFridgeMemberByFridge_FridgeIdAndUser_Username
(Long fridgeId, String username) This method retrieves the user attached to a given fridge id and which has a given username.findFridgeMembersByFridge_FridgeId
(Long fridgeId) This method retrieves all the entries in the fridge member table for a given fridge.findFridgeMembersByUser_Username
(String username) This method retrieves all the entries in the fridge member table for a given user.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save
Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush
Methods inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor
count, delete, exists, findAll, findAll, findAll, findBy, findOne
Methods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAll
Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAll
Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAll
Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
existsFridgeMemberByFridge_FridgeIdAndUser_Username
This method tries to find whether an entry with a given user and fridge exists, by checking the fridge id and the username in the table.- Parameters:
fridgeId
- The id of fridge for a given member, given as a Long object.username
- The username of the member,- Returns:
- Status whether an entry with the given fridge id and username exists,
true
, elsefalse
.
-
existsFridgeMemberByFridge_FridgeIdAndUser_UsernameAndSuperUserIs
boolean existsFridgeMemberByFridge_FridgeIdAndUser_UsernameAndSuperUserIs(Long fridgeId, String username, boolean isSuperUser) This method tries to find whether an entry with a given user and fridge exists, by checking the fridge id and the username in the table, and where the user is a super user.- Parameters:
fridgeId
- The id of fridge for a given member, given as a Long object.username
- The username of the member,- Returns:
- Status whether an entry with the given fridge id and username exists,
true
, elsefalse
.
-
findFridgeMemberByFridge_FridgeIdAndUser_Username
Optional<FridgeMember> findFridgeMemberByFridge_FridgeIdAndUser_Username(Long fridgeId, String username) This method retrieves the user attached to a given fridge id and which has a given username.- Parameters:
fridgeId
- The id of the fridge to be checked, given as a Long object.username
- The username of the person, given as a String- Returns:
- The Fridge member with the specified info, given as an Optional object.
-
findFridgeMembersByUser_Username
This method retrieves all the entries in the fridge member table for a given user.- Parameters:
username
- The username of a user, given as a String- Returns:
- List of fridge member entries, given as an Optional.
-
findFridgeMembersByFridge_FridgeId
This method retrieves all the entries in the fridge member table for a given fridge.- Parameters:
fridgeId
- The id of a given fridge, given as a Long object.- Returns:
- List of fridge member entries, given as an Optional.
-
deleteFridgeMemberByFridge_FridgeIdAndUser_Username
@Lock(PESSIMISTIC_READ) @Modifying void deleteFridgeMemberByFridge_FridgeIdAndUser_Username(Long fridgeId, String username) This method deletes the user attached to a given fridge id and which has a given username.- Parameters:
fridgeId
- The id of the fridge to be checked, given as a Long object.username
- The username of the person, given as a String
-