Skip to content

Commit

Permalink
CCMSPUI-530 Completed JavaDocs
Browse files Browse the repository at this point in the history
Signed-off-by: Jamie Briggs <jamie.briggs@digital.justice.gov.uk>
  • Loading branch information
Jamie Briggs committed Feb 6, 2025
1 parent 018abbc commit b92a21a
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public ResponseEntity<Notification> getNotification(Long notificationId) {
* @param dateTo the ending date to filter notifications by a specific date range
* @param pageable the pagination and sorting information for the result set
* @return a {@code ResponseEntity} containing the retrieved list of notifications if found, or a
* {@code ResponseEntity} with HTTP status 404 if no notifications are found
* {@code ResponseEntity} with HTTP status 404 if no notifications are found
*/
@Override
public ResponseEntity<Notifications> getNotifications(Long providerId,
Expand All @@ -86,7 +86,7 @@ public ResponseEntity<Notifications> getNotifications(Long providerId,
*
* @param loginId the login ID of the user for whom the notification summary is to be retrieved
* @return a {@code ResponseEntity} containing the {@code NotificationSummary} if found, or a
* {@code ResponseEntity} with HTTP status 404 if no summary is available
* {@code ResponseEntity} with HTTP status 404 if no summary is available
*/
@Override
public ResponseEntity<NotificationSummary> getUserNotificationSummary(String loginId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,33 @@
import uk.gov.laa.ccms.data.entity.NotificationDocument;
import uk.gov.laa.ccms.data.model.Document;

/**
* Interface responsible for mapping objects to {@link Document} objects. This interface
* utilizes Mapstruct for mapping properties.
*
* @see Document
* @see NotificationDocument
* @see NotificationAttachment
*
* @author Jamie Briggs
*/
@Mapper(componentModel = "spring")
public interface DocumentMapper {

/**
* Maps a {@link NotificationDocument} to a {@link Document} object. Some fields have been
* set to an empty string due to not existing in {@link NotificationDocument} such as:
* <ul>
* <li>documentLink</li>
* <li>fileData</li>
* <li>statusDescription</li>
* <li>fileExtension</li>
* <li>title</li>
* </ul>
*
* @param notificationDocument the source {@link NotificationDocument} object to be mapped.
* @return a {@link Document} object containing the mapped document.
*/
@Mapping(target = "text", source = "documentDescription")
@Mapping(target = "channel", source = "documentChannel")
@Mapping(target = "status", source = "documentStatus")
Expand All @@ -19,6 +43,22 @@ public interface DocumentMapper {
@Mapping(target = "title", constant = "")
Document mapToNotification(NotificationDocument notificationDocument);

/**
* Maps a {@link NotificationAttachment} to a {@link Document}. Some fields have been set to an
* empty string due to not existing in {@link NotificationDocument} such as:
* <ul>
* <li>documentLink</li>
* <li>fileData</li>
* <li>statusDescription</li>
* <li>fileExtension</li>
* <li>title</li>
* <li>status</li>
* <li>documentType</li>
* </ul>
*
* @param notificationAttachment the source {@link NotificationAttachment} object to be mapped.
* @return a {@link Document} object containing the mapped document.
*/
@Mapping(target = "channel", constant = "")
@Mapping(target = "documentLink", constant = "")
@Mapping(target = "fileData", constant = "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,24 @@
import uk.gov.laa.ccms.data.entity.NotificationNote;
import uk.gov.laa.ccms.data.model.Note;

/**
* Interface responsible for mapping objects to {@link Note} objects. This interface
* utilizes MapStruct for mapping properties.
*
* @see Note
* @see NotificationNote
*
* @author Jamie Briggs
*/
@Mapper(componentModel = "spring")
public interface NoteMapper {

/**
* Maps a {@link NotificationNote} to a {@link Note} object.
*
* @param notificationNote the source {@link NotificationNote} object.
* @return a {@link Note} object containing the mapped note.
*/
@Mapping(target = "user.username", source = "noteBy")
@Mapping(target = "notesId", source = "noteId")
@Mapping(target = "message", source = "noteText")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,29 @@
import uk.gov.laa.ccms.data.entity.NotificationInfo;
import uk.gov.laa.ccms.data.model.Notification;

/**
* Interface responsible for mapping objects to {@link Notification} objects. This interface
* utilizes MapStruct for mapping properties. Also utilizes {@link NoteMapper} for mapping
* notes, and {@link DocumentMapper} for mapping documents and attachments.
*
* @see Notification
* @see NotificationInfo
* @see NoteMapper
* @see DocumentMapper
*
* @author Jamie Briggs
*/
@Mapper(componentModel = "spring",
uses = {NoteMapper.class, DocumentMapper.class}, injectionStrategy = InjectionStrategy.CONSTRUCTOR)
uses = {NoteMapper.class, DocumentMapper.class},
injectionStrategy = InjectionStrategy.CONSTRUCTOR)
public interface NotificationMapper {

/**
* Maps a {@link NotificationInfo} to a {@link Notification} object.
*
* @param notification the source {@link NotificationInfo} object.
* @return a {@link Notification} object containing the mapped notification.
*/
@Mapping(target = "user.loginId", source = "userLoginId")
@Mapping(target = "user.username", source = "assignedTo")
@Mapping(target = "assignDate", source = "dateAssigned")
Expand All @@ -25,6 +44,14 @@ public interface NotificationMapper {
@Mapping(target = "availableResponses", source = "actions", qualifiedByName = "action")
Notification mapToNotification(NotificationInfo notification);

/**
* Converts a {@link NotificationAction} object to its corresponding action
* description as a string.
*
* @param action the {@link NotificationAction} object to be converted.
* @return a string representing the action description from
* the {@link NotificationAction} object.
*/
@Named("action")
public static String actionToString(NotificationAction action) {
return action.getNextAction();
Expand Down

0 comments on commit b92a21a

Please sign in to comment.