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.void
deleteById
(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:
findById
in interfaceGenericDao<Warning,
UUID> - Specified by:
findById
in 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:
findAll
in interfaceGenericDao<Warning,
UUID> - Specified by:
findAll
in interfaceWarningDao
- Returns:
- A List of all Warnings.
-
create
Creates a new Warning in the database.- Specified by:
create
in interfaceGenericDao<Warning,
UUID> - Specified by:
create
in interfaceWarningDao
- Parameters:
entity
- The Warning to be created.- Returns:
- The created Warning.
-
update
Updates an existing Warning in the database.- Specified by:
update
in interfaceGenericDao<Warning,
UUID> - Specified by:
update
in interfaceWarningDao
- Parameters:
entity
- The Warning to be updated.- Returns:
- The updated Warning.
-
deleteById
Deletes a Warning from the database by its UUID.- Specified by:
deleteById
in interfaceGenericDao<Warning,
UUID> - Specified by:
deleteById
in 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:
findByUser
in 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.
-