Class Notifications
java.lang.Object
page.codeberg.friedolyn.configuration.Notifications
- All Implemented Interfaces:
Copyable<Notifications>,Redactable
The configuration for the notifications that Friedolyn shall send to the user.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate EMailNotifierThe notifier that will be used to send the e-mail notifications to the user via the university's SMTP server.private doubleThis grade and all grades better that it will be included in the notification.private Notifications.IncludeGradesWhether to reveal the new grades in the notifications sent to the user.private NtfyNotifierThe notifier that will be used to send the push notifications to the user's device via the Ntfy service.private UnifiedPushNotifierThe notifier that will be used to send the push notifications to the user's device via the UnifiedPush service. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NonNull Notificationscopy()@NonNull Optional<EMailNotifier> @NonNull Optional<NtfyNotifier> @NonNull Optional<UnifiedPushNotifier> booleanisEmpty()booleanvoidDeletes the currentEMailnotifier, so that no notifications will be sent via e-mail.voidDeletes the currentNtfynotifier, so that no notifications will be sent via Ntfy.voidDeletes the currentUnifiedPushnotifier, so that no notifications will be sent via UnifiedPush.voidsetEmailNotifier(@NonNull EMailNotifier emailNotifier) Updates theincludeGradesfield to the exact reference of the given object.voidsetGoodGradesThreshold(double goodGradesThreshold) Updates theincludeGradesfield to the given value.voidsetNtfyNotifier(@NonNull NtfyNotifier ntfyNotifier) Updates theincludeGradesfield to the exact reference of the given object.voidsetUnifiedPushNotifier(@NonNull UnifiedPushNotifier unifiedPushNotifier) Updates theincludeGradesfield to the exact reference of the given object.@NonNull StringtoString()@NonNull String
-
Field Details
-
includeGrades
Whether to reveal the new grades in the notifications sent to the user. -
goodGradesThreshold
private double goodGradesThresholdThis grade and all grades better that it will be included in the notification. Worse grades will not be revealed. -
emailNotifier
The notifier that will be used to send the e-mail notifications to the user via the university's SMTP server. If the user does not wish to receive notifications via e-mail, this field will benull. -
ntfyNotifier
The notifier that will be used to send the push notifications to the user's device via the Ntfy service. If the user does not wish to receive notifications via Ntfy, this field will benull. -
unifiedPushNotifier
The notifier that will be used to send the push notifications to the user's device via the UnifiedPush service. If the user does not wish to receive notifications via UnifiedPush, this field will benull.
-
-
Constructor Details
-
Notifications
public Notifications()
-
-
Method Details
-
setGoodGradesThreshold
Updates theincludeGradesfield to the given value.- Parameters:
goodGradesThreshold- Grades equal to or better than (i.e. lower than) this value will be revealed in the notifications. Grades worse (i.e. higher) than this value will not be revealed. Must be between 1.0 and 4.0 (inclusive).- Throws:
IllegalArgumentException- If the given value is lower than 1.0 or greater than 4.0.
-
setEmailNotifier
Updates theincludeGradesfield to the exact reference of the given object.- Parameters:
emailNotifier- The new value for theemailNotifierfield.
-
setNtfyNotifier
Updates theincludeGradesfield to the exact reference of the given object.- Parameters:
ntfyNotifier- The new value for thentfyNotifierfield.
-
setUnifiedPushNotifier
Updates theincludeGradesfield to the exact reference of the given object.- Parameters:
unifiedPushNotifier- The new value for theunifiedPushNotifierfield.
-
resetEmailNotifier
public void resetEmailNotifier()Deletes the currentEMailnotifier, so that no notifications will be sent via e-mail. -
resetNtfyNotifier
public void resetNtfyNotifier()Deletes the currentNtfynotifier, so that no notifications will be sent via Ntfy. -
resetUnifiedPushNotifier
public void resetUnifiedPushNotifier()Deletes the currentUnifiedPushnotifier, so that no notifications will be sent via UnifiedPush. -
getEmailNotifier
- Returns:
- The exact reference of the
emailNotifier. Empty if it isnull.
-
getNtfyNotifier
- Returns:
- The exact reference of the
ntfyNotifier. Empty if it isnull.
-
getUnifiedPushNotifier
- Returns:
- The exact reference of the
unifiedPushNotifier. Empty if it isnull.
-
isEmpty
public boolean isEmpty()- Returns:
- True if
emailNotifier,ntfyNotifier, andunifiedPushNotifierare allnull. False otherwise.
-
isPresent
public boolean isPresent() -
copy
- Specified by:
copyin interfaceCopyable<Notifications>- Returns:
- A deep copy of the object, i.e. a clone that has the exact same values as the original object, but is a different instance (new reference).
-
toString
- Specified by:
toStringin interfaceRedactable- Overrides:
toStringin classObject- Returns:
- A string representation of this object including all fields, even sensitive ones.
-
toStringRedacted
- Specified by:
toStringRedactedin interfaceRedactable- Returns:
- Same as
toString(), but redacts thentfyNotifierandunifiedPushNotifierif the debug level is set toDebugLevel.WARNorDebugLevel.ERROR.
-