added valueObjects & CustomErrors

This commit is contained in:
2021-10-17 10:33:26 +02:00
parent a61f111879
commit 46969deb0f
34 changed files with 214 additions and 103 deletions

View File

@@ -45,6 +45,12 @@
<artifactId>executorBase</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20210307</version>
</dependency>
</dependencies>
<build>

View File

@@ -1,5 +1,7 @@
package ch.unisg.executor2.executor.adapter.in.web;
import java.util.concurrent.CompletableFuture;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -25,12 +27,9 @@ public class TaskAvailableController {
if (ExecutorType.contains(taskType.toUpperCase())) {
TaskAvailableCommand command = new TaskAvailableCommand(
ExecutorType.valueOf(taskType.toUpperCase()));
taskAvailableUseCase.newTaskAvailable(command);
CompletableFuture.runAsync(() -> taskAvailableUseCase.newTaskAvailable(command));
}
// Add the content type as a response header
HttpHeaders responseHeaders = new HttpHeaders();
return new ResponseEntity<>("OK", responseHeaders, HttpStatus.OK);
return new ResponseEntity<>("OK", new HttpHeaders(), HttpStatus.OK);
}
}

View File

@@ -1,5 +1,6 @@
package ch.unisg.executor2.executor.application.service;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import ch.unisg.executor2.executor.domain.Executor;
@@ -16,6 +17,7 @@ import javax.transaction.Transactional;
public class TaskAvailableService implements TaskAvailableUseCase {
@Override
@Async
public void newTaskAvailable(TaskAvailableCommand command) {
Executor executor = Executor.getExecutor();