Package backend.logic

Klasse FlaggedUserService

java.lang.Object
backend.logic.FlaggedUserService

public class FlaggedUserService extends Object
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)

  • Felddetails

  • Konstruktordetails

    • FlaggedUserService

      public FlaggedUserService()
      Constructs a new FlaggedUserService with an empty list of flagged users.
  • Methodendetails

    • getFlaggedUsers

      public List<FlaggedUser> 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

      public static void addOrUpdateFlaggedUser(FlaggedUser user) throws SQLException
      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

      public void removePermanentFlag(int userId) throws SQLException
      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 occurs
      IllegalArgumentException - if attempting to remove a permanent flag from the current user