initial upload
This commit is contained in:
commit
4b9c2ff42c
62 changed files with 1411 additions and 0 deletions
106
README.md
Normal file
106
README.md
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
# Projektaufgabe – Entwicklung einer Werkstattverwaltungssoftware
|
||||
|
||||
Sie arbeiten als Softwareentwicklungs-Team in einem Unternehmen, das digitale Lösungen für kleine Betriebe entwickelt. Eine regionale Kfz-Werkstatt hat Sie beauftragt, eine Konsolenanwendung zu erstellen, mit der sie ihre täglichen Arbeitsabläufe digital verwalten kann. Die Daten sollen in einer Datenbank gespeichert werden.
|
||||
|
||||
## Auftrag des Kunden
|
||||
|
||||
### 1. Verwaltung der Personen, die Leistungen in Anspruch nehmen
|
||||
Die Werkstatt möchte Informationen über ihre Kundschaft erfassen und abrufen können. Das System soll ermöglichen, neue Kunden anzulegen, vorhandene anzuzeigen und eine Übersicht aller erfassten Personen auszugeben.
|
||||
|
||||
### 2. Verwaltung der Fahrzeuge
|
||||
Zu jeder Person können mehrere Fahrzeuge gehören. Das System soll das Anlegen neuer Fahrzeuge, das Anzeigen einzelner Fahrzeuge sowie eine Übersicht über alle Fahrzeuge einer bestimmten Person ermöglichen.
|
||||
|
||||
### 3. Dokumentation der Werkstattarbeiten
|
||||
Für jedes Fahrzeug sollen Werkstattvorgänge angelegt und angezeigt werden können. Ein Werkstattvorgang besteht aus mehreren einzelnen Positionen, welche aus einem vordefinierten Katalog zu wählen sind
|
||||
|
||||
#### Vorgabekatalog für Leistungen und Preise
|
||||
|
||||
Die Werkstatt verwendet einen festen Leistungskatalog mit einheitlichen Preisen. Diese werden vorab in der Datenbank hinterlegt.
|
||||
|
||||
Der Katalog enthält folgende Positionen:
|
||||
|
||||
| Leistung | Preis pro Einheit |
|
||||
|------------------------------------|-------------------|
|
||||
| Ölwechsel | 89.00 € |
|
||||
| Bremsflüssigkeit wechseln | 59.00 € |
|
||||
| Reifen wechseln (pro Stück) | 18.00 € |
|
||||
| Klimaanlagen-Service | 99.00 € |
|
||||
| Bremsbeläge erneuern vorne | 149.00 € |
|
||||
| Zündkerzen austauschen | 79.00 € |
|
||||
| Diagnose / Fehlerspeicher auslesen | 25.00 € |
|
||||
| Arbeitszeit pro Stunde | 75.00 € |
|
||||
|
||||
|
||||
### 4. Einsicht in Werkstattvorgänge
|
||||
Alle erfassten Vorgänge sollen einzeln einsehbar sein. Dabei sollen folgende Informationen angezeigt werden können:
|
||||
- alle erfassten Positionen eines Vorgangs inkl. Preis,
|
||||
- die automatisch berechnete Gesamtsumme,
|
||||
- das zugehörige Fahrzeug und die zugehörige Person.
|
||||
|
||||
## Datenhaltung
|
||||
|
||||
Alle Daten sollen dauerhaft in einer relationalen Datenbank gespeichert werden. Die Struktur der Datenbank (Tabellen, Beziehungen) ist auf Basis der fachlichen Anforderungen selbst zu entwickeln.
|
||||
|
||||
## Bedienoberfläche
|
||||
|
||||
Alle Funktionen sollen über ein verständliches, klar strukturiertes Konsolenmenü steuerbar sein.
|
||||
|
||||
## Technische Anforderungen
|
||||
|
||||
- Java-Konsolenanwendung
|
||||
- Objektorientierte Programmierung
|
||||
- Verwendung einer relationalen Datenbank
|
||||
- Datenbankzugriff mit JDBC
|
||||
- Verwendung eines festen Leistungskatalogs
|
||||
- Sinnvolle Trennung von Logik und Datenzugriff
|
||||
- Fehlerbehandlung für Nutzereingaben
|
||||
- Übersichtlicher, gut strukturierter Code
|
||||
|
||||
## Liefergegenstände
|
||||
Für die Colloboration und die Abgabe ist ein git Repository anzulegen. Die Lehrkraft ist dem Repository als Bearbeiter hinzuzufügen. Follgendes ist hierbei abzugeben:
|
||||
|
||||
- Vollständiger Source-Code als Maven-Projekt
|
||||
- SQL-Skript zum Erstellen der Datenbanktabellen
|
||||
- ER-Modell
|
||||
- UML-Diagramm
|
||||
- Kunden Domumentation als README
|
||||
- Javadoc als HTML-Dokumentation
|
||||
|
||||
## Zusatzaufgaben (für Notenverbesserung über 1,5 hinaus)
|
||||
|
||||
Durch die vollständige und korrekte Umsetzung der regulären Anforderungen kann eine maximale Note von **1,5** erreicht werden.
|
||||
Für eine darüber hinausgehende Bewertung können zusätzlich folgende Erweiterungen umgesetzt werden:
|
||||
|
||||
- **Laden des Leistungskatalogs aus einer Datei**
|
||||
(z. B. JSON oder CSV statt statischer Daten)
|
||||
|
||||
- **Rechnungserstellung**
|
||||
Erzeugung eines strukturierten, druckfähigen Dokuments
|
||||
(z. B. Textdatei, Markdown oder einfache PDF-Ausgabe)
|
||||
|
||||
- **Zugangsbeschränkung für Mitarbeiter**
|
||||
Implementierung eines einfachen Login-Systems
|
||||
(Nutzerverwaltung + Passwortprüfung)
|
||||
|
||||
- **Unit-Tests**
|
||||
Testabdeckung von **> 90 %** der zentralen Funktionen
|
||||
|
||||
- **Testen mit gemockter Datenbank**
|
||||
Nutzung von Mocks oder In-Memory-Datenbank zur Simulation der Datenhaltung
|
||||
|
||||
- **Datenexport**
|
||||
Export von Vorgängen oder Kundendaten in JSON-, CSV- oder Textdateien
|
||||
|
||||
- **Logging**
|
||||
Protokollierung aller Aktionen in einer Logdatei (z. B. mit einfachem File-Logger)
|
||||
|
||||
|
||||
## Bewertungskriterien
|
||||
|
||||
- Qualität und Vollständigkeit des Datenmodells
|
||||
- Saubere objektorientierte Struktur
|
||||
- Funktionierende Datenbankanbindung
|
||||
- Umsetzung des Leistungskatalogs
|
||||
- Bedienbarkeit und Menüführung
|
||||
- Code-Stil und Robustheit
|
||||
- Qualität der Dokumentation
|
||||
3
build.sh
Executable file
3
build.sh
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
mvn -q -DskipTests package
|
||||
65
pom.xml
Normal file
65
pom.xml
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.antco</groupId>
|
||||
<artifactId>jdbc-konsolen-projekt</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>WerkstattKonsole</name>
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.7.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<version>5.10.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<source>${maven.compiler.source}</source>
|
||||
<target>${maven.compiler.target}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.2.5</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>de.antco.projekt.App</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
4
run.sh
Executable file
4
run.sh
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
./build.sh
|
||||
java -jar target/jdbc-konsolen-projekt-1.0-SNAPSHOT-jar-with-dependencies.jar
|
||||
44
sql/schema.sql
Normal file
44
sql/schema.sql
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
CREATE TABLE IF NOT EXISTS person (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(200) NOT NULL,
|
||||
phone VARCHAR(100)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS vehicle (
|
||||
id SERIAL PRIMARY KEY,
|
||||
person_id INTEGER NOT NULL REFERENCES person(id) ON DELETE CASCADE,
|
||||
brand VARCHAR(120) NOT NULL,
|
||||
model VARCHAR(120) NOT NULL,
|
||||
plate VARCHAR(50) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS service_item (
|
||||
id SERIAL PRIMARY KEY,
|
||||
title VARCHAR(200) NOT NULL,
|
||||
price NUMERIC(10,2) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS work_order (
|
||||
id SERIAL PRIMARY KEY,
|
||||
vehicle_id INTEGER NOT NULL REFERENCES vehicle(id) ON DELETE CASCADE,
|
||||
note TEXT,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS work_order_item (
|
||||
id SERIAL PRIMARY KEY,
|
||||
work_order_id INTEGER NOT NULL REFERENCES work_order(id) ON DELETE CASCADE,
|
||||
service_item_id INTEGER NOT NULL REFERENCES service_item(id),
|
||||
quantity INTEGER NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO service_item(title, price) VALUES
|
||||
('Ölwechsel', 89.00),
|
||||
('Bremsflüssigkeit wechseln', 59.00),
|
||||
('Reifen wechseln (pro Stück)', 18.00),
|
||||
('Klimaanlagen-Service', 99.00),
|
||||
('Bremsbeläge erneuern vorne', 149.00),
|
||||
('Zündkerzen austauschen', 79.00),
|
||||
('Diagnose / Fehlerspeicher auslesen', 25.00),
|
||||
('Arbeitszeit pro Stunde', 75.00)
|
||||
ON CONFLICT DO NOTHING;
|
||||
14
src/main/java/de/antco/projekt/App.java
Normal file
14
src/main/java/de/antco/projekt/App.java
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package de.antco.projekt;
|
||||
|
||||
import de.antco.projekt.service.WorkshopService;
|
||||
|
||||
public class App {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
WorkshopService service = new WorkshopService();
|
||||
new ConsoleUi(service).start();
|
||||
} catch (RuntimeException e) {
|
||||
System.out.println("Start fehlgeschlagen: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
228
src/main/java/de/antco/projekt/ConsoleUi.java
Normal file
228
src/main/java/de/antco/projekt/ConsoleUi.java
Normal file
|
|
@ -0,0 +1,228 @@
|
|||
package de.antco.projekt;
|
||||
|
||||
import de.antco.projekt.model.Person;
|
||||
import de.antco.projekt.model.ServiceItem;
|
||||
import de.antco.projekt.model.Vehicle;
|
||||
import de.antco.projekt.model.WorkOrderDetails;
|
||||
import de.antco.projekt.model.WorkOrderItem;
|
||||
import de.antco.projekt.service.WorkshopService;
|
||||
import de.antco.projekt.importers.IImporter;
|
||||
import de.antco.projekt.importers.CsvPersonImporter;
|
||||
import de.antco.projekt.exporters.IExporter;
|
||||
import de.antco.projekt.exporters.CsvPersonExporter;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class ConsoleUi {
|
||||
private final WorkshopService service;
|
||||
private final Scanner scanner = new Scanner(System.in);
|
||||
|
||||
public ConsoleUi(WorkshopService service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
public void start() {
|
||||
boolean running = true;
|
||||
while (running) {
|
||||
printMenu();
|
||||
String input = scanner.nextLine();
|
||||
try {
|
||||
switch (input) {
|
||||
case "1" -> addPerson();
|
||||
case "2" -> listPersons();
|
||||
case "3" -> addVehicle();
|
||||
case "4" -> listVehiclesOfPerson();
|
||||
case "5" -> createWorkOrder();
|
||||
case "6" -> listWorkOrders();
|
||||
case "7" -> importPersons();
|
||||
case "8" -> exportPersons();
|
||||
case "0" -> running = false;
|
||||
default -> System.out.println("Unbekannte Auswahl");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
System.out.println("Fehler: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
System.out.println("Bis dann");
|
||||
}
|
||||
|
||||
private void printMenu() {
|
||||
System.out.println();
|
||||
System.out.println("==== Werkstatt Menü ====");
|
||||
System.out.println("1) Kunde anlegen");
|
||||
System.out.println("2) Kunden anzeigen");
|
||||
System.out.println("3) Fahrzeug anlegen");
|
||||
System.out.println("4) Fahrzeuge einer Person");
|
||||
System.out.println("5) Werkstattvorgang anlegen");
|
||||
System.out.println("6) Vorgänge anzeigen");
|
||||
System.out.println("7) Personen importieren (CSV)");
|
||||
System.out.println("8) Personen exportieren (CSV)");
|
||||
System.out.println("0) Ende");
|
||||
System.out.print("Auswahl: ");
|
||||
}
|
||||
|
||||
private void addPerson() throws SQLException {
|
||||
System.out.print("Name: ");
|
||||
String name = scanner.nextLine();
|
||||
System.out.print("Telefon: ");
|
||||
String phone = scanner.nextLine();
|
||||
Person person = service.createPerson(name, phone);
|
||||
System.out.println("Kunde gespeichert mit ID " + person.getId());
|
||||
}
|
||||
|
||||
private void listPersons() throws SQLException {
|
||||
List<Person> persons = service.listPersons();
|
||||
if (persons.isEmpty()) {
|
||||
System.out.println("Keine Personen da");
|
||||
return;
|
||||
}
|
||||
persons.forEach(p -> System.out.println(p.toString()));
|
||||
}
|
||||
|
||||
private void addVehicle() throws SQLException {
|
||||
System.out.print("Personen ID: ");
|
||||
int personId = parseInt(scanner.nextLine());
|
||||
Person owner = service.findPerson(personId);
|
||||
if (owner == null) {
|
||||
System.out.println("Person nicht gefunden");
|
||||
return;
|
||||
}
|
||||
System.out.print("Hersteller: ");
|
||||
String brand = scanner.nextLine();
|
||||
System.out.print("Modell: ");
|
||||
String model = scanner.nextLine();
|
||||
System.out.print("Kennzeichen: ");
|
||||
String plate = scanner.nextLine();
|
||||
Vehicle vehicle = service.createVehicle(personId, brand, model, plate);
|
||||
System.out.println("Fahrzeug gespeichert mit ID " + vehicle.getId());
|
||||
}
|
||||
|
||||
private void listVehiclesOfPerson() throws SQLException {
|
||||
System.out.print("Personen ID: ");
|
||||
int personId = parseInt(scanner.nextLine());
|
||||
Person owner = service.findPerson(personId);
|
||||
if (owner == null) {
|
||||
System.out.println("Person nicht gefunden");
|
||||
return;
|
||||
}
|
||||
List<Vehicle> vehicles = service.listVehicles(personId);
|
||||
System.out.println("Fahrzeuge von " + owner.getName() + ":");
|
||||
if (vehicles.isEmpty()) {
|
||||
System.out.println("Keine Einträge");
|
||||
return;
|
||||
}
|
||||
vehicles.forEach(v -> System.out.println(v.toString()));
|
||||
}
|
||||
|
||||
private void createWorkOrder() throws SQLException {
|
||||
System.out.print("Fahrzeug ID: ");
|
||||
int vehicleId = parseInt(scanner.nextLine());
|
||||
Vehicle vehicle = service.findVehicle(vehicleId);
|
||||
if (vehicle == null) {
|
||||
System.out.println("Fahrzeug nicht gefunden");
|
||||
return;
|
||||
}
|
||||
System.out.print("Notiz: ");
|
||||
String note = scanner.nextLine();
|
||||
List<ServiceItem> catalog = service.listServiceItems();
|
||||
Map<Integer, Integer> selected = new LinkedHashMap<>();
|
||||
boolean adding = true;
|
||||
while (adding) {
|
||||
showCatalog(catalog);
|
||||
System.out.print("Service ID (leer = fertig): ");
|
||||
String input = scanner.nextLine();
|
||||
if (input.isBlank()) {
|
||||
adding = false;
|
||||
} else {
|
||||
int serviceId = parseInt(input);
|
||||
ServiceItem item = catalog.stream().filter(s -> s.getId() == serviceId).findFirst().orElse(null);
|
||||
if (item == null) {
|
||||
System.out.println("Service gibt es nicht");
|
||||
continue;
|
||||
}
|
||||
System.out.print("Menge: ");
|
||||
int qty = parseInt(scanner.nextLine());
|
||||
if (qty <= 0) {
|
||||
System.out.println("Menge muss > 0 sein");
|
||||
continue;
|
||||
}
|
||||
selected.put(serviceId, selected.getOrDefault(serviceId, 0) + qty);
|
||||
}
|
||||
}
|
||||
if (selected.isEmpty()) {
|
||||
System.out.println("Keine Positionen gespeichert");
|
||||
return;
|
||||
}
|
||||
int orderId = service.createWorkOrder(vehicleId, note, selected);
|
||||
System.out.println("Vorgang angelegt mit ID " + orderId);
|
||||
}
|
||||
|
||||
private void showCatalog(List<ServiceItem> items) {
|
||||
System.out.println("Katalog:");
|
||||
items.forEach(item -> System.out.println(item.toString()));
|
||||
}
|
||||
|
||||
private void listWorkOrders() throws SQLException {
|
||||
List<WorkOrderDetails> orders = service.listWorkOrders();
|
||||
if (orders.isEmpty()) {
|
||||
System.out.println("Keine Vorgänge gespeichert");
|
||||
return;
|
||||
}
|
||||
for (WorkOrderDetails order : orders) {
|
||||
System.out.println("--- Vorgang " + order.getOrderId() + " ---");
|
||||
System.out.println("Kunde: " + order.getPersonName());
|
||||
System.out.println("Fahrzeug: " + order.getVehicleText());
|
||||
System.out.println("Datum: " + order.getCreatedAt());
|
||||
if (order.getNote() != null && !order.getNote().isBlank()) {
|
||||
System.out.println("Notiz: " + order.getNote());
|
||||
}
|
||||
for (WorkOrderItem item : order.getItems()) {
|
||||
System.out.println(" * " + item.getServiceItem().getTitle() + " x" + item.getQuantity() +
|
||||
" = " + item.getTotalPrice() + " €");
|
||||
}
|
||||
System.out.println("Summe: " + order.getTotal() + " €");
|
||||
}
|
||||
}
|
||||
|
||||
private void importPersons() {
|
||||
System.out.print("Pfad zur CSV-Datei: ");
|
||||
String path = scanner.nextLine();
|
||||
IImporter<Person> importer = new CsvPersonImporter();
|
||||
try {
|
||||
List<Person> imported = importer.importData(path);
|
||||
int count = 0;
|
||||
for (Person p : imported) {
|
||||
service.createPerson(p.getName(), p.getPhone());
|
||||
count++;
|
||||
}
|
||||
System.out.println(count + " Personen erfolgreich importiert.");
|
||||
} catch (Exception e) {
|
||||
System.out.println("Fehler beim Import: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void exportPersons() {
|
||||
System.out.print("Pfad zur Ziel-Datei: ");
|
||||
String path = scanner.nextLine();
|
||||
try {
|
||||
List<Person> persons = service.listPersons();
|
||||
IExporter<Person> exporter = new CsvPersonExporter();
|
||||
exporter.exportData(persons, path);
|
||||
System.out.println(persons.size() + " Personen exportiert.");
|
||||
} catch (Exception e) {
|
||||
System.out.println("Fehler beim Export: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private int parseInt(String input) {
|
||||
try {
|
||||
return Integer.parseInt(input.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
src/main/java/de/antco/projekt/Database.java
Normal file
15
src/main/java/de/antco/projekt/Database.java
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package de.antco.projekt;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class Database {
|
||||
private static final String URL = "jdbc:postgresql://38.242.130.81:5555/postgres";
|
||||
private static final String USER = "postgres";
|
||||
private static final String PASSWORD = "tgewptivkpv7zlk5";
|
||||
|
||||
public static Connection getConnection() throws SQLException {
|
||||
return DriverManager.getConnection(URL, USER, PASSWORD);
|
||||
}
|
||||
}
|
||||
50
src/main/java/de/antco/projekt/dao/PersonDao.java
Normal file
50
src/main/java/de/antco/projekt/dao/PersonDao.java
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
package de.antco.projekt.dao;
|
||||
|
||||
import de.antco.projekt.Database;
|
||||
import de.antco.projekt.model.Person;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PersonDao {
|
||||
public Person create(String name, String phone) throws SQLException {
|
||||
String sql = "INSERT INTO person(name, phone) VALUES (?, ?) RETURNING id";
|
||||
try (Connection con = Database.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(sql)) {
|
||||
ps.setString(1, name);
|
||||
ps.setString(2, phone);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next()) {
|
||||
return new Person(rs.getInt("id"), name, phone);
|
||||
}
|
||||
throw new SQLException("Konnte Person nicht speichern");
|
||||
}
|
||||
}
|
||||
|
||||
public List<Person> findAll() throws SQLException {
|
||||
List<Person> result = new ArrayList<>();
|
||||
String sql = "SELECT id, name, phone FROM person ORDER BY name";
|
||||
try (Connection con = Database.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(sql);
|
||||
ResultSet rs = ps.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
result.add(new Person(rs.getInt("id"), rs.getString("name"), rs.getString("phone")));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Person findById(int id) throws SQLException {
|
||||
String sql = "SELECT id, name, phone FROM person WHERE id = ?";
|
||||
try (Connection con = Database.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(sql)) {
|
||||
ps.setInt(1, id);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next()) {
|
||||
return new Person(rs.getInt("id"), rs.getString("name"), rs.getString("phone"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
43
src/main/java/de/antco/projekt/dao/SchemaCreator.java
Normal file
43
src/main/java/de/antco/projekt/dao/SchemaCreator.java
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
package de.antco.projekt.dao;
|
||||
|
||||
import de.antco.projekt.Database;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
public class SchemaCreator {
|
||||
public void ensureSchema() throws SQLException {
|
||||
try (Connection con = Database.getConnection(); Statement st = con.createStatement()) {
|
||||
st.execute("CREATE TABLE IF NOT EXISTS person (" +
|
||||
"id SERIAL PRIMARY KEY, " +
|
||||
"name VARCHAR(200) NOT NULL, " +
|
||||
"phone VARCHAR(100)" +
|
||||
")");
|
||||
st.execute("CREATE TABLE IF NOT EXISTS vehicle (" +
|
||||
"id SERIAL PRIMARY KEY, " +
|
||||
"person_id INTEGER NOT NULL REFERENCES person(id) ON DELETE CASCADE, " +
|
||||
"brand VARCHAR(120) NOT NULL, " +
|
||||
"model VARCHAR(120) NOT NULL, " +
|
||||
"plate VARCHAR(50) NOT NULL" +
|
||||
")");
|
||||
st.execute("CREATE TABLE IF NOT EXISTS service_item (" +
|
||||
"id SERIAL PRIMARY KEY, " +
|
||||
"title VARCHAR(200) NOT NULL, " +
|
||||
"price NUMERIC(10,2) NOT NULL" +
|
||||
")");
|
||||
st.execute("CREATE TABLE IF NOT EXISTS work_order (" +
|
||||
"id SERIAL PRIMARY KEY, " +
|
||||
"vehicle_id INTEGER NOT NULL REFERENCES vehicle(id) ON DELETE CASCADE, " +
|
||||
"note TEXT, " +
|
||||
"created_at TIMESTAMP NOT NULL DEFAULT NOW()" +
|
||||
")");
|
||||
st.execute("CREATE TABLE IF NOT EXISTS work_order_item (" +
|
||||
"id SERIAL PRIMARY KEY, " +
|
||||
"work_order_id INTEGER NOT NULL REFERENCES work_order(id) ON DELETE CASCADE, " +
|
||||
"service_item_id INTEGER NOT NULL REFERENCES service_item(id), " +
|
||||
"quantity INTEGER NOT NULL" +
|
||||
")");
|
||||
}
|
||||
}
|
||||
}
|
||||
70
src/main/java/de/antco/projekt/dao/ServiceItemDao.java
Normal file
70
src/main/java/de/antco/projekt/dao/ServiceItemDao.java
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
package de.antco.projekt.dao;
|
||||
|
||||
import de.antco.projekt.Database;
|
||||
import de.antco.projekt.model.ServiceItem;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ServiceItemDao {
|
||||
public List<ServiceItem> findAll() throws SQLException {
|
||||
List<ServiceItem> result = new ArrayList<>();
|
||||
String sql = "SELECT id, title, price FROM service_item ORDER BY id";
|
||||
try (Connection con = Database.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(sql);
|
||||
ResultSet rs = ps.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
result.add(map(rs));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ServiceItem findById(int id) throws SQLException {
|
||||
String sql = "SELECT id, title, price FROM service_item WHERE id = ?";
|
||||
try (Connection con = Database.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(sql)) {
|
||||
ps.setInt(1, id);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next()) {
|
||||
return map(rs);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void seedDefaultItems() throws SQLException {
|
||||
String countSql = "SELECT COUNT(*) FROM service_item";
|
||||
try (Connection con = Database.getConnection();
|
||||
PreparedStatement countStmt = con.prepareStatement(countSql)) {
|
||||
ResultSet rs = countStmt.executeQuery();
|
||||
if (rs.next() && rs.getLong(1) > 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
insert("Ölwechsel", new BigDecimal("89.00"));
|
||||
insert("Bremsflüssigkeit wechseln", new BigDecimal("59.00"));
|
||||
insert("Reifen wechseln (pro Stück)", new BigDecimal("18.00"));
|
||||
insert("Klimaanlagen-Service", new BigDecimal("99.00"));
|
||||
insert("Bremsbeläge erneuern vorne", new BigDecimal("149.00"));
|
||||
insert("Zündkerzen austauschen", new BigDecimal("79.00"));
|
||||
insert("Diagnose / Fehlerspeicher auslesen", new BigDecimal("25.00"));
|
||||
insert("Arbeitszeit pro Stunde", new BigDecimal("75.00"));
|
||||
}
|
||||
|
||||
private void insert(String title, BigDecimal price) throws SQLException {
|
||||
String sql = "INSERT INTO service_item(title, price) VALUES (?, ?)";
|
||||
try (Connection con = Database.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(sql)) {
|
||||
ps.setString(1, title);
|
||||
ps.setBigDecimal(2, price);
|
||||
ps.executeUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
private ServiceItem map(ResultSet rs) throws SQLException {
|
||||
return new ServiceItem(rs.getInt("id"), rs.getString("title"), rs.getBigDecimal("price"));
|
||||
}
|
||||
}
|
||||
63
src/main/java/de/antco/projekt/dao/VehicleDao.java
Normal file
63
src/main/java/de/antco/projekt/dao/VehicleDao.java
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
package de.antco.projekt.dao;
|
||||
|
||||
import de.antco.projekt.Database;
|
||||
import de.antco.projekt.model.Vehicle;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class VehicleDao {
|
||||
public Vehicle create(int personId, String brand, String model, String plate) throws SQLException {
|
||||
String sql = "INSERT INTO vehicle(person_id, brand, model, plate) VALUES (?, ?, ?, ?) RETURNING id";
|
||||
try (Connection con = Database.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(sql)) {
|
||||
ps.setInt(1, personId);
|
||||
ps.setString(2, brand);
|
||||
ps.setString(3, model);
|
||||
ps.setString(4, plate);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next()) {
|
||||
return new Vehicle(rs.getInt("id"), personId, brand, model, plate);
|
||||
}
|
||||
throw new SQLException("Konnte Fahrzeug nicht speichern");
|
||||
}
|
||||
}
|
||||
|
||||
public List<Vehicle> findByPerson(int personId) throws SQLException {
|
||||
List<Vehicle> result = new ArrayList<>();
|
||||
String sql = "SELECT id, person_id, brand, model, plate FROM vehicle WHERE person_id = ? ORDER BY id";
|
||||
try (Connection con = Database.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(sql)) {
|
||||
ps.setInt(1, personId);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
while (rs.next()) {
|
||||
result.add(map(rs));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Vehicle findById(int id) throws SQLException {
|
||||
String sql = "SELECT id, person_id, brand, model, plate FROM vehicle WHERE id = ?";
|
||||
try (Connection con = Database.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(sql)) {
|
||||
ps.setInt(1, id);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next()) {
|
||||
return map(rs);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Vehicle map(ResultSet rs) throws SQLException {
|
||||
return new Vehicle(
|
||||
rs.getInt("id"),
|
||||
rs.getInt("person_id"),
|
||||
rs.getString("brand"),
|
||||
rs.getString("model"),
|
||||
rs.getString("plate")
|
||||
);
|
||||
}
|
||||
}
|
||||
108
src/main/java/de/antco/projekt/dao/WorkOrderDao.java
Normal file
108
src/main/java/de/antco/projekt/dao/WorkOrderDao.java
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
package de.antco.projekt.dao;
|
||||
|
||||
import de.antco.projekt.Database;
|
||||
import de.antco.projekt.model.ServiceItem;
|
||||
import de.antco.projekt.model.WorkOrderDetails;
|
||||
import de.antco.projekt.model.WorkOrderItem;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class WorkOrderDao {
|
||||
public int createWorkOrder(int vehicleId, String note, Map<Integer, Integer> items) throws SQLException {
|
||||
if (items.isEmpty()) {
|
||||
throw new IllegalArgumentException("Keine Positionen gewählt");
|
||||
}
|
||||
try (Connection con = Database.getConnection()) {
|
||||
con.setAutoCommit(false);
|
||||
try {
|
||||
int orderId = insertOrder(con, vehicleId, note);
|
||||
insertItems(con, orderId, items);
|
||||
con.commit();
|
||||
return orderId;
|
||||
} catch (SQLException e) {
|
||||
con.rollback();
|
||||
throw e;
|
||||
} finally {
|
||||
con.setAutoCommit(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int insertOrder(Connection con, int vehicleId, String note) throws SQLException {
|
||||
String sql = "INSERT INTO work_order(vehicle_id, note) VALUES (?, ?) RETURNING id";
|
||||
try (PreparedStatement ps = con.prepareStatement(sql)) {
|
||||
ps.setInt(1, vehicleId);
|
||||
ps.setString(2, note);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next()) {
|
||||
return rs.getInt("id");
|
||||
}
|
||||
throw new SQLException("Vorgang konnte nicht gespeichert werden");
|
||||
}
|
||||
}
|
||||
|
||||
private void insertItems(Connection con, int orderId, Map<Integer, Integer> items) throws SQLException {
|
||||
String sql = "INSERT INTO work_order_item(work_order_id, service_item_id, quantity) VALUES (?, ?, ?)";
|
||||
try (PreparedStatement ps = con.prepareStatement(sql)) {
|
||||
for (Map.Entry<Integer, Integer> entry : items.entrySet()) {
|
||||
ps.setInt(1, orderId);
|
||||
ps.setInt(2, entry.getKey());
|
||||
ps.setInt(3, entry.getValue());
|
||||
ps.addBatch();
|
||||
}
|
||||
ps.executeBatch();
|
||||
}
|
||||
}
|
||||
|
||||
public List<WorkOrderDetails> fetchAllDetails() throws SQLException {
|
||||
Map<Integer, List<WorkOrderItem>> itemMap = loadItems();
|
||||
List<WorkOrderDetails> result = new ArrayList<>();
|
||||
String sql = "SELECT wo.id, wo.note, wo.created_at, p.name AS person_name, " +
|
||||
"v.brand, v.model, v.plate FROM work_order wo " +
|
||||
"JOIN vehicle v ON wo.vehicle_id = v.id " +
|
||||
"JOIN person p ON v.person_id = p.id ORDER BY wo.created_at DESC";
|
||||
try (Connection con = Database.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(sql);
|
||||
ResultSet rs = ps.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
int id = rs.getInt("id");
|
||||
List<WorkOrderItem> items = itemMap.getOrDefault(id, new ArrayList<>());
|
||||
BigDecimal total = items.stream()
|
||||
.map(WorkOrderItem::getTotalPrice)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
result.add(new WorkOrderDetails(
|
||||
id,
|
||||
rs.getString("person_name"),
|
||||
rs.getString("brand") + " " + rs.getString("model") + " (" + rs.getString("plate") + ")",
|
||||
rs.getTimestamp("created_at").toLocalDateTime(),
|
||||
rs.getString("note"),
|
||||
items,
|
||||
total
|
||||
));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Map<Integer, List<WorkOrderItem>> loadItems() throws SQLException {
|
||||
Map<Integer, List<WorkOrderItem>> map = new HashMap<>();
|
||||
String sql = "SELECT woi.id, woi.work_order_id, woi.quantity, si.id AS service_id, si.title, si.price " +
|
||||
"FROM work_order_item woi JOIN service_item si ON woi.service_item_id = si.id";
|
||||
try (Connection con = Database.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(sql);
|
||||
ResultSet rs = ps.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
ServiceItem item = new ServiceItem(rs.getInt("service_id"), rs.getString("title"), rs.getBigDecimal("price"));
|
||||
WorkOrderItem orderItem = new WorkOrderItem(rs.getInt("id"), rs.getInt("work_order_id"), item, rs.getInt("quantity"));
|
||||
map.computeIfAbsent(orderItem.getWorkOrderId(), id -> new ArrayList<>()).add(orderItem);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package de.antco.projekt.exporters;
|
||||
|
||||
import de.antco.projekt.model.Person;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.FileWriter;
|
||||
import java.util.List;
|
||||
|
||||
public class CsvPersonExporter implements IExporter<Person> {
|
||||
|
||||
@Override
|
||||
public void exportData(List<Person> data, String path) throws Exception {
|
||||
try (BufferedWriter bw = new BufferedWriter(new FileWriter(path))) {
|
||||
for (Person p : data) {
|
||||
bw.write(p.getName() + ";" + p.getPhone());
|
||||
bw.newLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
src/main/java/de/antco/projekt/exporters/IExporter.java
Normal file
7
src/main/java/de/antco/projekt/exporters/IExporter.java
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
package de.antco.projekt.exporters;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IExporter<T> {
|
||||
void exportData(List<T> data, String path) throws Exception;
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package de.antco.projekt.importers;
|
||||
|
||||
import de.antco.projekt.model.Person;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CsvPersonImporter implements IImporter<Person> {
|
||||
|
||||
@Override
|
||||
public List<Person> importData(String path) throws Exception {
|
||||
List<Person> result = new ArrayList<>();
|
||||
try (BufferedReader br = new BufferedReader(new FileReader(path))) {
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
if (line.isBlank()) continue;
|
||||
String[] parts = line.split(";");
|
||||
if (parts.length >= 2) {
|
||||
String name = parts[0].trim();
|
||||
String phone = parts[1].trim();
|
||||
// ID 0 as placeholder, will be ignored/regenerated on DB insert
|
||||
result.add(new Person(0, name, phone));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
7
src/main/java/de/antco/projekt/importers/IImporter.java
Normal file
7
src/main/java/de/antco/projekt/importers/IImporter.java
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
package de.antco.projekt.importers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IImporter<T> {
|
||||
List<T> importData(String path) throws Exception;
|
||||
}
|
||||
5
src/main/java/de/antco/projekt/loggers/ILogger.java
Normal file
5
src/main/java/de/antco/projekt/loggers/ILogger.java
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
package de.antco.projekt.loggers;
|
||||
|
||||
public interface ILogger {
|
||||
void Log();
|
||||
}
|
||||
30
src/main/java/de/antco/projekt/model/Person.java
Normal file
30
src/main/java/de/antco/projekt/model/Person.java
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package de.antco.projekt.model;
|
||||
|
||||
public class Person {
|
||||
private final int id;
|
||||
private final String name;
|
||||
private final String phone;
|
||||
|
||||
public Person(int id, String name, String phone) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return id + ": " + name + " (" + phone + ")";
|
||||
}
|
||||
}
|
||||
32
src/main/java/de/antco/projekt/model/ServiceItem.java
Normal file
32
src/main/java/de/antco/projekt/model/ServiceItem.java
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package de.antco.projekt.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class ServiceItem {
|
||||
private final int id;
|
||||
private final String title;
|
||||
private final BigDecimal price;
|
||||
|
||||
public ServiceItem(int id, String title, BigDecimal price) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return id + " - " + title + " (" + price + " €)";
|
||||
}
|
||||
}
|
||||
42
src/main/java/de/antco/projekt/model/Vehicle.java
Normal file
42
src/main/java/de/antco/projekt/model/Vehicle.java
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
package de.antco.projekt.model;
|
||||
|
||||
public class Vehicle {
|
||||
private final int id;
|
||||
private final int personId;
|
||||
private final String brand;
|
||||
private final String model;
|
||||
private final String plate;
|
||||
|
||||
public Vehicle(int id, int personId, String brand, String model, String plate) {
|
||||
this.id = id;
|
||||
this.personId = personId;
|
||||
this.brand = brand;
|
||||
this.model = model;
|
||||
this.plate = plate;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getPersonId() {
|
||||
return personId;
|
||||
}
|
||||
|
||||
public String getBrand() {
|
||||
return brand;
|
||||
}
|
||||
|
||||
public String getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public String getPlate() {
|
||||
return plate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return id + " - " + brand + " " + model + " | " + plate;
|
||||
}
|
||||
}
|
||||
33
src/main/java/de/antco/projekt/model/WorkOrder.java
Normal file
33
src/main/java/de/antco/projekt/model/WorkOrder.java
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
package de.antco.projekt.model;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class WorkOrder {
|
||||
private final int id;
|
||||
private final int vehicleId;
|
||||
private final String note;
|
||||
private final LocalDateTime createdAt;
|
||||
|
||||
public WorkOrder(int id, int vehicleId, String note, LocalDateTime createdAt) {
|
||||
this.id = id;
|
||||
this.vehicleId = vehicleId;
|
||||
this.note = note;
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getVehicleId() {
|
||||
return vehicleId;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
}
|
||||
54
src/main/java/de/antco/projekt/model/WorkOrderDetails.java
Normal file
54
src/main/java/de/antco/projekt/model/WorkOrderDetails.java
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
package de.antco.projekt.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public class WorkOrderDetails {
|
||||
private final int orderId;
|
||||
private final String personName;
|
||||
private final String vehicleText;
|
||||
private final LocalDateTime createdAt;
|
||||
private final String note;
|
||||
private final List<WorkOrderItem> items;
|
||||
private final BigDecimal total;
|
||||
|
||||
public WorkOrderDetails(int orderId, String personName, String vehicleText,
|
||||
LocalDateTime createdAt, String note, List<WorkOrderItem> items, BigDecimal total) {
|
||||
this.orderId = orderId;
|
||||
this.personName = personName;
|
||||
this.vehicleText = vehicleText;
|
||||
this.createdAt = createdAt;
|
||||
this.note = note;
|
||||
this.items = items;
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public int getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public String getPersonName() {
|
||||
return personName;
|
||||
}
|
||||
|
||||
public String getVehicleText() {
|
||||
return vehicleText;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public List<WorkOrderItem> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public BigDecimal getTotal() {
|
||||
return total;
|
||||
}
|
||||
}
|
||||
37
src/main/java/de/antco/projekt/model/WorkOrderItem.java
Normal file
37
src/main/java/de/antco/projekt/model/WorkOrderItem.java
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package de.antco.projekt.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class WorkOrderItem {
|
||||
private final int id;
|
||||
private final int workOrderId;
|
||||
private final ServiceItem serviceItem;
|
||||
private final int quantity;
|
||||
|
||||
public WorkOrderItem(int id, int workOrderId, ServiceItem serviceItem, int quantity) {
|
||||
this.id = id;
|
||||
this.workOrderId = workOrderId;
|
||||
this.serviceItem = serviceItem;
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getWorkOrderId() {
|
||||
return workOrderId;
|
||||
}
|
||||
|
||||
public ServiceItem getServiceItem() {
|
||||
return serviceItem;
|
||||
}
|
||||
|
||||
public int getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalPrice() {
|
||||
return serviceItem.getPrice().multiply(BigDecimal.valueOf(quantity));
|
||||
}
|
||||
}
|
||||
67
src/main/java/de/antco/projekt/service/WorkshopService.java
Normal file
67
src/main/java/de/antco/projekt/service/WorkshopService.java
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
package de.antco.projekt.service;
|
||||
|
||||
import de.antco.projekt.dao.PersonDao;
|
||||
import de.antco.projekt.dao.SchemaCreator;
|
||||
import de.antco.projekt.dao.ServiceItemDao;
|
||||
import de.antco.projekt.dao.VehicleDao;
|
||||
import de.antco.projekt.dao.WorkOrderDao;
|
||||
import de.antco.projekt.model.Person;
|
||||
import de.antco.projekt.model.ServiceItem;
|
||||
import de.antco.projekt.model.Vehicle;
|
||||
import de.antco.projekt.model.WorkOrderDetails;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class WorkshopService {
|
||||
private final PersonDao personDao = new PersonDao();
|
||||
private final VehicleDao vehicleDao = new VehicleDao();
|
||||
private final ServiceItemDao serviceItemDao = new ServiceItemDao();
|
||||
private final WorkOrderDao workOrderDao = new WorkOrderDao();
|
||||
|
||||
public WorkshopService() {
|
||||
try {
|
||||
new SchemaCreator().ensureSchema();
|
||||
serviceItemDao.seedDefaultItems();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException("Setup fehlgeschlagen: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public Person createPerson(String name, String phone) throws SQLException {
|
||||
return personDao.create(name, phone);
|
||||
}
|
||||
|
||||
public List<Person> listPersons() throws SQLException {
|
||||
return personDao.findAll();
|
||||
}
|
||||
|
||||
public Vehicle createVehicle(int personId, String brand, String model, String plate) throws SQLException {
|
||||
return vehicleDao.create(personId, brand, model, plate);
|
||||
}
|
||||
|
||||
public List<Vehicle> listVehicles(int personId) throws SQLException {
|
||||
return vehicleDao.findByPerson(personId);
|
||||
}
|
||||
|
||||
public List<ServiceItem> listServiceItems() throws SQLException {
|
||||
return serviceItemDao.findAll();
|
||||
}
|
||||
|
||||
public int createWorkOrder(int vehicleId, String note, Map<Integer, Integer> items) throws SQLException {
|
||||
return workOrderDao.createWorkOrder(vehicleId, note, items);
|
||||
}
|
||||
|
||||
public List<WorkOrderDetails> listWorkOrders() throws SQLException {
|
||||
return workOrderDao.fetchAllDetails();
|
||||
}
|
||||
|
||||
public Person findPerson(int id) throws SQLException {
|
||||
return personDao.findById(id);
|
||||
}
|
||||
|
||||
public Vehicle findVehicle(int id) throws SQLException {
|
||||
return vehicleDao.findById(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package de.antco.projekt.exporters;
|
||||
|
||||
import de.antco.projekt.model.Person;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class CsvPersonExporterTest {
|
||||
|
||||
@Test
|
||||
void testExport() throws Exception {
|
||||
File tempFile = File.createTempFile("export_test", ".csv");
|
||||
tempFile.deleteOnExit();
|
||||
|
||||
List<Person> persons = Arrays.asList(
|
||||
new Person(1, "Max", "123"),
|
||||
new Person(2, "Moritz", "456")
|
||||
);
|
||||
|
||||
CsvPersonExporter exporter = new CsvPersonExporter();
|
||||
exporter.exportData(persons, tempFile.getAbsolutePath());
|
||||
|
||||
try (BufferedReader br = new BufferedReader(new FileReader(tempFile))) {
|
||||
assertEquals("Max;123", br.readLine());
|
||||
assertEquals("Moritz;456", br.readLine());
|
||||
assertNull(br.readLine());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package de.antco.projekt.importers;
|
||||
|
||||
import de.antco.projekt.model.Person;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.util.List;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class CsvPersonImporterTest {
|
||||
|
||||
@Test
|
||||
void testImport() throws Exception {
|
||||
File tempFile = File.createTempFile("import_test", ".csv");
|
||||
tempFile.deleteOnExit();
|
||||
|
||||
try (FileWriter writer = new FileWriter(tempFile)) {
|
||||
writer.write("Max Mustermann;0123456789\n");
|
||||
writer.write("Erika Musterfrau;9876543210\n");
|
||||
}
|
||||
|
||||
CsvPersonImporter importer = new CsvPersonImporter();
|
||||
List<Person> persons = importer.importData(tempFile.getAbsolutePath());
|
||||
|
||||
assertEquals(2, persons.size());
|
||||
assertEquals("Max Mustermann", persons.get(0).getName());
|
||||
assertEquals("0123456789", persons.get(0).getPhone());
|
||||
assertEquals("Erika Musterfrau", persons.get(1).getName());
|
||||
assertEquals("9876543210", persons.get(1).getPhone());
|
||||
}
|
||||
}
|
||||
BIN
target/classes/de/antco/projekt/App.class
Normal file
BIN
target/classes/de/antco/projekt/App.class
Normal file
Binary file not shown.
BIN
target/classes/de/antco/projekt/ConsoleUi.class
Normal file
BIN
target/classes/de/antco/projekt/ConsoleUi.class
Normal file
Binary file not shown.
BIN
target/classes/de/antco/projekt/Database.class
Normal file
BIN
target/classes/de/antco/projekt/Database.class
Normal file
Binary file not shown.
BIN
target/classes/de/antco/projekt/Exporters/IExporter.class
Normal file
BIN
target/classes/de/antco/projekt/Exporters/IExporter.class
Normal file
Binary file not shown.
BIN
target/classes/de/antco/projekt/Importers/IImporter.class
Normal file
BIN
target/classes/de/antco/projekt/Importers/IImporter.class
Normal file
Binary file not shown.
BIN
target/classes/de/antco/projekt/dao/PersonDao.class
Normal file
BIN
target/classes/de/antco/projekt/dao/PersonDao.class
Normal file
Binary file not shown.
BIN
target/classes/de/antco/projekt/dao/SchemaCreator.class
Normal file
BIN
target/classes/de/antco/projekt/dao/SchemaCreator.class
Normal file
Binary file not shown.
BIN
target/classes/de/antco/projekt/dao/ServiceItemDao.class
Normal file
BIN
target/classes/de/antco/projekt/dao/ServiceItemDao.class
Normal file
Binary file not shown.
BIN
target/classes/de/antco/projekt/dao/VehicleDao.class
Normal file
BIN
target/classes/de/antco/projekt/dao/VehicleDao.class
Normal file
Binary file not shown.
BIN
target/classes/de/antco/projekt/dao/WorkOrderDao.class
Normal file
BIN
target/classes/de/antco/projekt/dao/WorkOrderDao.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
target/classes/de/antco/projekt/exporters/IExporter.class
Normal file
BIN
target/classes/de/antco/projekt/exporters/IExporter.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
target/classes/de/antco/projekt/importers/IImporter.class
Normal file
BIN
target/classes/de/antco/projekt/importers/IImporter.class
Normal file
Binary file not shown.
BIN
target/classes/de/antco/projekt/loggers/ILogger.class
Normal file
BIN
target/classes/de/antco/projekt/loggers/ILogger.class
Normal file
Binary file not shown.
BIN
target/classes/de/antco/projekt/model/Person.class
Normal file
BIN
target/classes/de/antco/projekt/model/Person.class
Normal file
Binary file not shown.
BIN
target/classes/de/antco/projekt/model/ServiceItem.class
Normal file
BIN
target/classes/de/antco/projekt/model/ServiceItem.class
Normal file
Binary file not shown.
BIN
target/classes/de/antco/projekt/model/Vehicle.class
Normal file
BIN
target/classes/de/antco/projekt/model/Vehicle.class
Normal file
Binary file not shown.
BIN
target/classes/de/antco/projekt/model/WorkOrder.class
Normal file
BIN
target/classes/de/antco/projekt/model/WorkOrder.class
Normal file
Binary file not shown.
BIN
target/classes/de/antco/projekt/model/WorkOrderDetails.class
Normal file
BIN
target/classes/de/antco/projekt/model/WorkOrderDetails.class
Normal file
Binary file not shown.
BIN
target/classes/de/antco/projekt/model/WorkOrderItem.class
Normal file
BIN
target/classes/de/antco/projekt/model/WorkOrderItem.class
Normal file
Binary file not shown.
BIN
target/classes/de/antco/projekt/service/WorkshopService.class
Normal file
BIN
target/classes/de/antco/projekt/service/WorkshopService.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
target/jdbc-konsolen-projekt-1.0-SNAPSHOT.jar
Normal file
BIN
target/jdbc-konsolen-projekt-1.0-SNAPSHOT.jar
Normal file
Binary file not shown.
5
target/maven-archiver/pom.properties
Normal file
5
target/maven-archiver/pom.properties
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Dec 11 10:07:13 CET 2025
|
||||
artifactId=jdbc-konsolen-projekt
|
||||
groupId=de.antco
|
||||
version=1.0-SNAPSHOT
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
de/antco/projekt/model/Vehicle.class
|
||||
de/antco/projekt/dao/PersonDao.class
|
||||
de/antco/projekt/importers/IImporter.class
|
||||
de/antco/projekt/dao/SchemaCreator.class
|
||||
de/antco/projekt/exporters/CsvPersonExporter.class
|
||||
de/antco/projekt/importers/CsvPersonImporter.class
|
||||
de/antco/projekt/model/WorkOrderDetails.class
|
||||
de/antco/projekt/model/WorkOrderItem.class
|
||||
de/antco/projekt/exporters/IExporter.class
|
||||
de/antco/projekt/dao/WorkOrderDao.class
|
||||
de/antco/projekt/dao/ServiceItemDao.class
|
||||
de/antco/projekt/service/WorkshopService.class
|
||||
de/antco/projekt/dao/VehicleDao.class
|
||||
de/antco/projekt/Database.class
|
||||
de/antco/projekt/App.class
|
||||
de/antco/projekt/model/Person.class
|
||||
de/antco/projekt/model/ServiceItem.class
|
||||
de/antco/projekt/model/WorkOrder.class
|
||||
de/antco/projekt/ConsoleUi.class
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/dao/VehicleDao.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/dao/WorkOrderDao.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/Database.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/importers/IImporter.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/loggers/ILogger.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/importers/CsvPersonImporter.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/ConsoleUi.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/model/Person.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/App.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/exporters/IExporter.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/dao/ServiceItemDao.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/model/ServiceItem.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/model/WorkOrder.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/model/WorkOrderItem.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/exporters/CsvPersonExporter.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/model/Vehicle.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/service/WorkshopService.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/dao/SchemaCreator.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/model/WorkOrderDetails.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/main/java/de/antco/projekt/dao/PersonDao.java
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
de/antco/projekt/exporters/CsvPersonExporterTest.class
|
||||
de/antco/projekt/importers/CsvPersonImporterTest.class
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
/config/workspace/Schule/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/exporters/CsvPersonExporterTest.java
|
||||
/config/workspace/Schule/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/importers/CsvPersonImporterTest.java
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd" version="3.0" name="de.antco.projekt.exporters.CsvPersonExporterTest" time="0.235" tests="1" errors="0" skipped="0" failures="0">
|
||||
<properties>
|
||||
<property name="java.specification.version" value="21"/>
|
||||
<property name="sun.jnu.encoding" value="UTF-8"/>
|
||||
<property name="java.class.path" value="/config/workspace/Schule/jdbc_konsolen_projekt/target/test-classes:/config/workspace/Schule/jdbc_konsolen_projekt/target/classes:/config/.m2/repository/org/postgresql/postgresql/42.7.3/postgresql-42.7.3.jar:/config/.m2/repository/org/checkerframework/checker-qual/3.42.0/checker-qual-3.42.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0.jar:/config/.m2/repository/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0.jar:/config/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0.jar:"/>
|
||||
<property name="java.vm.vendor" value="Ubuntu"/>
|
||||
<property name="sun.arch.data.model" value="64"/>
|
||||
<property name="java.vendor.url" value="https://ubuntu.com/"/>
|
||||
<property name="os.name" value="Linux"/>
|
||||
<property name="java.vm.specification.version" value="21"/>
|
||||
<property name="sun.java.launcher" value="SUN_STANDARD"/>
|
||||
<property name="user.country" value="US"/>
|
||||
<property name="sun.boot.library.path" value="/usr/lib/jvm/java-21-openjdk-amd64/lib"/>
|
||||
<property name="sun.java.command" value="/config/workspace/Schule/jdbc_konsolen_projekt/target/surefire/surefirebooter-20251211104402476_3.jar /config/workspace/Schule/jdbc_konsolen_projekt/target/surefire 2025-12-11T10-44-01_307-jvmRun1 surefire-20251211104402476_1tmp surefire_0-20251211104402476_2tmp"/>
|
||||
<property name="jdk.debug" value="release"/>
|
||||
<property name="surefire.test.class.path" value="/config/workspace/Schule/jdbc_konsolen_projekt/target/test-classes:/config/workspace/Schule/jdbc_konsolen_projekt/target/classes:/config/.m2/repository/org/postgresql/postgresql/42.7.3/postgresql-42.7.3.jar:/config/.m2/repository/org/checkerframework/checker-qual/3.42.0/checker-qual-3.42.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0.jar:/config/.m2/repository/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0.jar:/config/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0.jar:"/>
|
||||
<property name="sun.cpu.endian" value="little"/>
|
||||
<property name="user.home" value="/config"/>
|
||||
<property name="user.language" value="en"/>
|
||||
<property name="java.specification.vendor" value="Oracle Corporation"/>
|
||||
<property name="java.version.date" value="2025-10-21"/>
|
||||
<property name="java.home" value="/usr/lib/jvm/java-21-openjdk-amd64"/>
|
||||
<property name="file.separator" value="/"/>
|
||||
<property name="basedir" value="/config/workspace/Schule/jdbc_konsolen_projekt"/>
|
||||
<property name="java.vm.compressedOopsMode" value="Zero based"/>
|
||||
<property name="line.separator" value=" "/>
|
||||
<property name="java.specification.name" value="Java Platform API Specification"/>
|
||||
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
|
||||
<property name="surefire.real.class.path" value="/config/workspace/Schule/jdbc_konsolen_projekt/target/surefire/surefirebooter-20251211104402476_3.jar"/>
|
||||
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
|
||||
<property name="java.runtime.version" value="21.0.9+10-Ubuntu-124.04"/>
|
||||
<property name="user.name" value="abc"/>
|
||||
<property name="stdout.encoding" value="UTF-8"/>
|
||||
<property name="path.separator" value=":"/>
|
||||
<property name="os.version" value="6.1.0-41-cloud-amd64"/>
|
||||
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
|
||||
<property name="file.encoding" value="UTF-8"/>
|
||||
<property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/>
|
||||
<property name="localRepository" value="/config/.m2/repository"/>
|
||||
<property name="java.vendor.url.bug" value="https://bugs.launchpad.net/ubuntu/+source/openjdk-21"/>
|
||||
<property name="java.io.tmpdir" value="/tmp"/>
|
||||
<property name="java.version" value="21.0.9"/>
|
||||
<property name="user.dir" value="/config/workspace/Schule/jdbc_konsolen_projekt"/>
|
||||
<property name="os.arch" value="amd64"/>
|
||||
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
|
||||
<property name="native.encoding" value="UTF-8"/>
|
||||
<property name="java.library.path" value="/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib"/>
|
||||
<property name="java.vm.info" value="mixed mode, sharing"/>
|
||||
<property name="stderr.encoding" value="UTF-8"/>
|
||||
<property name="java.vendor" value="Ubuntu"/>
|
||||
<property name="java.vm.version" value="21.0.9+10-Ubuntu-124.04"/>
|
||||
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
|
||||
<property name="java.class.version" value="65.0"/>
|
||||
</properties>
|
||||
<testcase name="testExport" classname="de.antco.projekt.exporters.CsvPersonExporterTest" time="0.181"/>
|
||||
</testsuite>
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd" version="3.0" name="de.antco.projekt.importers.CsvPersonImporterTest" time="0.013" tests="1" errors="0" skipped="0" failures="0">
|
||||
<properties>
|
||||
<property name="java.specification.version" value="21"/>
|
||||
<property name="sun.jnu.encoding" value="UTF-8"/>
|
||||
<property name="java.class.path" value="/config/workspace/Schule/jdbc_konsolen_projekt/target/test-classes:/config/workspace/Schule/jdbc_konsolen_projekt/target/classes:/config/.m2/repository/org/postgresql/postgresql/42.7.3/postgresql-42.7.3.jar:/config/.m2/repository/org/checkerframework/checker-qual/3.42.0/checker-qual-3.42.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0.jar:/config/.m2/repository/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0.jar:/config/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0.jar:"/>
|
||||
<property name="java.vm.vendor" value="Ubuntu"/>
|
||||
<property name="sun.arch.data.model" value="64"/>
|
||||
<property name="java.vendor.url" value="https://ubuntu.com/"/>
|
||||
<property name="os.name" value="Linux"/>
|
||||
<property name="java.vm.specification.version" value="21"/>
|
||||
<property name="sun.java.launcher" value="SUN_STANDARD"/>
|
||||
<property name="user.country" value="US"/>
|
||||
<property name="sun.boot.library.path" value="/usr/lib/jvm/java-21-openjdk-amd64/lib"/>
|
||||
<property name="sun.java.command" value="/config/workspace/Schule/jdbc_konsolen_projekt/target/surefire/surefirebooter-20251211104402476_3.jar /config/workspace/Schule/jdbc_konsolen_projekt/target/surefire 2025-12-11T10-44-01_307-jvmRun1 surefire-20251211104402476_1tmp surefire_0-20251211104402476_2tmp"/>
|
||||
<property name="jdk.debug" value="release"/>
|
||||
<property name="surefire.test.class.path" value="/config/workspace/Schule/jdbc_konsolen_projekt/target/test-classes:/config/workspace/Schule/jdbc_konsolen_projekt/target/classes:/config/.m2/repository/org/postgresql/postgresql/42.7.3/postgresql-42.7.3.jar:/config/.m2/repository/org/checkerframework/checker-qual/3.42.0/checker-qual-3.42.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0.jar:/config/.m2/repository/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0.jar:/config/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0.jar:"/>
|
||||
<property name="sun.cpu.endian" value="little"/>
|
||||
<property name="user.home" value="/config"/>
|
||||
<property name="user.language" value="en"/>
|
||||
<property name="java.specification.vendor" value="Oracle Corporation"/>
|
||||
<property name="java.version.date" value="2025-10-21"/>
|
||||
<property name="java.home" value="/usr/lib/jvm/java-21-openjdk-amd64"/>
|
||||
<property name="file.separator" value="/"/>
|
||||
<property name="basedir" value="/config/workspace/Schule/jdbc_konsolen_projekt"/>
|
||||
<property name="java.vm.compressedOopsMode" value="Zero based"/>
|
||||
<property name="line.separator" value=" "/>
|
||||
<property name="java.specification.name" value="Java Platform API Specification"/>
|
||||
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
|
||||
<property name="surefire.real.class.path" value="/config/workspace/Schule/jdbc_konsolen_projekt/target/surefire/surefirebooter-20251211104402476_3.jar"/>
|
||||
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
|
||||
<property name="java.runtime.version" value="21.0.9+10-Ubuntu-124.04"/>
|
||||
<property name="user.name" value="abc"/>
|
||||
<property name="stdout.encoding" value="UTF-8"/>
|
||||
<property name="path.separator" value=":"/>
|
||||
<property name="os.version" value="6.1.0-41-cloud-amd64"/>
|
||||
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
|
||||
<property name="file.encoding" value="UTF-8"/>
|
||||
<property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/>
|
||||
<property name="localRepository" value="/config/.m2/repository"/>
|
||||
<property name="java.vendor.url.bug" value="https://bugs.launchpad.net/ubuntu/+source/openjdk-21"/>
|
||||
<property name="java.io.tmpdir" value="/tmp"/>
|
||||
<property name="java.version" value="21.0.9"/>
|
||||
<property name="user.dir" value="/config/workspace/Schule/jdbc_konsolen_projekt"/>
|
||||
<property name="os.arch" value="amd64"/>
|
||||
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
|
||||
<property name="native.encoding" value="UTF-8"/>
|
||||
<property name="java.library.path" value="/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib"/>
|
||||
<property name="java.vm.info" value="mixed mode, sharing"/>
|
||||
<property name="stderr.encoding" value="UTF-8"/>
|
||||
<property name="java.vendor" value="Ubuntu"/>
|
||||
<property name="java.vm.version" value="21.0.9+10-Ubuntu-124.04"/>
|
||||
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
|
||||
<property name="java.class.version" value="65.0"/>
|
||||
</properties>
|
||||
<testcase name="testImport" classname="de.antco.projekt.importers.CsvPersonImporterTest" time="0.005"/>
|
||||
</testsuite>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
-------------------------------------------------------------------------------
|
||||
Test set: de.antco.projekt.exporters.CsvPersonExporterTest
|
||||
-------------------------------------------------------------------------------
|
||||
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.235 s -- in de.antco.projekt.exporters.CsvPersonExporterTest
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
-------------------------------------------------------------------------------
|
||||
Test set: de.antco.projekt.importers.CsvPersonImporterTest
|
||||
-------------------------------------------------------------------------------
|
||||
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.013 s -- in de.antco.projekt.importers.CsvPersonImporterTest
|
||||
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue