Class Notification
java.lang.Object
com.example.skeddly.business.database.DatabaseObject
com.example.skeddly.business.notification.Notification
Represents a single notification item within the application.
This class holds all relevant data for a notification, such as its type, content, and status.
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for creating a new Notification.Notification(String title, String message, String recipient, NotificationType type) Construct a notification with the given title and message. -
Method Summary
Modifier and TypeMethodDescriptionGets the main message content of the notification.Gets the recipient of the notification.Gets the status of an invitation notification.Gets the ID of the ticket associated with this notification, if any.longGets the timestamp indicating when the notification was created.getTitle()Gets the title of the notification.getType()Gets the type of the notification.booleanisRead()Checks if the notification has been marked as read.voidsetMessage(String message) Sets the main message content for the notification.voidsetRead(boolean read) Sets the read status of the notification.voidsetRecipient(String recipient) Sets the recipient of the notification.voidSets the status for an invitation notification.voidsetTicketId(String ticketId) Sets the ticket ID associated with this notification.voidsetTimestamp(long timestamp) Sets the timestamp for the notification.voidSets the title of the notification.voidsetType(NotificationType type) Sets the type of the notification.Methods inherited from class com.example.skeddly.business.database.DatabaseObject
fetchDatabaseObjectRelatedMethods, getId, setId
-
Constructor Details
-
Notification
public Notification()Default constructor for creating a new Notification. Sets its read status to false and status to pending. -
Notification
Construct a notification with the given title and message.- Parameters:
title- The title to set on the notification.message- The message that it should contain.recipient- The user id of the recipient of the message.type- The type of notification it is
-
-
Method Details
-
getTitle
Gets the title of the notification.- Returns:
- A string containing the title.
-
setTitle
Sets the title of the notification.- Parameters:
title- The string title to set.
-
getRecipient
Gets the recipient of the notification.- Returns:
- The user id of the recipient
-
setRecipient
Sets the recipient of the notification.- Parameters:
recipient- The user id of the recipient
-
getMessage
Gets the main message content of the notification.- Returns:
- A string containing the message.
-
setMessage
Sets the main message content for the notification.- Parameters:
message- The string message to set.
-
getTimestamp
public long getTimestamp()Gets the timestamp indicating when the notification was created.- Returns:
- A Date object representing the creation time.
-
setTimestamp
public void setTimestamp(long timestamp) Sets the timestamp for the notification.- Parameters:
timestamp- The Date to set.
-
getType
Gets the type of the notification.- Returns:
- The NotificationType enum value.
-
setType
Sets the type of the notification.- Parameters:
type- The NotificationType enum value to set.
-
getTicketId
Gets the ID of the ticket associated with this notification, if any.- Returns:
- A string representing the ticket ID.
-
setTicketId
Sets the ticket ID associated with this notification.- Parameters:
ticketId- The string ticket ID to set.
-
isRead
public boolean isRead()Checks if the notification has been marked as read.- Returns:
- A boolean, true if read, false otherwise.
-
setRead
public void setRead(boolean read) Sets the read status of the notification.- Parameters:
read- The boolean status to set.
-
getStatus
Gets the status of an invitation notification.- Returns:
- The NotificationInvitationStatus enum value.
-
setStatus
Sets the status for an invitation notification.- Parameters:
status- The NotificationInvitationStatus enum value to set.
-