diff --git a/executor-pool/src/main/java/ch/unisg/executorpool/adapter/in/web/GetAllExecutorInExecutorPoolByTypeWebController.java b/executor-pool/src/main/java/ch/unisg/executorpool/adapter/in/web/GetAllExecutorsInExecutorPoolByTypeWebController.java similarity index 50% rename from executor-pool/src/main/java/ch/unisg/executorpool/adapter/in/web/GetAllExecutorInExecutorPoolByTypeWebController.java rename to executor-pool/src/main/java/ch/unisg/executorpool/adapter/in/web/GetAllExecutorsInExecutorPoolByTypeWebController.java index 2595781..dbea300 100644 --- a/executor-pool/src/main/java/ch/unisg/executorpool/adapter/in/web/GetAllExecutorInExecutorPoolByTypeWebController.java +++ b/executor-pool/src/main/java/ch/unisg/executorpool/adapter/in/web/GetAllExecutorsInExecutorPoolByTypeWebController.java @@ -1,7 +1,7 @@ package ch.unisg.executorpool.adapter.in.web; -import ch.unisg.executorpool.application.port.in.GetAllExecutorInExecutorPoolByTypeQuery; -import ch.unisg.executorpool.application.port.in.GetAllExecutorInExecutorPoolByTypeUseCase; +import ch.unisg.executorpool.application.port.in.GetAllExecutorsInExecutorPoolByTypeQuery; +import ch.unisg.executorpool.application.port.in.GetAllExecutorsInExecutorPoolByTypeUseCase; import ch.unisg.executorpool.domain.ExecutorClass; import ch.unisg.executorpool.domain.ExecutorClass.ExecutorTaskType; import org.springframework.http.HttpHeaders; @@ -14,17 +14,17 @@ import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController -public class GetAllExecutorInExecutorPoolByTypeWebController { - private final GetAllExecutorInExecutorPoolByTypeUseCase getAllExecutorInExecutorPoolByTypeUseCase; +public class GetAllExecutorsInExecutorPoolByTypeWebController { + private final GetAllExecutorsInExecutorPoolByTypeUseCase getAllExecutorsInExecutorPoolByTypeUseCase; - public GetAllExecutorInExecutorPoolByTypeWebController(GetAllExecutorInExecutorPoolByTypeUseCase getAllExecutorInExecutorPoolByTypeUseCase){ - this.getAllExecutorInExecutorPoolByTypeUseCase = getAllExecutorInExecutorPoolByTypeUseCase; + public GetAllExecutorsInExecutorPoolByTypeWebController(GetAllExecutorsInExecutorPoolByTypeUseCase getAllExecutorInExecutorPoolByTypeUseCase){ + this.getAllExecutorsInExecutorPoolByTypeUseCase = getAllExecutorInExecutorPoolByTypeUseCase; } - @GetMapping(path = "/executor-pool/GetAllExecutorInExecutorPoolByType/{taskType}") + @GetMapping(path = "/executor-pool/GetAllExecutorsInExecutorPoolByType/{taskType}") public ResponseEntity getAllExecutorInExecutorPoolByType(@PathVariable("taskType") String taskType){ - GetAllExecutorInExecutorPoolByTypeQuery query = new GetAllExecutorInExecutorPoolByTypeQuery(new ExecutorTaskType(taskType)); - List matchedExecutors = getAllExecutorInExecutorPoolByTypeUseCase.getAllExecutorInExecutorPoolByType(query); + GetAllExecutorsInExecutorPoolByTypeQuery query = new GetAllExecutorsInExecutorPoolByTypeQuery(new ExecutorTaskType(taskType)); + List matchedExecutors = getAllExecutorsInExecutorPoolByTypeUseCase.getAllExecutorsInExecutorPoolByType(query); // Add the content type as a response header HttpHeaders responseHeaders = new HttpHeaders(); diff --git a/executor-pool/src/main/java/ch/unisg/executorpool/application/port/in/GetAllExecutorInExecutorPoolByTypeUseCase.java b/executor-pool/src/main/java/ch/unisg/executorpool/application/port/in/GetAllExecutorInExecutorPoolByTypeUseCase.java deleted file mode 100644 index 9f612bf..0000000 --- a/executor-pool/src/main/java/ch/unisg/executorpool/application/port/in/GetAllExecutorInExecutorPoolByTypeUseCase.java +++ /dev/null @@ -1,9 +0,0 @@ -package ch.unisg.executorpool.application.port.in; - -import ch.unisg.executorpool.domain.ExecutorClass; - -import java.util.List; - -public interface GetAllExecutorInExecutorPoolByTypeUseCase { - List getAllExecutorInExecutorPoolByType(GetAllExecutorInExecutorPoolByTypeQuery query); -} diff --git a/executor-pool/src/main/java/ch/unisg/executorpool/application/port/in/GetAllExecutorInExecutorPoolByTypeQuery.java b/executor-pool/src/main/java/ch/unisg/executorpool/application/port/in/GetAllExecutorsInExecutorPoolByTypeQuery.java similarity index 64% rename from executor-pool/src/main/java/ch/unisg/executorpool/application/port/in/GetAllExecutorInExecutorPoolByTypeQuery.java rename to executor-pool/src/main/java/ch/unisg/executorpool/application/port/in/GetAllExecutorsInExecutorPoolByTypeQuery.java index c812eab..079e7e1 100644 --- a/executor-pool/src/main/java/ch/unisg/executorpool/application/port/in/GetAllExecutorInExecutorPoolByTypeQuery.java +++ b/executor-pool/src/main/java/ch/unisg/executorpool/application/port/in/GetAllExecutorsInExecutorPoolByTypeQuery.java @@ -7,11 +7,11 @@ import lombok.Value; import javax.validation.constraints.NotNull; @Value -public class GetAllExecutorInExecutorPoolByTypeQuery extends SelfValidating { +public class GetAllExecutorsInExecutorPoolByTypeQuery extends SelfValidating { @NotNull private final ExecutorTaskType executorTaskType; - public GetAllExecutorInExecutorPoolByTypeQuery(ExecutorTaskType executorTaskType){ + public GetAllExecutorsInExecutorPoolByTypeQuery(ExecutorTaskType executorTaskType){ this.executorTaskType = executorTaskType; this.validateSelf(); } diff --git a/executor-pool/src/main/java/ch/unisg/executorpool/application/port/in/GetAllExecutorsInExecutorPoolByTypeUseCase.java b/executor-pool/src/main/java/ch/unisg/executorpool/application/port/in/GetAllExecutorsInExecutorPoolByTypeUseCase.java new file mode 100644 index 0000000..4821284 --- /dev/null +++ b/executor-pool/src/main/java/ch/unisg/executorpool/application/port/in/GetAllExecutorsInExecutorPoolByTypeUseCase.java @@ -0,0 +1,9 @@ +package ch.unisg.executorpool.application.port.in; + +import ch.unisg.executorpool.domain.ExecutorClass; + +import java.util.List; + +public interface GetAllExecutorsInExecutorPoolByTypeUseCase { + List getAllExecutorsInExecutorPoolByType(GetAllExecutorsInExecutorPoolByTypeQuery query); +} diff --git a/executor-pool/src/main/java/ch/unisg/executorpool/application/service/GetAllExecutorInExecutorPoolByTypeService.java b/executor-pool/src/main/java/ch/unisg/executorpool/application/service/GetAllExecutorsInExecutorPoolByTypeService.java similarity index 56% rename from executor-pool/src/main/java/ch/unisg/executorpool/application/service/GetAllExecutorInExecutorPoolByTypeService.java rename to executor-pool/src/main/java/ch/unisg/executorpool/application/service/GetAllExecutorsInExecutorPoolByTypeService.java index 74988b2..00d1636 100644 --- a/executor-pool/src/main/java/ch/unisg/executorpool/application/service/GetAllExecutorInExecutorPoolByTypeService.java +++ b/executor-pool/src/main/java/ch/unisg/executorpool/application/service/GetAllExecutorsInExecutorPoolByTypeService.java @@ -1,7 +1,7 @@ package ch.unisg.executorpool.application.service; -import ch.unisg.executorpool.application.port.in.GetAllExecutorInExecutorPoolByTypeQuery; -import ch.unisg.executorpool.application.port.in.GetAllExecutorInExecutorPoolByTypeUseCase; +import ch.unisg.executorpool.application.port.in.GetAllExecutorsInExecutorPoolByTypeQuery; +import ch.unisg.executorpool.application.port.in.GetAllExecutorsInExecutorPoolByTypeUseCase; import ch.unisg.executorpool.domain.ExecutorClass; import ch.unisg.executorpool.domain.ExecutorPool; import lombok.RequiredArgsConstructor; @@ -13,10 +13,10 @@ import java.util.List; @RequiredArgsConstructor @Component @Transactional -public class GetAllExecutorInExecutorPoolByTypeService implements GetAllExecutorInExecutorPoolByTypeUseCase { +public class GetAllExecutorsInExecutorPoolByTypeService implements GetAllExecutorsInExecutorPoolByTypeUseCase { @Override - public List getAllExecutorInExecutorPoolByType(GetAllExecutorInExecutorPoolByTypeQuery query){ + public List getAllExecutorsInExecutorPoolByType(GetAllExecutorsInExecutorPoolByTypeQuery query){ ExecutorPool executorPool = ExecutorPool.getExecutorPool(); return executorPool.getAllExecutorsByType(query.getExecutorTaskType()); } diff --git a/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/service/DeleteTaskService.java b/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/service/DeleteTaskService.java index f865f4c..35685a3 100644 --- a/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/service/DeleteTaskService.java +++ b/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/service/DeleteTaskService.java @@ -5,6 +5,7 @@ import ch.unisg.tapastasks.tasks.application.port.in.DeleteTaskCommand; import ch.unisg.tapastasks.tasks.application.port.in.DeleteTaskUseCase; import ch.unisg.tapastasks.tasks.domain.Task; import ch.unisg.tapastasks.tasks.domain.TaskList; +import jdk.jshell.spi.ExecutionControl; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @@ -23,11 +24,10 @@ public class DeleteTaskService implements DeleteTaskUseCase { Optional updatedTask = taskList.retrieveTaskById(command.getTaskId()); Task newTask = updatedTask.get(); // TODO: Fill in the right condition into the if-statement and the else-statement - if (/*the task can be deleted*/){ + if (true){ return taskList.deleteTaskById(command.getTaskId()); - } else { - /*send message back to TaskList that the task cannot be deleted*/ } - + // TODO Handle with a return message + return Optional.empty(); } }