From ebb91a601038711253bb6abd29b4eee45585186f Mon Sep 17 00:00:00 2001 From: ronsei Date: Mon, 4 Oct 2021 12:10:42 +0200 Subject: [PATCH] Refactoring RetrieveTaskFromTaskListCommand to *Query --- .../adapter/in/web/RetrieveTaskFromTaskListWebController.java | 4 ++-- ...askListCommand.java => RetrieveTaskFromTaskListQuery.java} | 4 ++-- .../application/port/in/RetrieveTaskFromTaskListUseCase.java | 2 +- .../application/service/RetrieveTaskFromTaskListService.java | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) rename tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/port/in/{RetrieveTaskFromTaskListCommand.java => RetrieveTaskFromTaskListQuery.java} (68%) diff --git a/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/adapter/in/web/RetrieveTaskFromTaskListWebController.java b/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/adapter/in/web/RetrieveTaskFromTaskListWebController.java index 0035986..0eb6bea 100644 --- a/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/adapter/in/web/RetrieveTaskFromTaskListWebController.java +++ b/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/adapter/in/web/RetrieveTaskFromTaskListWebController.java @@ -1,6 +1,6 @@ package ch.unisg.tapastasks.tasks.adapter.in.web; -import ch.unisg.tapastasks.tasks.application.port.in.RetrieveTaskFromTaskListCommand; +import ch.unisg.tapastasks.tasks.application.port.in.RetrieveTaskFromTaskListQuery; import ch.unisg.tapastasks.tasks.application.port.in.RetrieveTaskFromTaskListUseCase; import ch.unisg.tapastasks.tasks.domain.Task; import org.springframework.http.HttpHeaders; @@ -21,7 +21,7 @@ public class RetrieveTaskFromTaskListWebController { @GetMapping(path = "/tasks/{taskId}") public ResponseEntity retrieveTaskFromTaskList(@PathVariable("taskId") String taskId) { - RetrieveTaskFromTaskListCommand command = new RetrieveTaskFromTaskListCommand(new Task.TaskId(taskId)); + RetrieveTaskFromTaskListQuery command = new RetrieveTaskFromTaskListQuery(new Task.TaskId(taskId)); Optional updatedTaskOpt = retrieveTaskFromTaskListUseCase.retrieveTaskFromTaskList(command); // Check if the task with the given identifier exists diff --git a/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/port/in/RetrieveTaskFromTaskListCommand.java b/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/port/in/RetrieveTaskFromTaskListQuery.java similarity index 68% rename from tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/port/in/RetrieveTaskFromTaskListCommand.java rename to tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/port/in/RetrieveTaskFromTaskListQuery.java index 0796cb0..eda059a 100644 --- a/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/port/in/RetrieveTaskFromTaskListCommand.java +++ b/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/port/in/RetrieveTaskFromTaskListQuery.java @@ -7,11 +7,11 @@ import lombok.Value; import javax.validation.constraints.NotNull; @Value -public class RetrieveTaskFromTaskListCommand extends SelfValidating { +public class RetrieveTaskFromTaskListQuery extends SelfValidating { @NotNull private final TaskId taskId; - public RetrieveTaskFromTaskListCommand(TaskId taskId) { + public RetrieveTaskFromTaskListQuery(TaskId taskId) { this.taskId = taskId; this.validateSelf(); } diff --git a/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/port/in/RetrieveTaskFromTaskListUseCase.java b/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/port/in/RetrieveTaskFromTaskListUseCase.java index 74479f3..40afc1d 100644 --- a/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/port/in/RetrieveTaskFromTaskListUseCase.java +++ b/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/port/in/RetrieveTaskFromTaskListUseCase.java @@ -5,5 +5,5 @@ import ch.unisg.tapastasks.tasks.domain.Task; import java.util.Optional; public interface RetrieveTaskFromTaskListUseCase { - Optional retrieveTaskFromTaskList(RetrieveTaskFromTaskListCommand command); + Optional retrieveTaskFromTaskList(RetrieveTaskFromTaskListQuery command); } diff --git a/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/service/RetrieveTaskFromTaskListService.java b/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/service/RetrieveTaskFromTaskListService.java index b256273..46043b0 100644 --- a/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/service/RetrieveTaskFromTaskListService.java +++ b/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/service/RetrieveTaskFromTaskListService.java @@ -1,6 +1,6 @@ package ch.unisg.tapastasks.tasks.application.service; -import ch.unisg.tapastasks.tasks.application.port.in.RetrieveTaskFromTaskListCommand; +import ch.unisg.tapastasks.tasks.application.port.in.RetrieveTaskFromTaskListQuery; import ch.unisg.tapastasks.tasks.application.port.in.RetrieveTaskFromTaskListUseCase; import ch.unisg.tapastasks.tasks.domain.Task; import ch.unisg.tapastasks.tasks.domain.TaskList; @@ -15,7 +15,7 @@ import java.util.Optional; @Transactional public class RetrieveTaskFromTaskListService implements RetrieveTaskFromTaskListUseCase { @Override - public Optional retrieveTaskFromTaskList(RetrieveTaskFromTaskListCommand command) { + public Optional retrieveTaskFromTaskList(RetrieveTaskFromTaskListQuery command) { TaskList taskList = TaskList.getTapasTaskList(); return taskList.retrieveTaskById(command.getTaskId()); }