Package backend.logic
Klasse FlaggedUserService
java.lang.Object
backend.logic.FlaggedUserService
The FlaggedUserService class provides functionality to manage and query users who have been flagged
for suspicious activity or violations in the system. It handles operations such as retrieving flagged
users, adding or updating flag counts, and removing permanent flags.
This service interacts with the database to maintain and update flag information for users, including the number of flags and whether a permanent flag has been set.
Key features include:
- Retrieving a list of all flagged users with their flag counts
- Adding new flags or updating existing flag counts for users
- Removing permanent flags (with restrictions)
-
Feldübersicht
Felder -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungConstructs a new FlaggedUserService with an empty list of flagged users. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic void
Adds a new flag for a user or updates the existing flag count if the user is already flagged.Retrieves all flagged users from the database along with their flag information.void
removePermanentFlag
(int userId) Removes a permanent flag from a user's record.
-
Felddetails
-
flaggedUsers
-
connectionProvider
secures DatabaseConnection
-
-
Konstruktordetails
-
FlaggedUserService
public FlaggedUserService()Constructs a new FlaggedUserService with an empty list of flagged users.
-
-
Methodendetails
-
getFlaggedUsers
Retrieves all flagged users from the database along with their flag information.- Gibt zurück:
- a List of FlaggedUser objects containing user IDs, names, flag counts, and permanent flag status
-
addOrUpdateFlaggedUser
Adds a new flag for a user or updates the existing flag count if the user is already flagged.- Parameter:
user
- the FlaggedUser object containing the user ID and flag information to add/update- Löst aus:
SQLException
- if a database access error occurs
-
removePermanentFlag
Removes a permanent flag from a user's record.- Parameter:
userId
- the ID of the user to remove the permanent flag from- Löst aus:
SQLException
- if a database access error occursIllegalArgumentException
- if attempting to remove a permanent flag from the current user
-