Interface PunishmentLog
- All Known Implementing Classes:
PunishmentLogProvider
Represents a punishment log entry in the system.
A punishment log is a record of a punishment action taken against a user or IP address. The log entry contains information such as the type of punishment, the reason for the punishment, the expiration time of the punishment, and the user who executed the punishment.
Each punishment log entry is uniquely identified by a UUID and is associated with a specific user or IP address. The log entry can be used to track the history of punishments applied to a user or IP address over time.
-
Method Summary
Modifier and TypeMethodDescriptionaddLogIp(int executorId, int typeId, InetAddress inetAddress, int reasonId) Adds a punishment log associated with an IP address to the system.addLogUser(int executorId, int typeId, int userId, InetAddress inetAddress, int reasonId) Adds a new log entry for a user to the punishment log.voiddeleteUserLogs(int userId) Deletes all logs associated with the specified user.booleanChecks if a log entry exists based on the specified log ID and type ID.getCreatedAt(UUID logId, int typeId) Retrieves the timestamp at which a punishment log was created.intgetCreatedBy(UUID logId, int typeId) Retrieves the ID of the user or entity that created the specified punishment log entry.getExpiredDate(UUID logId, int typeId) Retrieves the expiration date of a punishment log as a string.longgetExpiredTime(UUID logId, int typeId) Retrieves the expiration time for a specific punishment log entry.getIpAddress(UUID logId, int typeId) Retrieves the IP address associated with a specific punishment log.getLogs(int userId, int typeId) Retrieves a list of log identifiers associated with the specified user and punishment type.getLogs(InetAddress inetAddress, int typeId) Retrieves a list of log identifiers associated with a specific IP address and type.getModifiedAt(UUID logId, int typeId) Retrieves the timestamp of when the specified punishment log was last modified.intgetModifiedBy(UUID logId, int typeId) Retrieves the ID of the user who last modified the punishment log entry.intgetReasonId(UUID logId, int typeId) Retrieves the reason ID associated with a specific punishment log entry.intRetrieves the user ID associated with a specific punishment log.booleanDetermines if the punishment log entry associated with the specified log ID and type ID is expired.setExpiredTime(UUID logId, int typeId, int executorId, long duration) Sets the expiration time for a specific punishment log entry.voidsetReasonId(UUID logId, int typeId, int executorId, int reasonId) Updates the reason ID for a specific punishment log entry.
-
Method Details
-
existsLog
Checks if a log entry exists based on the specified log ID and type ID.- Parameters:
logId- The unique identifier of the log entrytypeId- The identifier for the type of the log entry- Returns:
- true if a log entry with the given log ID and type ID exists, otherwise false
-
addLogIp
Adds a punishment log associated with an IP address to the system.- Parameters:
executorId- The ID of the user responsible for executing the actiontypeId- The type ID of the punishment loginetAddress- The IP address associated with the punishment logreasonId- The reason ID for the punishment- Returns:
- The unique identifier (UUID) of the newly created punishment log
-
addLogUser
Adds a new log entry for a user to the punishment log.- Parameters:
executorId- The ID of the user performing the actiontypeId- The ID representing the type of log entryuserId- The ID of the target user associated with the loginetAddress- The IP address of the target userreasonId- The ID representing the reason for the log entry- Returns:
- A UUID representing the unique identifier of the newly added log entry
-
deleteUserLogs
void deleteUserLogs(int userId) Deletes all logs associated with the specified user.- Parameters:
userId- The unique identifier of the user whose logs are to be deleted
-
getLogs
Retrieves a list of log identifiers associated with the specified user and punishment type.- Parameters:
userId- The unique identifier of the user whose logs are to be retrievedtypeId- The type of punishment associated with the logs- Returns:
- A list of UUIDs representing the logs for the specified user and punishment type
-
getLogs
Retrieves a list of log identifiers associated with a specific IP address and type.- Parameters:
inetAddress- The IP address used to filter the logstypeId- The type identifier used to filter the logs- Returns:
- A list of UUIDs representing the matching logs
-
getUserId
Retrieves the user ID associated with a specific punishment log.- Parameters:
logId- The unique identifier of the punishment logtypeId- The type identifier of the punishment log- Returns:
- The user ID associated with the specified punishment log
-
getIpAddress
Retrieves the IP address associated with a specific punishment log.- Parameters:
logId- The unique identifier of the log entrytypeId- The type identifier of the log entry- Returns:
- The IP address as a string, or null if no IP address is associated with the specified log
-
getReasonId
Retrieves the reason ID associated with a specific punishment log entry.- Parameters:
logId- The unique identifier of the punishment log.typeId- The type identifier of the punishment log.- Returns:
- The ID of the reason linked to the specified punishment log entry.
-
setReasonId
Updates the reason ID for a specific punishment log entry.- Parameters:
logId- The unique identifier of the punishment log entry to be updated.typeId- The type identifier of the punishment log entry.executorId- The identifier of the user making the update.reasonId- The new reason identifier to set for the log entry.
-
getExpiredTime
Retrieves the expiration time for a specific punishment log entry.- Parameters:
logId- The unique identifier of the punishment log entrytypeId- The type ID of the punishment log- Returns:
- The expiration time of the punishment log in milliseconds since epoch
-
getExpiredDate
Retrieves the expiration date of a punishment log as a string.- Parameters:
logId- The unique identifier of the punishment logtypeId- The type identifier associated with the punishment log- Returns:
- The expiration date of the specified punishment log in string format
-
setExpiredTime
Sets the expiration time for a specific punishment log entry.- Parameters:
logId- The unique identifier of the punishment log entry.typeId- The type identifier of the punishment log entry.executorId- The identifier of the user making this change.duration- The duration in milliseconds that determines the new expiration time.- Returns:
- A string representation of the updated expiration date and time.
-
isExpired
Determines if the punishment log entry associated with the specified log ID and type ID is expired.- Parameters:
logId- The unique identifier of the punishment log entry.typeId- The type identifier of the punishment log entry.- Returns:
- true if the punishment log entry is expired, otherwise false.
-
getCreatedBy
Retrieves the ID of the user or entity that created the specified punishment log entry.- Parameters:
logId- The unique identifier of the punishment log entrytypeId- The type identifier of the punishment log entry- Returns:
- The ID of the creator of the punishment log entry
-
getCreatedAt
Retrieves the timestamp at which a punishment log was created.- Parameters:
logId- The unique identifier of the punishment logtypeId- The type identifier of the punishment log- Returns:
- The creation timestamp of the specified punishment log
-
getModifiedBy
Retrieves the ID of the user who last modified the punishment log entry.- Parameters:
logId- The unique identifier of the punishment log entrytypeId- The type identifier for the log entry- Returns:
- The ID of the user who last modified the log entry
-
getModifiedAt
Retrieves the timestamp of when the specified punishment log was last modified.- Parameters:
logId- The unique identifier of the punishment log.typeId- The type identifier of the punishment log.- Returns:
- The timestamp representing the last modification date and time of the specified log.
-