Class Benutzer

java.lang.Object
net.bjmsw.hda.vs.model.db.Benutzer

public class Benutzer extends Object
The Benutzer class represents a user entity in the database.

Works like a simple mini ORM.

  • Field Details

  • Constructor Details

    • Benutzer

      private Benutzer()
      The default constructor for the Benutzer class. This is a private constructor that initializes the lastRequest variable with the current date and time.
  • Method Details

    • getPassword

      public String getPassword()
      Gets the password of the user.
      Returns:
      The password of the user.
    • getName

      public String getName()
      Gets the name of the user.
      Returns:
      The name of the user.
    • setToken

      public void setToken(String token)
      Sets the token for the current user.
      Parameters:
      token - The token to set for the user.
    • getToken

      public String getToken()
      Gets the token of the user.
      Returns:
      The token of the user.
    • getId

      public long getId()
      Gets the ID of the user.
      Returns:
      The ID of the user.
    • fromDB

      public static Benutzer fromDB(String username)
      Retrieves a Benutzer object from the database based on the provided username.
      Parameters:
      username - The username of the Benutzer to retrieve.
      Returns:
      The Benutzer object if found in the database, or null if not found or an error occurs.
    • getAll

      public static List<Benutzer> getAll()
      Retrieves a list of all Benutzer objects from the database.
      Returns:
      A list of all Benutzer objects found in the database. If an error occurs while fetching the data, null is returned.
    • getType

      public Benutzer.USER_TYPE getType()
      Gets the type of the user.
      Returns:
      The type of the user.
    • setLastRequest

      public void setLastRequest(LocalDateTime lastRequest)
      Sets the last request time for the user.
      Parameters:
      lastRequest - The last request time to set for the user.
    • getLastRequest

      public LocalDateTime getLastRequest()
      Retrieves the date and time of the last request made by the user.
      Returns:
      The LocalDateTime representing the date and time of the last request.