Skip to content

Commit

Permalink
Development: Add missing javadocs to dto classes
Browse files Browse the repository at this point in the history
  • Loading branch information
xHadie committed Nov 26, 2024
1 parent e58d9fe commit bdad5c3
Show file tree
Hide file tree
Showing 19 changed files with 77 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ public void sendNotification(Notification notification, Set<User> 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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<DataExportSuccessfulContentDTO> contents) {

public static DataExportSuccessfulContentsDTO of(Set<DataExport> exportSet) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<WeeklyExerciseSummaryDTO> 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<Exercise> exercises, TimeService timeService) {
boolean hasNewExercises = !exercises.isEmpty();
Set<WeeklyExerciseSummaryDTO> exerciseSummaries = exercises.stream().map(exercise -> WeeklyExerciseSummaryDTO.of(exercise, timeService)).collect(Collectors.toSet());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit bdad5c3

Please sign in to comment.