Package backend.logic
Klasse AnomalyDetectionService
java.lang.Object
backend.logic.AnomalyDetectionService
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.
-
Feldübersicht
Felder -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic void
detectAnomaliesAndLog
(Invoice flaggedInvoice) inserts a new anomaly into the database based on the given invoicestatic FlaggedUser
detectFlaggedUser
(Integer userId) detects if a user is flagged as suspicious and returns a FlaggedUser object containing the user's ID and the number of flagged invoices.extracts anomalies from the database and returns them as a listvoid
handleAnomalyDone
(Anomaly anomaly) removes the flag from an invoice and updates the user's flagged invoices counter
-
Felddetails
-
connectionProvider
secures DatabaseConnection
-
-
Konstruktordetails
-
AnomalyDetectionService
public AnomalyDetectionService()
-
-
Methodendetails
-
extractAnomalies
extracts anomalies from the database and returns them as a list- Gibt zurück:
- a list of Anomaly objects
-
detectAnomaliesAndLog
inserts a new anomaly into the database based on the given invoice- Parameter:
flaggedInvoice
- - the invoice that was flagged as suspicious
-
detectFlaggedUser
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
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
-