Package backend.logic

Klasse AnomalyDetectionService

java.lang.Object
backend.logic.AnomalyDetectionService

public class AnomalyDetectionService extends Object
Service class for managing and detecting anomalies in invoice data.

This class provides methods for extracting anomalies from the database, inserting new anomalies, checking suspicious users, and removing flags.

  • Felddetails

    • connectionProvider

      public static ConnectionProvider connectionProvider
      secures DatabaseConnection
  • Konstruktordetails

    • AnomalyDetectionService

      public AnomalyDetectionService()
  • Methodendetails

    • extractAnomalies

      public List<Anomaly> extractAnomalies()
      extracts anomalies from the database and returns them as a list
      Gibt zurück:
      a list of Anomaly objects
    • detectAnomaliesAndLog

      public static void detectAnomaliesAndLog(Invoice flaggedInvoice)
      inserts a new anomaly into the database based on the given invoice
      Parameter:
      flaggedInvoice - - the invoice that was flagged as suspicious
    • detectFlaggedUser

      public static FlaggedUser detectFlaggedUser(Integer userId) throws SQLException
      detects if a user is flagged as suspicious and returns a FlaggedUser object containing the user's ID and the number of flagged invoices.
      Parameter:
      userId - - the ID of the user whose flagged invoices should be detected.
      Gibt zurück:
      FlaggedUser - object of the user with the detected flagged invoices.
      Löst aus:
      SQLException
    • handleAnomalyDone

      public void handleAnomalyDone(Anomaly anomaly)
      removes the flag from an invoice and updates the user's flagged invoices counter
      Parameter:
      anomaly - - the anomaly that was handled
      Löst aus:
      SQLException