Class TaskMapper

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

public class TaskMapper extends Object
Maps Task domain objects to TaskDto objects for use in the presentation layer. Provides methods for mapping individual tasks and collections of tasks. Uses batch loading for related entities when mapping multiple tasks.
  • Constructor Details

    • TaskMapper

      public TaskMapper()
  • Method Details

    • mapTask

      public static TaskDto mapTask(Task task)
      Maps a single Task to its DTO representation. Fetches the creator's profile information and initializes assignments as empty.
      Parameters:
      task - The task domain object to be mapped
      Returns:
      The mapped TaskDto with creator information
    • mapTasks

      public static List<TaskDto> mapTasks(List<Task> tasks)
      Maps a list of Tasks to their DTO representations with optimized data loading. Prefetches all creator profiles in a single batch operation to avoid multiple database queries. Initializes assignment lists as empty for each task.
      Parameters:
      tasks - The list of task domain objects to be mapped
      Returns:
      A list of mapped TaskDto objects with creator information