Class TaskAssigmentMapper

java.lang.Object
no.ntnu.principes.mapper.TaskAssigmentMapper

public class TaskAssigmentMapper extends Object
Maps TaskAssignment domain objects to TaskAssignmentDto objects. Provides optimized mapping for both single assignments and collections. Uses batch loading for related entities when mapping multiple assignments.
  • Constructor Details

    • TaskAssigmentMapper

      public TaskAssigmentMapper()
  • Method Details

    • mapAssignment

      public static TaskAssignmentDto mapAssignment(TaskAssignment assignment)
      Maps a single TaskAssignment to its DTO representation. Fetches related task and member information to complete the mapping.
      Parameters:
      assignment - The task assignment to be mapped
      Returns:
      The mapped DTO, or null if the related task cannot be found
    • mapAssignments

      public static List<TaskAssignmentDto> mapAssignments(List<TaskAssignment> assignments)
      Maps a list of TaskAssignments to their DTO representations with optimized data loading. Prefetches all related members and tasks in two batch operations to avoid N+1 query issues.
      Parameters:
      assignments - The list of task assignments to be mapped
      Returns:
      A list of mapped DTOs with complete task and member information