kinosaal crud
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -35,7 +35,7 @@
|
||||
<dependency>
|
||||
<groupId>de.infinimotion</groupId>
|
||||
<artifactId>model-persistence</artifactId>
|
||||
<version>0.0.54</version>
|
||||
<version>0.0.55</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Quarkus -->
|
||||
|
||||
@@ -10,13 +10,14 @@ import java.util.List;
|
||||
|
||||
@Unremovable
|
||||
@ApplicationScoped
|
||||
public class KinosaalProcessor implements CommandListKinosaalProcessor, CommandCreateKinosaalProcessor {
|
||||
public class KinosaalProcessor implements CommandListKinosaalProcessor, CommandCreateKinosaalProcessor, CommandUpdateKinosaalProcessor, CommandDeleteKinosaalProcessor {
|
||||
|
||||
@Inject
|
||||
EntityManager em;
|
||||
|
||||
public Command processCommandListKinosaal(CommandListKinosaal request) {
|
||||
List<Kinosaal> results = em.createQuery("SELECT k FROM Kinosaal k", Kinosaal.class).getResultList();
|
||||
|
||||
CommandListKinosaalResponse response = new CommandListKinosaalResponse();
|
||||
response.setList(results);
|
||||
return response;
|
||||
@@ -26,9 +27,28 @@ public class KinosaalProcessor implements CommandListKinosaalProcessor, CommandC
|
||||
Kinosaal hall = new Kinosaal();
|
||||
hall.setName(request.getName());
|
||||
em.persist(hall);
|
||||
|
||||
CommandCreateKinosaalResponse response = new CommandCreateKinosaalResponse();
|
||||
response.setHall(hall);
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Command processCommandDeleteKinosaal(CommandDeleteKinosaal request) {
|
||||
Kinosaal hall = em.find(Kinosaal.class, request.getHall().getId());
|
||||
em.remove(hall);
|
||||
|
||||
CommandDeleteKinosaalResponse response = new CommandDeleteKinosaalResponse();
|
||||
response.setHall(hall);
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Command processCommandUpdateKinosaal(CommandUpdateKinosaal request) {
|
||||
Kinosaal hall = em.merge(request.getHall());
|
||||
|
||||
CommandUpdateKinosaal response = new CommandUpdateKinosaal();
|
||||
response.setHall(hall);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user