diff options
6 files changed, 27 insertions, 100 deletions
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/DBOperationDAO.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/DBOperationDAO.java index d332acc..aaf7631 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/DBOperationDAO.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/DBOperationDAO.java @@ -5,6 +5,7 @@ import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Operation.S import at.ac.tuwien.sepm.assignment.groupphase.exception.ElementNotFoundException; import at.ac.tuwien.sepm.assignment.groupphase.exception.PersistenceException; import at.ac.tuwien.sepm.assignment.groupphase.util.JDBCConnectionManager; +import java.beans.Statement; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -92,7 +93,9 @@ public class DBOperationDAO implements OperationDAO { } pstmt.executeUpdate(); ResultSet rs = pstmt.getGeneratedKeys(); - if (rs.next()) return rs.getInt(1); + if (rs.next()) { + return rs.getInt(1); + } else throw new PersistenceException("Einsatz konnte nicht gespeichert werden"); } catch (SQLException e) { throw new PersistenceException(e); diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/DBVehicleDAO.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/DBVehicleDAO.java index a2cd486..d966dc5 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/DBVehicleDAO.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/DBVehicleDAO.java @@ -12,7 +12,6 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.LinkedList; import java.util.List; -import javax.annotation.Nullable; public class DBVehicleDAO implements VehicleDAO { diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/OperationServiceImpl.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/OperationServiceImpl.java index 4d5fb68..e0fd824 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/OperationServiceImpl.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/OperationServiceImpl.java @@ -15,6 +15,7 @@ import at.ac.tuwien.sepm.assignment.groupphase.exception.InvalidOperationExcepti import at.ac.tuwien.sepm.assignment.groupphase.exception.InvalidVehicleException; import at.ac.tuwien.sepm.assignment.groupphase.exception.PersistenceException; import at.ac.tuwien.sepm.assignment.groupphase.exception.ServiceException; +import at.ac.tuwien.sepm.assignment.groupphase.util.JDBCConnectionManager; import java.util.EnumSet; import java.util.List; import javafx.collections.transformation.SortedList; diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/VehicleServiceImpl.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/VehicleServiceImpl.java index 80d7432..f21ae9a 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/VehicleServiceImpl.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/VehicleServiceImpl.java @@ -1,14 +1,21 @@ package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.service; +import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dao.DBVehicleDAO; +import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dao.VehicleDAO; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Vehicle; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Vehicle.Status; import at.ac.tuwien.sepm.assignment.groupphase.exception.InvalidVehicleException; +import at.ac.tuwien.sepm.assignment.groupphase.exception.PersistenceException; import at.ac.tuwien.sepm.assignment.groupphase.exception.ServiceException; +import at.ac.tuwien.sepm.assignment.groupphase.util.JDBCConnectionManager; import java.util.EnumSet; import java.util.List; public class VehicleServiceImpl implements VehicleService { + // TODO + private static VehicleDAO vehicleDAO = new DBVehicleDAO(new JDBCConnectionManager()); + @Override public long add(Vehicle vehicle) throws InvalidVehicleException, ServiceException { return 0; @@ -21,11 +28,14 @@ public class VehicleServiceImpl implements VehicleService { @Override public List<Vehicle> list(EnumSet<Status> statuses) throws ServiceException { - return null; + // TODO: IMPLEMENT SEARCH WITH STATUS + try { + return vehicleDAO.list(); + } catch (PersistenceException e) { + throw new ServiceException(e); + } } @Override - public void remove(long id) throws InvalidVehicleException, ServiceException { - - } + public void remove(long id) throws InvalidVehicleException, ServiceException {} } diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/CreateOperationController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/CreateOperationController.java index b5a8cf1..ab761e3 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/CreateOperationController.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/CreateOperationController.java @@ -4,11 +4,15 @@ import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dao.DBOperation import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Operation; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Operation.Severity; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Operation; +import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Operation.Severity; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Operation.Status; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Vehicle; +import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Vehicle.ConstructionType; +import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Vehicle.VehicleType; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.service.OperationService; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.service.OperationServiceImpl; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.service.VehicleService; +import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.service.VehicleServiceImpl; import at.ac.tuwien.sepm.assignment.groupphase.exception.InvalidOperationException; import at.ac.tuwien.sepm.assignment.groupphase.exception.ServiceException; import at.ac.tuwien.sepm.assignment.groupphase.util.JDBCConnectionManager; @@ -24,11 +28,15 @@ import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.ListCell; import java.time.Instant; +import java.util.EnumSet; import java.util.LinkedList; import java.util.List; +import javafx.collections.FXCollections; import javafx.fxml.FXML; +import javafx.scene.control.Alert; import javafx.scene.control.Button; import javafx.scene.control.Label; +import javafx.scene.control.ListCell; import javafx.scene.control.ListView; import javafx.scene.control.TextField; import javafx.scene.layout.AnchorPane; diff --git a/src/main/resources/fxmlFiles/CreateOperationController.fxml b/src/main/resources/fxmlFiles/CreateOperationController.fxml deleted file mode 100644 index 7b188fd..0000000 --- a/src/main/resources/fxmlFiles/CreateOperationController.fxml +++ /dev/null @@ -1,94 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<?import javafx.scene.control.Button?> -<?import javafx.scene.control.Label?> -<?import javafx.scene.control.ListView?> -<?import javafx.scene.control.TextField?> -<?import javafx.scene.layout.AnchorPane?> -<?import javafx.scene.text.Font?> - -<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="650.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/9.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.userInterface.CreateOperationController"> - <children> - <AnchorPane layoutX="964.0" layoutY="-66.0" prefHeight="182.0" prefWidth="1200.0" style="-fx-background-color: blue;" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" /> - <AnchorPane fx:id="apCreateOperation" layoutX="40.0" layoutY="71.0" prefHeight="151.0" prefWidth="920.0" style="-fx-background-color: white;"> - <children> - <Label layoutX="14.0" layoutY="14.0" prefHeight="30.0" prefWidth="62.0" text="Code"> - <font> - <Font size="19.0" /> - </font> - </Label> - <Label layoutX="185.0" layoutY="14.0" prefHeight="30.0" prefWidth="94.0" text="Adresse"> - <font> - <Font size="19.0" /> - </font> - </Label> - <Label layoutX="587.0" layoutY="14.0" prefHeight="30.0" prefWidth="121.0" text="Anmerkung"> - <font> - <Font size="19.0" /> - </font> - </Label> - <TextField fx:id="txtCode" layoutX="14.0" layoutY="48.0" prefHeight="39.0" prefWidth="163.0" text="ALP-95E7"> - <font> - <Font name="System Bold" size="20.0" /> - </font> - </TextField> - <TextField fx:id="txtAddress" layoutX="185.0" layoutY="48.0" prefHeight="39.0" prefWidth="396.0"> - <font> - <Font name="System Bold" size="20.0" /> - </font> - </TextField> - <TextField fx:id="txtNote" layoutX="587.0" layoutY="48.0" prefHeight="39.0" prefWidth="319.0"> - <font> - <Font size="20.0" /> - </font> - </TextField> - <Label layoutX="14.0" layoutY="101.0" prefHeight="30.0" prefWidth="102.0" text="Fahrzeuge:"> - <font> - <Font size="19.0" /> - </font> - </Label> - <Label fx:id="lblChosenVehicles" layoutX="116.0" layoutY="102.0" prefHeight="30.0" prefWidth="610.0" text="keine ausgewählt"> - <font> - <Font size="19.0" /> - </font> - </Label> - <Button fx:id="btnCreateOperation" layoutX="740.0" layoutY="95.0" mnemonicParsing="false" onAction="#createOperationClicked" prefHeight="0.0" prefWidth="158.0" text="Erstellen"> - <font> - <Font name="System Bold" size="21.0" /> - </font> - </Button> - </children> - </AnchorPane> - <Label layoutX="55.0" layoutY="38.0" text="Anmeldungen" textFill="WHITE"> - <font> - <Font size="15.0" /> - </font> - </Label> - <Label layoutX="802.0" layoutY="38.0" text="Personen" textFill="WHITE"> - <font> - <Font size="15.0" /> - </font> - </Label> - <Label layoutX="877.0" layoutY="38.0" text="Fahrzeuge" textFill="WHITE"> - <font> - <Font size="15.0" /> - </font> - </Label> - <AnchorPane fx:id="apActiveOperations" layoutX="973.0" layoutY="69.0" prefHeight="243.0" prefWidth="207.0" style="-fx-background-color: white;"> - <children> - <ListView fx:id="lvActiveOperations" layoutX="4.0" layoutY="74.0" prefHeight="242.0" prefWidth="200.0" style="-fx-background-color: white;" /> - <Label layoutX="10.0" layoutY="14.0" prefHeight="46.0" prefWidth="103.0" text="Aktive Einsätze"> - <font> - <Font name="System Bold" size="14.0" /> - </font> - </Label> - <Label layoutX="148.0" layoutY="28.0" text="Archiv"> - <font> - <Font size="13.0" /> - </font> - </Label> - </children> - </AnchorPane> - <ListView fx:id="lvVehicles" layoutX="41.0" layoutY="222.0" prefHeight="394.0" prefWidth="918.0" /> - </children> -</AnchorPane> |