java.lang.Object
jku.se.Utilities.NotificationManager
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addNotification
(Notification notification) void
addNotificationForUser
(String userEmail, Notification notification) Adds a notification for a specific user.void
void
Clears all notifications.void
clearDeletedNotificationsForUser
(String userEmail) Clears the deleted notifications list.void
clearUserNotifications
(String userEmail) Clears all notifications for a specific user.static NotificationManager
getNotificationsForUser
(String userEmail) Gets all notifications for a specific user (global + user-specific).getUserSpecificNotifications
(String userEmail) Gets only user-specific notifications for a specific user (excludes global admin notifications).boolean
isNotificationDeleted
(String userEmail, String message) Checks if a notification message has been deleted by the user.void
loadDeletedNotificationsForUser
(String userEmail) Loads deleted notifications from the database for a specific user.void
markNotificationAsDeleted
(String userEmail, String message) Marks a notification message as deleted.boolean
removeNotification
(String notificationId) Removes a notification by its ID.boolean
removeNotification
(String notificationId, boolean markAsDeleted) Removes a notification by its ID from global notifications.boolean
removeNotificationForUser
(String userEmail, String notificationId) Removes a notification by its ID from either global or user-specific notifications.boolean
removeUserNotification
(String userEmail, String notificationId) Removes a notification by its ID from user-specific notifications.
-
Method Details
-
getInstance
-
loadDeletedNotificationsForUser
Loads deleted notifications from the database for a specific user.- Parameters:
userEmail
-
-
addNotification
-
addNotificationForUser
Adds a notification for a specific user.- Parameters:
userEmail
- The email of the user.notification
- The notification to add.
-
getNotifications
-
getNotificationsForUser
Gets all notifications for a specific user (global + user-specific).- Parameters:
userEmail
- The email of the user.- Returns:
- List of notifications for the user.
-
getUserSpecificNotifications
Gets only user-specific notifications for a specific user (excludes global admin notifications).- Parameters:
userEmail
- The email of the user.- Returns:
- List of user-specific notifications for the user.
-
isNotificationDeleted
Checks if a notification message has been deleted by the user.- Parameters:
userEmail
- The email of the user.message
- The message content to check.- Returns:
- true if the message has been deleted, false otherwise.
-
markNotificationAsDeleted
Marks a notification message as deleted.- Parameters:
userEmail
- The email of the user.message
- The message content to mark as deleted as saves it to the database.
-
removeNotification
Removes a notification by its ID.- Parameters:
notificationId
- The ID of the notification to remove.- Returns:
- true if the notification was found and removed, false otherwise.
-
removeNotification
Removes a notification by its ID from global notifications.- Parameters:
notificationId
- The ID of the notification to remove.markAsDeleted
- Whether to mark the notification as deleted for users.- Returns:
- true if the notification was found and removed, false otherwise.
-
removeUserNotification
Removes a notification by its ID from user-specific notifications.- Parameters:
userEmail
- The email of the user.notificationId
- The ID of the notification to remove.- Returns:
- true if the notification was found and removed, false otherwise.
-
removeNotificationForUser
Removes a notification by its ID from either global or user-specific notifications.- Parameters:
userEmail
- The email of the user.notificationId
- The ID of the notification to remove.- Returns:
- true if the notification was found and removed, false otherwise.
-
clearAllNotifications
public void clearAllNotifications()Clears all notifications. -
clearUserNotifications
Clears all notifications for a specific user.- Parameters:
userEmail
- The email of the user.
-
clearDeletedNotificationsForUser
Clears the deleted notifications list.- Parameters:
userEmail
-
-
clearAllDeletedNotifications
public void clearAllDeletedNotifications()
-