Class SqlWarningDao
java.lang.Object
tk.airshipcraft.commonlib.db.dao.impl.SqlWarningDao
- All Implemented Interfaces:
WarningDao,GenericDao<Warning,UUID>
Provides SQL-specific data access operations for Warning objects.
Implements the WarningDao interface using a SQL database.
- Since:
- 2024-01-06
- Version:
- 1.0.0
- Author:
- notzune
-
Constructor Summary
ConstructorsConstructorDescriptionSqlWarningDao(SqlConnectionManager connectionManager) Constructs a SqlWarningDao with a given SqlConnectionManager. -
Method Summary
Modifier and TypeMethodDescriptionCreates a new Warning in the database.voiddeleteById(UUID uuid) Deletes a Warning from the database by its UUID.findAll()Retrieves all Warnings from the database.Retrieves a Warning by its unique ID.findByUser(UUID minecraftId, String discordId) Retrieves all Warnings issued to a specific Minecraft or Discord user.Updates an existing Warning in the database.
-
Constructor Details
-
SqlWarningDao
Constructs a SqlWarningDao with a given SqlConnectionManager.- Parameters:
connectionManager- The connection manager for database connections.
-
-
Method Details
-
findById
Retrieves a Warning by its unique ID.- Specified by:
findByIdin interfaceGenericDao<Warning,UUID> - Specified by:
findByIdin interfaceWarningDao- Parameters:
id- The UUID of the Warning.- Returns:
- An Optional containing the Warning if found, or an empty Optional otherwise.
-
findAll
Retrieves all Warnings from the database.- Specified by:
findAllin interfaceGenericDao<Warning,UUID> - Specified by:
findAllin interfaceWarningDao- Returns:
- A List of all Warnings.
-
create
Creates a new Warning in the database.- Specified by:
createin interfaceGenericDao<Warning,UUID> - Specified by:
createin interfaceWarningDao- Parameters:
entity- The Warning to be created.- Returns:
- The created Warning.
-
update
Updates an existing Warning in the database.- Specified by:
updatein interfaceGenericDao<Warning,UUID> - Specified by:
updatein interfaceWarningDao- Parameters:
entity- The Warning to be updated.- Returns:
- The updated Warning.
-
deleteById
Deletes a Warning from the database by its UUID.- Specified by:
deleteByIdin interfaceGenericDao<Warning,UUID> - Specified by:
deleteByIdin interfaceWarningDao- Parameters:
uuid- The UUID of the Warning to be deleted.
-
findByUser
Retrieves all Warnings issued to a specific Minecraft or Discord user.- Specified by:
findByUserin interfaceWarningDao- Parameters:
minecraftId- The UUID of the Minecraft user.discordId- The Discord ID of the user.- Returns:
- A List of Warnings associated with the given user.
-