Interface IChatDAO
- 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 TypeMethodDescriptionvoid
createChat
(Chat chat) Creates a new Chat in the database.void
deleteChat
(Chat chat) 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
updateChat
(Chat chat) Updates an existing Chat in the database.void
updateChatName
(Chat chat) Updates the name of an existing Chat in the database.
-
Method Details
-
createChat
Creates a new Chat in the database.- Parameters:
chat
- The Chat to create.- Throws:
SQLException
- If an SQL error occurs during the operation.
-
updateChat
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
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
Deletes a Chat from the database.- Parameters:
chat
- The Chat to delete.- Throws:
SQLException
- If an SQL error occurs during the operation.
-
getChat
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
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.
-