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 EMailNotifier
The notifier that will be used to send the e-mail notifications to the user via the university's SMTP server.private double
This grade and all grades better that it will be included in the notification.private Notifications.IncludeGrades
Whether to reveal the new grades in the notifications sent to the user.private NtfyNotifier
The notifier that will be used to send the push notifications to the user's device via the Ntfy service.private UnifiedPushNotifier
The 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 Notifications
copy()
@NonNull Optional
<EMailNotifier> @NonNull Optional
<NtfyNotifier> @NonNull Optional
<UnifiedPushNotifier> boolean
isEmpty()
boolean
void
Deletes the currentEMail
notifier, so that no notifications will be sent via e-mail.void
Deletes the currentNtfy
notifier, so that no notifications will be sent via Ntfy.void
Deletes the currentUnifiedPush
notifier, so that no notifications will be sent via UnifiedPush.void
setEmailNotifier
(@NonNull EMailNotifier emailNotifier) Updates theincludeGrades
field to the exact reference of the given object.void
setGoodGradesThreshold
(double goodGradesThreshold) Updates theincludeGrades
field to the given value.void
setNtfyNotifier
(@NonNull NtfyNotifier ntfyNotifier) Updates theincludeGrades
field to the exact reference of the given object.void
setUnifiedPushNotifier
(@NonNull UnifiedPushNotifier unifiedPushNotifier) Updates theincludeGrades
field to the exact reference of the given object.@NonNull String
toString()
@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 theincludeGrades
field 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 theincludeGrades
field to the exact reference of the given object.- Parameters:
emailNotifier
- The new value for theemailNotifier
field.
-
setNtfyNotifier
Updates theincludeGrades
field to the exact reference of the given object.- Parameters:
ntfyNotifier
- The new value for thentfyNotifier
field.
-
setUnifiedPushNotifier
Updates theincludeGrades
field to the exact reference of the given object.- Parameters:
unifiedPushNotifier
- The new value for theunifiedPushNotifier
field.
-
resetEmailNotifier
public void resetEmailNotifier()Deletes the currentEMail
notifier, so that no notifications will be sent via e-mail. -
resetNtfyNotifier
public void resetNtfyNotifier()Deletes the currentNtfy
notifier, so that no notifications will be sent via Ntfy. -
resetUnifiedPushNotifier
public void resetUnifiedPushNotifier()Deletes the currentUnifiedPush
notifier, 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
, andunifiedPushNotifier
are allnull
. False otherwise.
-
isPresent
public boolean isPresent() -
copy
- Specified by:
copy
in 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:
toString
in interfaceRedactable
- Overrides:
toString
in classObject
- Returns:
- A string representation of this object including all fields, even sensitive ones.
-
toStringRedacted
- Specified by:
toStringRedacted
in interfaceRedactable
- Returns:
- Same as
toString()
, but redacts thentfyNotifier
andunifiedPushNotifier
if the debug level is set toDebugLevel.WARN
orDebugLevel.ERROR
.
-