All Known Implementing Classes:
ChatDAO

public interface IChatDAO
Defines the interface for a Chat DAO. Any class implementing IChatDAO must provide implementations for the CRUD methods and other chat-related operations in this interface.
Author:
Joshua M.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Creates a new Chat in the database.
    void
    Deletes a Chat from the database.
    getAllUserChats(int userId)
    Retrieves all Chats associated with a specific user.
    getChat(int id)
    Retrieves a Chat from the database by its ID.
    void
    Updates an existing Chat in the database.
    void
    Updates the name of an existing Chat in the database.
  • Method Details

    • createChat

      void createChat(Chat chat) throws SQLException
      Creates a new Chat in the database.
      Parameters:
      chat - The Chat to create.
      Throws:
      SQLException - If an SQL error occurs during the operation.
    • updateChat

      void updateChat(Chat chat) throws SQLException
      Updates an existing Chat in the database.
      Parameters:
      chat - The Chat with updated information.
      Throws:
      SQLException - If an SQL error occurs during the operation.
    • updateChatName

      void updateChatName(Chat chat) throws SQLException
      Updates the name of an existing Chat in the database.
      Parameters:
      chat - The Chat object containing the ID and the new name.
      Throws:
      SQLException - If an SQL error occurs during the operation.
    • deleteChat

      void deleteChat(Chat chat) throws SQLException
      Deletes a Chat from the database.
      Parameters:
      chat - The Chat to delete.
      Throws:
      SQLException - If an SQL error occurs during the operation.
    • getChat

      Chat getChat(int id) throws SQLException
      Retrieves a Chat from the database by its ID.
      Parameters:
      id - The ID of the Chat to retrieve.
      Returns:
      The Chat matching the ID, or null if not found.
      Throws:
      SQLException - If an SQL error occurs during the operation.
    • getAllUserChats

      List<Chat> getAllUserChats(int userId) throws SQLException
      Retrieves all Chats associated with a specific user.
      Parameters:
      userId - The ID of the user whose chats are to be retrieved.
      Returns:
      A list of Chat objects associated with the user.
      Throws:
      SQLException - If an SQL error occurs during the operation.