Package net.bjmsw.hda.vs.model.db
Class Benutzer
java.lang.Object
net.bjmsw.hda.vs.model.db.Benutzer
The Benutzer class represents a user entity in the database.
Works like a simple mini ORM.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe USER_TYPE enum represents the different types of users in the system. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) longprivate LocalDateTimeprivate Stringprivate Stringprivate Stringprivate Benutzer.USER_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BenutzerRetrieves a Benutzer object from the database based on the provided username.getAll()Retrieves a list of all Benutzer objects from the database.longgetId()Gets the ID of the user.Retrieves the date and time of the last request made by the user.getName()Gets the name of the user.Gets the password of the user.getToken()Gets the token of the user.getType()Gets the type of the user.voidsetLastRequest(LocalDateTime lastRequest) Sets the last request time for the user.voidSets the token for the current user.
-
Field Details
-
id
long id -
name
-
password
-
token
-
type
-
lastRequest
-
-
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
Gets the password of the user.- Returns:
- The password of the user.
-
getName
Gets the name of the user.- Returns:
- The name of the user.
-
setToken
Sets the token for the current user.- Parameters:
token- The token to set for the user.
-
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
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
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
Gets the type of the user.- Returns:
- The type of the user.
-
setLastRequest
Sets the last request time for the user.- Parameters:
lastRequest- The last request time to set for the user.
-
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.
-