Module Lunchify

Class NotificationManager

java.lang.Object
jku.se.Utilities.NotificationManager

public final class NotificationManager extends Object
  • Method Details

    • getInstance

      public static NotificationManager getInstance()
    • loadDeletedNotificationsForUser

      public void loadDeletedNotificationsForUser(String userEmail)
      Loads deleted notifications from the database for a specific user.
      Parameters:
      userEmail -
    • addNotification

      public void addNotification(Notification notification)
    • addNotificationForUser

      public void addNotificationForUser(String userEmail, Notification notification)
      Adds a notification for a specific user.
      Parameters:
      userEmail - The email of the user.
      notification - The notification to add.
    • getNotifications

      public List<Notification> getNotifications()
    • getNotificationsForUser

      public List<Notification> getNotificationsForUser(String userEmail)
      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

      public List<Notification> getUserSpecificNotifications(String userEmail)
      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

      public boolean isNotificationDeleted(String userEmail, String message)
      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

      public void markNotificationAsDeleted(String userEmail, String message)
      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

      public boolean removeNotification(String notificationId)
      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

      public boolean removeNotification(String notificationId, boolean markAsDeleted)
      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

      public boolean removeUserNotification(String userEmail, String notificationId)
      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

      public boolean removeNotificationForUser(String userEmail, String notificationId)
      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

      public void clearUserNotifications(String userEmail)
      Clears all notifications for a specific user.
      Parameters:
      userEmail - The email of the user.
    • clearDeletedNotificationsForUser

      public void clearDeletedNotificationsForUser(String userEmail)
      Clears the deleted notifications list.
      Parameters:
      userEmail -
    • clearAllDeletedNotifications

      public void clearAllDeletedNotifications()