Interface RelationshipRepository
-
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Relationship,java.lang.Long>,org.springframework.data.jpa.repository.JpaRepository<Relationship,java.lang.Long>,org.springframework.data.repository.PagingAndSortingRepository<Relationship,java.lang.Long>,org.springframework.data.repository.query.QueryByExampleExecutor<Relationship>,org.springframework.data.repository.Repository<Relationship,java.lang.Long>
public interface RelationshipRepository extends org.springframework.data.jpa.repository.JpaRepository<Relationship,java.lang.Long>
RelationshipRepositoryholds data forRelationship. Aside from the CRUD methods provided by the extension of JpaRepository,getAllByRequesterAndFriendRelationshipTrue,getAllByRequestedAndFriendRelationshipTrue,getAllByRequesterAndFriendRelationshipTrueOrRequestedAndFriendRelationshipTruegetAllByRequesterAndFriendRelationshipFalse,getAllByRequestedAndFriendAcceptedNull, andfindFirstByRequesterAndRequestedprovide for certain queries of the database.- Since:
- 1.0
- Version:
- 1.0
- Author:
- Robert Dominguez, Roderick Frechette, Laura Steiner
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Optional<Relationship>findFirstByRequesterAndRequested(User requester, User requested)Gets a relationship given its two users.java.util.List<Relationship>getAllByRequestedAndFriendAcceptedNull(User requested)Gets all pending friendships for a particular user (i.e., requests that that user hasn't responded to yet).java.util.List<Relationship>getAllByRequestedAndFriendRelationshipTrue(User requested)Gets all friendships for a particular requested.java.util.List<Relationship>getAllByRequesterAndFriendRelationshipFalse(User requester)Gets all follows for a particular user.java.util.List<Relationship>getAllByRequesterAndFriendRelationshipTrue(User requester)Gets all friendships for a particular requester.java.util.List<Relationship>getAllByRequesterAndFriendRelationshipTrueOrRequestedAndFriendRelationshipTrue(User requester, User requested)Gets all friendships for a particular user - the sameUsershould be used for both requester and requested.-
Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteById, existsById, findById, save
-
Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getOne, saveAll, saveAndFlush
-
-
-
-
Method Detail
-
getAllByRequesterAndFriendRelationshipTrue
java.util.List<Relationship> getAllByRequesterAndFriendRelationshipTrue(User requester)
Gets all friendships for a particular requester.- Parameters:
requester- User- Returns:
- List<Relationship>
-
getAllByRequestedAndFriendRelationshipTrue
java.util.List<Relationship> getAllByRequestedAndFriendRelationshipTrue(User requested)
Gets all friendships for a particular requested.- Parameters:
requested- User- Returns:
- List<Relationship>
-
getAllByRequesterAndFriendRelationshipTrueOrRequestedAndFriendRelationshipTrue
java.util.List<Relationship> getAllByRequesterAndFriendRelationshipTrueOrRequestedAndFriendRelationshipTrue(User requester, User requested)
Gets all friendships for a particular user - the sameUsershould be used for both requester and requested.- Parameters:
requester- Userrequested- User- Returns:
- List<Relationship>
-
getAllByRequesterAndFriendRelationshipFalse
java.util.List<Relationship> getAllByRequesterAndFriendRelationshipFalse(User requester)
Gets all follows for a particular user.- Parameters:
requester- User- Returns:
- List<Relationship>
-
getAllByRequestedAndFriendAcceptedNull
java.util.List<Relationship> getAllByRequestedAndFriendAcceptedNull(User requested)
Gets all pending friendships for a particular user (i.e., requests that that user hasn't responded to yet).- Parameters:
requested- User- Returns:
- List<Relationship>
-
findFirstByRequesterAndRequested
java.util.Optional<Relationship> findFirstByRequesterAndRequested(User requester, User requested)
Gets a relationship given its two users.- Parameters:
requester- Userrequested- User- Returns:
- Optional<Relationship>
-
-