Class ContactService

java.lang.Object
restapi.services.ContactService

@Service public class ContactService extends Object
  • Field Details

  • Constructor Details

    • ContactService

      public ContactService()
  • Method Details

    • findUsersContacts

      public List<Long> findUsersContacts(long id)
      Get a list of user's contacts' ids
      Parameters:
      id - Id of user to retrieve the contacts of
      Returns:
      list of user's contacts' ids
    • findContact

      public Optional<ContactEntity> findContact(long user1, long user2)
      Find Contact Entity between user 1 and user 2
      Parameters:
      user1 - Id of user 1
      user2 - Id of user 2
      Returns:
      Optional of ContactEntity
    • areFriends

      public boolean areFriends(long user1, long user2)
      Returns True if users are friends, False otherwise
      Parameters:
      user1 - Id of user 1
      user2 - Id of user 2
      Returns:
      True if users are friends, False otherwise
    • addContact

      public void addContact(long sender, long receiver)
    • findActiveContacts

      public HashMap<Long,Long> findActiveContacts(long userId) throws CustomNotFoundException
      Return contacts that don't have me blocked, that I don't have blocked, and that are online.
      Parameters:
      userId - Current user to find contacts of
      Returns:
      HashMap ( CONTACT_ID : PARAM )
      Throws:
      CustomNotFoundException - When contact not found