Class BaseTaskControllerWithoutRequestMapping<E extends Task,D,A>

java.lang.Object
at.jku.dke.etutor.task_app.controllers.BaseTaskControllerWithoutRequestMapping<E,D,A>
Type Parameters:
E - The type of the task entity.
D - The type of the task DTO.
A - The type of the additional data in ModifyTaskDto.
All Implemented Interfaces:
TaskController<D,A>
Direct Known Subclasses:
BaseTaskController

public abstract class BaseTaskControllerWithoutRequestMapping<E extends Task,D,A> extends Object implements TaskController<D,A>
Base implementation of TaskController.

Add @RestController and @RequestMapping("/api/task/[subpath]") to the extending class. If your task app only supports one task type, you can use BaseTaskController instead.

  • Field Details

    • taskService

      protected final TaskService<E extends Task,A> taskService
      The task group service.
  • Constructor Details

  • Method Details

    • get

      public ResponseEntity<D> get(long id)
      Returns the task type specific data.
      Specified by:
      get in interface TaskController<E extends Task,D>
      Parameters:
      id - The identifier of the requested task.
      Returns:
      The task details or an error response.
    • create

      public ResponseEntity<TaskModificationResponseDto> create(long id, ModifyTaskDto<A> dto)
      Creates a new task.
      Specified by:
      create in interface TaskController<E extends Task,D>
      Parameters:
      id - The identifier of the task (generated by task administration app).
      dto - The task data.
      Returns:
      The task-specific task data or an error response.
    • update

      public ResponseEntity<TaskModificationResponseDto> update(long id, ModifyTaskDto<A> dto)
      Updates the task data.
      Specified by:
      update in interface TaskController<E extends Task,D>
      Parameters:
      id - The identifier of the task.
      dto - The new task data.
      Returns:
      The task-specific task data or an error response.
    • delete

      public ResponseEntity<Void> delete(long id)
      Deletes the task.
      Specified by:
      delete in interface TaskController<E extends Task,D>
      Parameters:
      id - The identifier of the task.
      Returns:
      No content or an error response.
    • mapToDto

      protected abstract D mapToDto(E entity)
      Maps the given task group to a DTO.
      Parameters:
      entity - The task group entity.
      Returns:
      The DTO.
    • createDetailsUri

      protected abstract URI createDetailsUri(long id)
      Creates the URI for the details of the task with the given ID.
      Parameters:
      id - The ID of the task.
      Returns:
      The URI where the details of the task can be found.