Class Relationship


  • @Entity
    public class Relationship
    extends java.lang.Object

    The Relationship entity holds the data for each user-to-user relationship in the TuneFull server and provides a method to facilitate getting the other user in the relationship.

    Since:
    1.0
    Version:
    1.0
    Author:
    Robert Dominguez, Roderick Frechette, Laura Steiner
    • Constructor Summary

      Constructors 
      Constructor Description
      Relationship()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Boolean getFriendAccepted()
      Returns the Boolean indicating whether a friend relationship has been accepted, denied, or not yet responded to.
      java.lang.Long getId()
      Returns the id for the relationship.
      User getRequested()
      Returns the User entity associated with the user who received the relationship request.
      User getRequester()
      Returns the User entity associated with the user who requested the relationship.
      boolean isFriendRelationship()
      Returns a boolean indicating whether the relationship is a friendship or simply a follow relationship.
      User other​(User self)
      Returns the user on the other side of the relationship from the current user: the requested if the current user is the requester, and the requester if the current user is the requested.
      void setFriendAccepted​(java.lang.Boolean friendAccepted)
      Sets the Boolean indicating whether a friend relationship has been accepted, denied, or not yet responded to.
      void setFriendRelationship​(boolean friendRelationship)
      Sets the boolean indicating whether the relationship is a friendship or simply a follow relationship.
      void setRequested​(User requested)
      Sets the User entity associated with the user who received the relationship request.
      void setRequester​(User requester)
      Sets the User entity associated with the user who requested the relationship.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Relationship

        public Relationship()
    • Method Detail

      • getId

        public java.lang.Long getId()
        Returns the id for the relationship.
        Returns:
      • getRequester

        @NonNull
        public User getRequester()
        Returns the User entity associated with the user who requested the relationship.
        Returns:
      • setRequester

        public void setRequester​(@NonNull
                                 User requester)
        Sets the User entity associated with the user who requested the relationship.
        Parameters:
        requester - User
      • getRequested

        @NonNull
        public User getRequested()
        Returns the User entity associated with the user who received the relationship request.
        Returns:
      • setRequested

        public void setRequested​(@NonNull
                                 User requested)
        Sets the User entity associated with the user who received the relationship request.
        Parameters:
        requested - User
      • isFriendRelationship

        public boolean isFriendRelationship()
        Returns a boolean indicating whether the relationship is a friendship or simply a follow relationship.
        Returns:
      • setFriendRelationship

        public void setFriendRelationship​(boolean friendRelationship)
        Sets the boolean indicating whether the relationship is a friendship or simply a follow relationship.
        Parameters:
        friendRelationship - boolean
      • getFriendAccepted

        public java.lang.Boolean getFriendAccepted()
        Returns the Boolean indicating whether a friend relationship has been accepted, denied, or not yet responded to.
        Returns:
      • setFriendAccepted

        public void setFriendAccepted​(java.lang.Boolean friendAccepted)
        Sets the Boolean indicating whether a friend relationship has been accepted, denied, or not yet responded to.
        Parameters:
        friendAccepted - Boolean
      • other

        public User other​(User self)
        Returns the user on the other side of the relationship from the current user: the requested if the current user is the requester, and the requester if the current user is the requested.
        Parameters:
        self - User
        Returns:
        the user in the relationship that is not the current user