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>

    RelationshipRepository holds data for Relationship. Aside from the CRUD methods provided by the extension of JpaRepository, getAllByRequesterAndFriendRelationshipTrue, getAllByRequestedAndFriendRelationshipTrue, getAllByRequesterAndFriendRelationshipTrueOrRequestedAndFriendRelationshipTrue getAllByRequesterAndFriendRelationshipFalse, getAllByRequestedAndFriendAcceptedNull, and findFirstByRequesterAndRequested provide for certain queries of the database.

    Since:
    1.0
    Version:
    1.0
    Author:
    Robert Dominguez, Roderick Frechette, Laura Steiner
    • 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 same User should be used for both requester and requested.
        Parameters:
        requester - User
        requested - 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 - User
        requested - User
        Returns:
        Optional<Relationship>