diff --git a/pom.xml b/pom.xml index e69090d..19d907d 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ de.infinimotion model-persistence - 0.0.56 + 0.0.64 diff --git a/src/main/java/de/infinimotion/persistence/processor/KinosaalProcessor.java b/src/main/java/de/infinimotion/persistence/processor/KinosaalProcessor.java deleted file mode 100644 index 30f5ad2..0000000 --- a/src/main/java/de/infinimotion/persistence/processor/KinosaalProcessor.java +++ /dev/null @@ -1,66 +0,0 @@ -package de.infinimotion.persistence.processor; - -import de.infinimotion.model.persistence.*; -import io.quarkus.arc.Unremovable; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.persistence.EntityManager; - -import java.util.List; - -@Unremovable -@ApplicationScoped -public class KinosaalProcessor implements CommandListKinosaalProcessor, CommandGetKinosaalProcessor, CommandCreateKinosaalProcessor, CommandUpdateKinosaalProcessor, CommandDeleteKinosaalProcessor { - - @Inject - EntityManager em; - - @Override - public Command processCommandListKinosaal(CommandListKinosaal request) { - List results = em.createQuery("SELECT k FROM Kinosaal k", Kinosaal.class).getResultList(); - - CommandListKinosaalResponse response = new CommandListKinosaalResponse(); - response.setList(results); - return response; - } - - @Override - public Command processCommandGetKinosaal(CommandGetKinosaal request) throws Exception { - Kinosaal hall = em.find(Kinosaal.class, request.getId()); - - CommandGetKinosaalResponse response = new CommandGetKinosaalResponse(); - response.setHall(hall); - return response; - } - - @Override - public Command processCommandCreateKinosaal(CommandCreateKinosaal request) { - 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; - } - -}