Interface Log
- All Known Implementing Classes:
LogProvider
The Log interface represents a logger that stores and retrieves log entries.
-
Method Summary
Modifier and TypeMethodDescriptionaddExpiredTime(int logId, long time) Adds an expired time to the log entry with the specified log ID.intaddLog(int userId, int creatorId, int reasonId, long time) Adds a log entry to the logger.voiddeleteLog(int userId) Deletes all logs associated with a specific user.booleanexistsLog(int logId) Checks if a log with the specified log ID exists.getCreatedDate(int logId) Retrieves the created date of the log entry with the specified log ID.longgetCreatedTime(int logId) Retrieves the created time of the log entry with the specified log ID.intgetCreatorId(int logId) Retrieves the ID of the user who created the log entry with the specified log ID.getExpiredDate(int logId) Retrieves the expiration date of the log entry with the specified log ID.longgetExpiredTime(int logId) Retrieves the expiration time of the log entry with the specified log ID.intgetLogId(int userId) Retrieves the log ID associated with the specified user ID.getLogs(int userId) Retrieves the logs associated with the specified user ID.getReason(int logId) Retrieves the reason associated with the specified log ID.intgetReasonId(int logId) Retrieves the reason ID associated with the specified log ID.intgetUserId(int logId) Retrieves the user ID associated with the specified log ID.removeExpiredTime(int logId, long time) Removes the expired time from a log entry with the specified log ID.voidremoveLog(int logId) Removes a log entry from the logger.setExpiredTime(int logId, long time) Sets the expiration time for a log entry with the specified log ID.voidsetReasonId(int logId, int reasonId) Sets the reason ID for a log entry with the specified log ID.
-
Method Details
-
existsLog
boolean existsLog(int logId) Checks if a log with the specified log ID exists.- Parameters:
logId- The ID of the log to check.- Returns:
- true if a log with the specified log ID exists, false otherwise.
-
addLog
int addLog(int userId, int creatorId, int reasonId, long time) Adds a log entry to the logger.- Parameters:
userId- The ID of the user associated with the log entry.creatorId- The ID of the user who created the log entry.reasonId- The ID of the reason for the log entry.time- The timestamp of the log entry in milliseconds.- Returns:
- The ID of the newly added log entry.
-
removeLog
void removeLog(int logId) Removes a log entry from the logger.- Parameters:
logId- The ID of the log entry to be removed.
-
deleteLog
void deleteLog(int userId) Deletes all logs associated with a specific user.- Parameters:
userId- The ID of the user for whom the logs will be deleted.
-
getLogId
int getLogId(int userId) Retrieves the log ID associated with the specified user ID.- Parameters:
userId- The ID of the user for whom the log ID will be retrieved.- Returns:
- The log ID associated with the specified user ID.
-
getLogs
Retrieves the logs associated with the specified user ID.- Parameters:
userId- The ID of the user for whom the logs will be retrieved.- Returns:
- A list of integers representing the log IDs.
-
getUserId
int getUserId(int logId) Retrieves the user ID associated with the specified log ID.- Parameters:
logId- The ID of the log entry.- Returns:
- The user ID associated with the specified log ID.
-
getCreatorId
int getCreatorId(int logId) Retrieves the ID of the user who created the log entry with the specified log ID.- Parameters:
logId- The ID of the log entry.- Returns:
- The ID of the user who created the log entry.
-
getCreatedTime
long getCreatedTime(int logId) Retrieves the created time of the log entry with the specified log ID.- Parameters:
logId- The ID of the log entry.- Returns:
- The created time of the log entry, represented as a long value in milliseconds.
-
getCreatedDate
Retrieves the created date of the log entry with the specified log ID.- Parameters:
logId- The ID of the log entry.- Returns:
- The created date of the log entry, represented as a string.
-
getExpiredTime
long getExpiredTime(int logId) Retrieves the expiration time of the log entry with the specified log ID.- Parameters:
logId- The ID of the log entry.- Returns:
- The expiration time of the log entry, represented as a long value in milliseconds.
-
getExpiredDate
Retrieves the expiration date of the log entry with the specified log ID.- Parameters:
logId- The ID of the log entry.- Returns:
- The expiration date of the log entry, represented as a string.
-
setExpiredTime
Sets the expiration time for a log entry with the specified log ID.- Parameters:
logId- The ID of the log entry.time- The new expiration time in milliseconds.- Returns:
- A string representing the result of setting the expiration time. Returns an empty string if successful.
-
addExpiredTime
Adds an expired time to the log entry with the specified log ID.- Parameters:
logId- The ID of the log entry.time- The expired time to be added, represented as a long value in milliseconds.- Returns:
- A string representing the result of adding the expired time. Returns an empty string if successful.
-
removeExpiredTime
Removes the expired time from a log entry with the specified log ID.- Parameters:
logId- The ID of the log entry.time- The expired time to be removed, represented as a long value in milliseconds.- Returns:
- A string representing the result of removing the expired time. Returns an empty string if successful.
-
getReasonId
int getReasonId(int logId) Retrieves the reason ID associated with the specified log ID.- Parameters:
logId- The ID of the log entry.- Returns:
- The reason ID associated with the specified log ID.
-
setReasonId
void setReasonId(int logId, int reasonId) Sets the reason ID for a log entry with the specified log ID.- Parameters:
logId- The ID of the log entry.reasonId- The reason ID to be set for the log entry.
-
getReason
Retrieves the reason associated with the specified log ID.- Parameters:
logId- The ID of the log entry.- Returns:
- The reason associated with the specified log ID, represented as a string.
-