Commit
parent
d73359ffc2
commit
576220c381
|
|
@ -98,7 +98,6 @@ public abstract class Dokument {
|
||||||
return String.format("%s{nummer='%s', kundenId=%d, datum=%s, status=%s}",
|
return String.format("%s{nummer='%s', kundenId=%d, datum=%s, status=%s}",
|
||||||
getClass().getSimpleName(), dokumentNummer, kundenId, datum, status);
|
getClass().getSimpleName(), dokumentNummer, kundenId, datum, status);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// === Alias-Methoden für GUI-Kompatibilität ===
|
// === Alias-Methoden für GUI-Kompatibilität ===
|
||||||
|
|
||||||
|
|
@ -129,3 +128,4 @@ public abstract class Dokument {
|
||||||
case RECHNUNG -> "Rechnung";
|
case RECHNUNG -> "Rechnung";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
@ -68,10 +68,9 @@ public class DokumentPosition {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("DokumentPosition{produktId=%d, bezeichnung='%s', menge=%d, " +
|
return String.format("DokumentPosition{produktId=%d, bezeichnung='%s', menge=%d, " +
|
||||||
"einzelpreisNetto=%s, mwstSatz=%s}",
|
"einzelpreisNetto=%s, mwstSatz=%s}",
|
||||||
produktId, bezeichnungSnapshot, menge, einzelpreisNettoSnapshot, mwstSatzSnapshot);
|
produktId, bezeichnungSnapshot, menge, einzelpreisNettoSnapshot, mwstSatzSnapshot);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// === Alias-Methoden für GUI-Kompatibilität ===
|
// === Alias-Methoden für GUI-Kompatibilität ===
|
||||||
|
|
||||||
|
|
@ -91,3 +90,4 @@ public class DokumentPosition {
|
||||||
|
|
||||||
/** Alias für getNettoGesamt() – GUI-Kompatibilität. */
|
/** Alias für getNettoGesamt() – GUI-Kompatibilität. */
|
||||||
public BigDecimal getSumme() { return getNettoGesamt(); }
|
public BigDecimal getSumme() { return getNettoGesamt(); }
|
||||||
|
}
|
||||||
|
|
@ -74,7 +74,6 @@ public interface DokumentRepository {
|
||||||
* @return die höchste laufende Nummer oder 0 wenn noch keine existiert
|
* @return die höchste laufende Nummer oder 0 wenn noch keine existiert
|
||||||
*/
|
*/
|
||||||
int findMaxLaufendeNummer(String praefix, int jahr);
|
int findMaxLaufendeNummer(String praefix, int jahr);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gibt alle gespeicherten Dokumente zurück (für die Listenansicht in der GUI).
|
* Gibt alle gespeicherten Dokumente zurück (für die Listenansicht in der GUI).
|
||||||
|
|
@ -91,3 +90,4 @@ public interface DokumentRepository {
|
||||||
* @return true wenn gelöscht, false wenn nicht gefunden
|
* @return true wenn gelöscht, false wenn nicht gefunden
|
||||||
*/
|
*/
|
||||||
boolean delete(String nummer);
|
boolean delete(String nummer);
|
||||||
|
}
|
||||||
|
|
@ -94,7 +94,6 @@ public class InMemoryDokumentRepository implements DokumentRepository {
|
||||||
public void clear() {
|
public void clear() {
|
||||||
store.clear();
|
store.clear();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Dokument> findAll() {
|
public List<Dokument> findAll() {
|
||||||
|
|
@ -105,3 +104,4 @@ public class InMemoryDokumentRepository implements DokumentRepository {
|
||||||
public boolean delete(String nummer) {
|
public boolean delete(String nummer) {
|
||||||
return store.remove(nummer) != null;
|
return store.remove(nummer) != null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
@ -49,8 +49,8 @@ public class ProduktPanel extends JPanel {
|
||||||
public ProduktPanel(MainFrame mainFrame) {
|
public ProduktPanel(MainFrame mainFrame) {
|
||||||
this.mainFrame = mainFrame;
|
this.mainFrame = mainFrame;
|
||||||
this.productService = new ProductService(
|
this.productService = new ProductService(
|
||||||
new ProductRepository(),
|
new ProductRepository(),
|
||||||
createDummyDokumentRepository()
|
createDummyDokumentRepository()
|
||||||
);
|
);
|
||||||
setLayout(new BorderLayout(8, 8));
|
setLayout(new BorderLayout(8, 8));
|
||||||
setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
|
setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
|
||||||
|
|
@ -192,9 +192,9 @@ public class ProduktPanel extends JPanel {
|
||||||
tableModel.setRowCount(0);
|
tableModel.setRowCount(0);
|
||||||
for (Product p : liste) {
|
for (Product p : liste) {
|
||||||
tableModel.addRow(new Object[]{
|
tableModel.addRow(new Object[]{
|
||||||
p.getProductId(),
|
p.getProductId(),
|
||||||
p.getBezeichnung(),
|
p.getBezeichnung(),
|
||||||
p.getEinzelpreisNetto() + " €"
|
p.getEinzelpreisNetto() + " €"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -267,12 +267,12 @@ public class ProduktPanel extends JPanel {
|
||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
|
|
||||||
Product p = new Product(
|
Product p = new Product(
|
||||||
txtProduktId.getText().trim(),
|
txtProduktId.getText().trim(),
|
||||||
bezeichnung,
|
bezeichnung,
|
||||||
preis,
|
preis,
|
||||||
(MwstSatz) cmbMwst.getSelectedItem(),
|
(MwstSatz) cmbMwst.getSelectedItem(),
|
||||||
txtBeschreibung.getText().trim(),
|
txtBeschreibung.getText().trim(),
|
||||||
txtKategorie.getText().trim()
|
txtKategorie.getText().trim()
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -295,10 +295,10 @@ public class ProduktPanel extends JPanel {
|
||||||
|
|
||||||
// PHGUI07: Bestätigungsdialog
|
// PHGUI07: Bestätigungsdialog
|
||||||
int confirm = JOptionPane.showConfirmDialog(
|
int confirm = JOptionPane.showConfirmDialog(
|
||||||
this,
|
this,
|
||||||
"Produkt wirklich löschen?",
|
"Produkt wirklich löschen?",
|
||||||
"Löschen bestätigen",
|
"Löschen bestätigen",
|
||||||
JOptionPane.YES_NO_OPTION
|
JOptionPane.YES_NO_OPTION
|
||||||
);
|
);
|
||||||
if (confirm != JOptionPane.YES_OPTION) return;
|
if (confirm != JOptionPane.YES_OPTION) return;
|
||||||
|
|
||||||
|
|
@ -337,6 +337,8 @@ public class ProduktPanel extends JPanel {
|
||||||
public java.util.Optional<de.hsmannheim.faktura.dokumente.domain.Dokument> findByNummer(String n) { return java.util.Optional.empty(); }
|
public java.util.Optional<de.hsmannheim.faktura.dokumente.domain.Dokument> findByNummer(String n) { return java.util.Optional.empty(); }
|
||||||
public List<de.hsmannheim.faktura.dokumente.domain.Dokument> findByKunde(long id) { return List.of(); }
|
public List<de.hsmannheim.faktura.dokumente.domain.Dokument> findByKunde(long id) { return List.of(); }
|
||||||
public boolean existsFolgedokument(String q) { return false; }
|
public boolean existsFolgedokument(String q) { return false; }
|
||||||
|
public List<de.hsmannheim.faktura.dokumente.domain.Dokument> findAll() { return List.of(); }
|
||||||
|
public boolean delete(String n) { return false; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -34,6 +34,8 @@ public class ProductPerformanceTest {
|
||||||
@Override public java.util.Optional<de.hsmannheim.faktura.dokumente.domain.Dokument> findByNummer(String n) { return java.util.Optional.empty(); }
|
@Override public java.util.Optional<de.hsmannheim.faktura.dokumente.domain.Dokument> findByNummer(String n) { return java.util.Optional.empty(); }
|
||||||
@Override public List<de.hsmannheim.faktura.dokumente.domain.Dokument> findByKunde(long id) { return java.util.List.of(); }
|
@Override public List<de.hsmannheim.faktura.dokumente.domain.Dokument> findByKunde(long id) { return java.util.List.of(); }
|
||||||
@Override public boolean existsFolgedokument(String q) { return false; }
|
@Override public boolean existsFolgedokument(String q) { return false; }
|
||||||
|
@Override public List<de.hsmannheim.faktura.dokumente.domain.Dokument> findAll() { return java.util.List.of(); }
|
||||||
|
@Override public boolean delete(String n) { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
ProductService service = new ProductService(repo, dummyDocRepo);
|
ProductService service = new ProductService(repo, dummyDocRepo);
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,16 @@ public class ProductServiceTest {
|
||||||
public boolean existsFolgedokument(String quellDokumentNummer) {
|
public boolean existsFolgedokument(String quellDokumentNummer) {
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'existsFolgedokument'");
|
throw new UnsupportedOperationException("Unimplemented method 'existsFolgedokument'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Dokument> findAll() {
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'findAll'");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean delete(String nummer) {
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'delete'");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
productService = new ProductService(productRepository, dokumentRepository);
|
productService = new ProductService(productRepository, dokumentRepository);
|
||||||
|
|
@ -205,6 +215,14 @@ public class ProductServiceTest {
|
||||||
public boolean existsFolgedokument(String quellDokumentNummer) {
|
public boolean existsFolgedokument(String quellDokumentNummer) {
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'existsFolgedokument'");
|
throw new UnsupportedOperationException("Unimplemented method 'existsFolgedokument'");
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public List<Dokument> findAll() {
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'findAll'");
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean delete(String nummer) {
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'delete'");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ProductService serviceWithSperre = new ProductService(productRepository, mockRepo);
|
ProductService serviceWithSperre = new ProductService(productRepository, mockRepo);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue