Class LogProvider

java.lang.Object
de.murmelmeister.murmelapi.bansystem.log.LogProvider
All Implemented Interfaces:
Log

public final class LogProvider extends Object implements Log
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static enum 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final SimpleDateFormat
     
    private final Reason
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    LogProvider(String tableName, Reason reason)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    addExpiredTime(int logId, long time)
    Adds an expired time to the log entry with the specified log ID.
    int
    addLog(int userId, int creatorId, int reasonId, long time)
    Adds a log entry to the logger.
    void
    createTable(String tableName)
     
    void
    deleteLog(int userId)
    Deletes all logs associated with a specific user.
    boolean
    existsLog(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.
    long
    getCreatedTime(int logId)
    Retrieves the created time of the log entry with the specified log ID.
    int
    getCreatorId(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.
    long
    getExpiredTime(int logId)
    Retrieves the expiration time of the log entry with the specified log ID.
    int
    getLogId(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.
    int
    getReasonId(int logId)
    Retrieves the reason ID associated with the specified log ID.
    int
    getUserId(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.
    void
    removeLog(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.
    void
    setReasonId(int logId, int reasonId)
    Sets the reason ID for a log entry with the specified log ID.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • LogProvider

      public LogProvider(String tableName, Reason reason)
  • Method Details

    • createTable

      public void createTable(String tableName)
    • existsLog

      public boolean existsLog(int logId)
      Description copied from interface: Log
      Checks if a log with the specified log ID exists.
      Specified by:
      existsLog in interface Log
      Parameters:
      logId - The ID of the log to check.
      Returns:
      true if a log with the specified log ID exists, false otherwise.
    • addLog

      public int addLog(int userId, int creatorId, int reasonId, long time)
      Description copied from interface: Log
      Adds a log entry to the logger.
      Specified by:
      addLog in interface Log
      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

      public void removeLog(int logId)
      Description copied from interface: Log
      Removes a log entry from the logger.
      Specified by:
      removeLog in interface Log
      Parameters:
      logId - The ID of the log entry to be removed.
    • deleteLog

      public void deleteLog(int userId)
      Description copied from interface: Log
      Deletes all logs associated with a specific user.
      Specified by:
      deleteLog in interface Log
      Parameters:
      userId - The ID of the user for whom the logs will be deleted.
    • getLogId

      public int getLogId(int userId)
      Description copied from interface: Log
      Retrieves the log ID associated with the specified user ID.
      Specified by:
      getLogId in interface Log
      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

      public List<Integer> getLogs(int userId)
      Description copied from interface: Log
      Retrieves the logs associated with the specified user ID.
      Specified by:
      getLogs in interface Log
      Parameters:
      userId - The ID of the user for whom the logs will be retrieved.
      Returns:
      A list of integers representing the log IDs.
    • getUserId

      public int getUserId(int logId)
      Description copied from interface: Log
      Retrieves the user ID associated with the specified log ID.
      Specified by:
      getUserId in interface Log
      Parameters:
      logId - The ID of the log entry.
      Returns:
      The user ID associated with the specified log ID.
    • getCreatorId

      public int getCreatorId(int logId)
      Description copied from interface: Log
      Retrieves the ID of the user who created the log entry with the specified log ID.
      Specified by:
      getCreatorId in interface Log
      Parameters:
      logId - The ID of the log entry.
      Returns:
      The ID of the user who created the log entry.
    • getCreatedTime

      public long getCreatedTime(int logId)
      Description copied from interface: Log
      Retrieves the created time of the log entry with the specified log ID.
      Specified by:
      getCreatedTime in interface Log
      Parameters:
      logId - The ID of the log entry.
      Returns:
      The created time of the log entry, represented as a long value in milliseconds.
    • getCreatedDate

      public String getCreatedDate(int logId)
      Description copied from interface: Log
      Retrieves the created date of the log entry with the specified log ID.
      Specified by:
      getCreatedDate in interface Log
      Parameters:
      logId - The ID of the log entry.
      Returns:
      The created date of the log entry, represented as a string.
    • getExpiredTime

      public long getExpiredTime(int logId)
      Description copied from interface: Log
      Retrieves the expiration time of the log entry with the specified log ID.
      Specified by:
      getExpiredTime in interface Log
      Parameters:
      logId - The ID of the log entry.
      Returns:
      The expiration time of the log entry, represented as a long value in milliseconds.
    • getExpiredDate

      public String getExpiredDate(int logId)
      Description copied from interface: Log
      Retrieves the expiration date of the log entry with the specified log ID.
      Specified by:
      getExpiredDate in interface Log
      Parameters:
      logId - The ID of the log entry.
      Returns:
      The expiration date of the log entry, represented as a string.
    • setExpiredTime

      public String setExpiredTime(int logId, long time)
      Description copied from interface: Log
      Sets the expiration time for a log entry with the specified log ID.
      Specified by:
      setExpiredTime in interface Log
      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

      public String addExpiredTime(int logId, long time)
      Description copied from interface: Log
      Adds an expired time to the log entry with the specified log ID.
      Specified by:
      addExpiredTime in interface Log
      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

      public String removeExpiredTime(int logId, long time)
      Description copied from interface: Log
      Removes the expired time from a log entry with the specified log ID.
      Specified by:
      removeExpiredTime in interface Log
      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

      public int getReasonId(int logId)
      Description copied from interface: Log
      Retrieves the reason ID associated with the specified log ID.
      Specified by:
      getReasonId in interface Log
      Parameters:
      logId - The ID of the log entry.
      Returns:
      The reason ID associated with the specified log ID.
    • setReasonId

      public void setReasonId(int logId, int reasonId)
      Description copied from interface: Log
      Sets the reason ID for a log entry with the specified log ID.
      Specified by:
      setReasonId in interface Log
      Parameters:
      logId - The ID of the log entry.
      reasonId - The reason ID to be set for the log entry.
    • getReason

      public String getReason(int logId)
      Description copied from interface: Log
      Retrieves the reason associated with the specified log ID.
      Specified by:
      getReason in interface Log
      Parameters:
      logId - The ID of the log entry.
      Returns:
      The reason associated with the specified log ID, represented as a string.