From bdad5c382e7c07ca371fb42e0a6c0d03905692a6 Mon Sep 17 00:00:00 2001 From: Hassan Matout Date: Tue, 26 Nov 2024 01:44:59 +0100 Subject: [PATCH] Development: Add missing javadocs to dto classes --- .../service/notifications/MailService.java | 1 - .../activation_mail/ActivationMailRecipientDTO.java | 3 +++ .../DataExportFailedContentDTO.java | 6 ++++++ .../DataExportFailedMailAdminRecipientDTO.java | 3 +++ .../DataExportSuccessfulContentDTO.java | 5 +++++ .../DataExportSuccessfulContentsDTO.java | 3 +++ .../DataExportSuccessfulMailAdminRecipientDTO.java | 3 +++ .../notifications/NotificationMailRecipientDTO.java | 3 +++ .../PasswordResetRecipientDTO.java | 3 +++ .../SAML2SetPasswordMailRecipientDTO.java | 3 +++ .../WeeklyExerciseSummaryDTO.java | 11 +++++++++++ .../WeeklySummaryMailContentDTO.java | 13 +++++++++++++ .../WeeklySummaryMailRecipientDTO.java | 3 +++ .../service/mail/ActivationMailTest.java | 3 +++ .../service/mail/DataExportFailedMailTest.java | 3 +++ .../service/mail/DataExportSuccessfulMailTest.java | 3 +++ .../service/mail/PasswordResetMailTest.java | 3 +++ .../service/mail/SAML2SetPasswordMailTest.java | 3 +++ .../service/mail/WeeklySummaryMailTest.java | 3 +++ 19 files changed, 77 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/MailService.java b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/MailService.java index 51f7460d84aa..5c2ea605d731 100644 --- a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/MailService.java +++ b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/MailService.java @@ -239,7 +239,6 @@ public void sendNotification(Notification notification, Set users, Object * @param user who should be contacted * @param notificationSubject that is used to provide further information (e.g. exercise, attachment, post, etc.) */ - @Override public void sendNotification(Notification notification, User user, Object notificationSubject) { NotificationType notificationType = NotificationConstants.findCorrespondingNotificationType(notification.getTitle()); diff --git a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/activation_mail/ActivationMailRecipientDTO.java b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/activation_mail/ActivationMailRecipientDTO.java index 179ff1a95804..682c6e333d12 100644 --- a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/activation_mail/ActivationMailRecipientDTO.java +++ b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/activation_mail/ActivationMailRecipientDTO.java @@ -3,6 +3,9 @@ import de.tum.cit.aet.artemis.communication.service.notifications.mails.dto.IMailRecipientUserDTO; import de.tum.cit.aet.artemis.core.domain.User; +/** + * DTO for the recipient of the activation mail + */ public record ActivationMailRecipientDTO(String langKey, String email, String login, String activationKey) implements IMailRecipientUserDTO { public static ActivationMailRecipientDTO of(User user) { diff --git a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_failed_mail/DataExportFailedContentDTO.java b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_failed_mail/DataExportFailedContentDTO.java index e67b1d297c22..c5708714195f 100644 --- a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_failed_mail/DataExportFailedContentDTO.java +++ b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_failed_mail/DataExportFailedContentDTO.java @@ -2,6 +2,12 @@ import de.tum.cit.aet.artemis.core.domain.DataExport; +/** + * DTO for the content of a data export failed mail + * + * @param reason The reason why the data export failed + * @param exportUsername The username of the user who initiated the data export + */ public record DataExportFailedContentDTO(String reason, String exportUsername) { public static DataExportFailedContentDTO of(Exception exception, DataExport dataExport) { diff --git a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_failed_mail/DataExportFailedMailAdminRecipientDTO.java b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_failed_mail/DataExportFailedMailAdminRecipientDTO.java index 2ee29a7cafcb..4bbab58637a7 100644 --- a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_failed_mail/DataExportFailedMailAdminRecipientDTO.java +++ b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_failed_mail/DataExportFailedMailAdminRecipientDTO.java @@ -3,6 +3,9 @@ import de.tum.cit.aet.artemis.communication.service.notifications.mails.dto.IMailRecipientUserDTO; import de.tum.cit.aet.artemis.core.domain.User; +/** + * DTO for the recipient of the data export failed mail for the admin + */ public record DataExportFailedMailAdminRecipientDTO(String langKey, String email, String login) implements IMailRecipientUserDTO { public static DataExportFailedMailAdminRecipientDTO of(User user) { diff --git a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_successful_mail/DataExportSuccessfulContentDTO.java b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_successful_mail/DataExportSuccessfulContentDTO.java index 9bec98af2b47..6d6179b7411f 100644 --- a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_successful_mail/DataExportSuccessfulContentDTO.java +++ b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_successful_mail/DataExportSuccessfulContentDTO.java @@ -2,6 +2,11 @@ import de.tum.cit.aet.artemis.core.domain.DataExport; +/** + * DTO for the content of a data export successful mail. + * + * @param userLogin the login of the user who requested the data export + */ public record DataExportSuccessfulContentDTO(String userLogin) { public static DataExportSuccessfulContentDTO of(DataExport dataExport) { diff --git a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_successful_mail/DataExportSuccessfulContentsDTO.java b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_successful_mail/DataExportSuccessfulContentsDTO.java index a771831650a8..548ec0800081 100644 --- a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_successful_mail/DataExportSuccessfulContentsDTO.java +++ b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_successful_mail/DataExportSuccessfulContentsDTO.java @@ -5,6 +5,9 @@ import de.tum.cit.aet.artemis.core.domain.DataExport; +/** + * DTO for the contents of a data export successful mail notification. + */ public record DataExportSuccessfulContentsDTO(Set contents) { public static DataExportSuccessfulContentsDTO of(Set exportSet) { diff --git a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_successful_mail/DataExportSuccessfulMailAdminRecipientDTO.java b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_successful_mail/DataExportSuccessfulMailAdminRecipientDTO.java index 7bbaf48458c9..4388ab51549c 100644 --- a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_successful_mail/DataExportSuccessfulMailAdminRecipientDTO.java +++ b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/data_export_successful_mail/DataExportSuccessfulMailAdminRecipientDTO.java @@ -3,6 +3,9 @@ import de.tum.cit.aet.artemis.communication.service.notifications.mails.dto.IMailRecipientUserDTO; import de.tum.cit.aet.artemis.core.domain.User; +/** + * DTO for the admin recipient of the data export successful mail notification. + */ public record DataExportSuccessfulMailAdminRecipientDTO(String langKey, String email) implements IMailRecipientUserDTO { public static DataExportSuccessfulMailAdminRecipientDTO of(User user) { diff --git a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/notifications/NotificationMailRecipientDTO.java b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/notifications/NotificationMailRecipientDTO.java index 156ad8a357d2..3b5ad58713e4 100644 --- a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/notifications/NotificationMailRecipientDTO.java +++ b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/notifications/NotificationMailRecipientDTO.java @@ -3,6 +3,9 @@ import de.tum.cit.aet.artemis.communication.service.notifications.mails.dto.IMailRecipientUserDTO; import de.tum.cit.aet.artemis.core.domain.User; +/** + * DTO for the recipient of a notification mail. + */ public record NotificationMailRecipientDTO(String langKey, String email, String name, String login) implements IMailRecipientUserDTO { public static NotificationMailRecipientDTO of(User user) { diff --git a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/password_reset_mail/PasswordResetRecipientDTO.java b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/password_reset_mail/PasswordResetRecipientDTO.java index 47199a4a546c..1a8f1c3d3124 100644 --- a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/password_reset_mail/PasswordResetRecipientDTO.java +++ b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/password_reset_mail/PasswordResetRecipientDTO.java @@ -3,6 +3,9 @@ import de.tum.cit.aet.artemis.communication.service.notifications.mails.dto.IMailRecipientUserDTO; import de.tum.cit.aet.artemis.core.domain.User; +/** + * DTO for the password reset mail recipient + */ public record PasswordResetRecipientDTO(String langKey, String email, String login, String resetKey) implements IMailRecipientUserDTO { public static PasswordResetRecipientDTO of(User user) { diff --git a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/saml2_set_password_mail/SAML2SetPasswordMailRecipientDTO.java b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/saml2_set_password_mail/SAML2SetPasswordMailRecipientDTO.java index 1ce422464bf8..142305daec62 100644 --- a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/saml2_set_password_mail/SAML2SetPasswordMailRecipientDTO.java +++ b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/saml2_set_password_mail/SAML2SetPasswordMailRecipientDTO.java @@ -3,6 +3,9 @@ import de.tum.cit.aet.artemis.communication.service.notifications.mails.dto.IMailRecipientUserDTO; import de.tum.cit.aet.artemis.core.domain.User; +/** + * DTO for the recipient of the SAML2SetPasswordMail + */ public record SAML2SetPasswordMailRecipientDTO(String langKey, String email, String login, String resetKey) implements IMailRecipientUserDTO { public static SAML2SetPasswordMailRecipientDTO of(User user) { diff --git a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/weekly_summary_mail/WeeklyExerciseSummaryDTO.java b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/weekly_summary_mail/WeeklyExerciseSummaryDTO.java index 90bdf4627fdc..bcd16d024668 100644 --- a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/weekly_summary_mail/WeeklyExerciseSummaryDTO.java +++ b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/weekly_summary_mail/WeeklyExerciseSummaryDTO.java @@ -3,6 +3,17 @@ import de.tum.cit.aet.artemis.core.service.TimeService; import de.tum.cit.aet.artemis.exercise.domain.Exercise; +/** + * A Data Transfer Object (DTO) representing a summary of an exercise for the weekly summary email. + * + * @param title the title of the exercise + * @param type the type of the exercise + * @param difficulty the difficulty level of the exercise + * @param releaseDate the release date of the exercise in a human-readable format + * @param dueDate the due date of the exercise in a human-readable format + * @param maxPoints the maximum points that can be earned for the exercise + * @param bonusPoints the bonus points that can be earned for the exercise + */ public record WeeklyExerciseSummaryDTO(String title, String type, String difficulty, String releaseDate, String dueDate, double maxPoints, double bonusPoints) { public static WeeklyExerciseSummaryDTO of(Exercise exercise, TimeService timeService) { diff --git a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/weekly_summary_mail/WeeklySummaryMailContentDTO.java b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/weekly_summary_mail/WeeklySummaryMailContentDTO.java index 5f4365d16aee..d0579c601a49 100644 --- a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/weekly_summary_mail/WeeklySummaryMailContentDTO.java +++ b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/weekly_summary_mail/WeeklySummaryMailContentDTO.java @@ -6,8 +6,21 @@ import de.tum.cit.aet.artemis.core.service.TimeService; import de.tum.cit.aet.artemis.exercise.domain.Exercise; +/** + * A Data Transfer Object (DTO) representing the content of a weekly summary email. + * + * @param hasNewExercises indicates if there are new exercises in the summary + * @param exerciseSummaries a set of summaries for each exercise included in the weekly summary + */ public record WeeklySummaryMailContentDTO(boolean hasNewExercises, Set exerciseSummaries) { + /** + * Creates a new instance of WeeklySummaryMailContentDTO from a set of exercises. + * + * @param exercises the set of exercises to be included in the summary + * @param timeService the service used to convert dates to a human-readable format + * @return a new instance of WeeklySummaryMailContentDTO + */ public static WeeklySummaryMailContentDTO of(Set exercises, TimeService timeService) { boolean hasNewExercises = !exercises.isEmpty(); Set exerciseSummaries = exercises.stream().map(exercise -> WeeklyExerciseSummaryDTO.of(exercise, timeService)).collect(Collectors.toSet()); diff --git a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/weekly_summary_mail/WeeklySummaryMailRecipientDTO.java b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/weekly_summary_mail/WeeklySummaryMailRecipientDTO.java index 5bc6c2a18550..783eaeecee38 100644 --- a/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/weekly_summary_mail/WeeklySummaryMailRecipientDTO.java +++ b/src/main/java/de/tum/cit/aet/artemis/communication/service/notifications/mails/dto/weekly_summary_mail/WeeklySummaryMailRecipientDTO.java @@ -3,6 +3,9 @@ import de.tum.cit.aet.artemis.communication.service.notifications.mails.dto.IMailRecipientUserDTO; import de.tum.cit.aet.artemis.core.domain.User; +/** + * DTO for the weekly summary mail recipient. + */ public record WeeklySummaryMailRecipientDTO(String langKey, String email, String name) implements IMailRecipientUserDTO { public static WeeklySummaryMailRecipientDTO of(User user) { diff --git a/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/ActivationMailTest.java b/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/ActivationMailTest.java index b4dfe2c65e5b..b8bf8b39de18 100644 --- a/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/ActivationMailTest.java +++ b/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/ActivationMailTest.java @@ -8,6 +8,9 @@ class ActivationMailTest extends AbstractMailContentTest { + /** + * Test that the variables injected in the template are used in the generated HTML content. + */ @Test void testThatVariablesAreInjectedIntoTheTemplate() { // Arrange: diff --git a/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/DataExportFailedMailTest.java b/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/DataExportFailedMailTest.java index c5826bec402a..8b80b5301cda 100644 --- a/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/DataExportFailedMailTest.java +++ b/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/DataExportFailedMailTest.java @@ -9,6 +9,9 @@ class DataExportFailedMailTest extends AbstractMailContentTest { + /** + * Test that the variables injected in the template are used in the generated HTML content. + */ @Test void testThatVariablesAreInjectedIntoTheTemplate() { // Arrange: diff --git a/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/DataExportSuccessfulMailTest.java b/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/DataExportSuccessfulMailTest.java index 3776addca809..4a1e66a8b5f1 100644 --- a/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/DataExportSuccessfulMailTest.java +++ b/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/DataExportSuccessfulMailTest.java @@ -11,6 +11,9 @@ class DataExportSuccessfulMailTest extends AbstractMailContentTest { + /** + * Test that the variables injected in the template are used in the generated HTML content. + */ @Test void testThatVariablesAreInjectedIntoTheTemplate() { // Arrange: diff --git a/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/PasswordResetMailTest.java b/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/PasswordResetMailTest.java index b441153b1adf..4b65a90ee9aa 100644 --- a/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/PasswordResetMailTest.java +++ b/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/PasswordResetMailTest.java @@ -8,6 +8,9 @@ class PasswordResetMailTest extends AbstractMailContentTest { + /** + * Test that the variables injected in the template are used in the generated HTML content. + */ @Test void testThatVariablesAreInjectedIntoTheTemplate() { // Arrange: diff --git a/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/SAML2SetPasswordMailTest.java b/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/SAML2SetPasswordMailTest.java index cdb6eaacd6af..7b9ec3d97ecb 100644 --- a/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/SAML2SetPasswordMailTest.java +++ b/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/SAML2SetPasswordMailTest.java @@ -8,6 +8,9 @@ class SAML2SetPasswordMailTest extends AbstractMailContentTest { + /** + * Test that the variables injected in the template are used in the generated HTML content. + */ @Test void testThatVariablesAreInjectedIntoTheTemplate() { // Arrange: diff --git a/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/WeeklySummaryMailTest.java b/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/WeeklySummaryMailTest.java index 60fb5b75d66d..537fc7ab71a3 100644 --- a/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/WeeklySummaryMailTest.java +++ b/src/test/java/de/tum/cit/aet/artemis/communication/notifications/service/mail/WeeklySummaryMailTest.java @@ -15,6 +15,9 @@ class WeeklySummaryMailTest extends AbstractMailContentTest { + /** + * Test that the variables injected in the template are used in the generated HTML content. + */ @Test void testThatVariablesAreInjectedIntoTheTemplate() { // Arrange: