Files
Patrick Plate 1a0a56a626 chore(java): consolidate mss-failsafe to single canonical copy
Replace the stale multi-module java/mss-failsafe skeleton (old user-management
prototype) with the active single-module machine-safety inspection app that was
living in its own standalone repo at the repo root.

- Remove old java/mss-failsafe/ multi-module tree (mss, userdata, userManagement,
  mssfailsafe.datalayer, mssfailsafeWeblayer) incl. committed build artifacts
- Add the active app (PrimeFaces 11 / JSF 2.3 / Hibernate 5.6 / iText / POI)
  flattened into java/mss-failsafe/ as the only mss-failsafe in git
- Working tree captured = master tip 2a142b5 + in-progress uncommitted work
  (incl. .github/*.instructions.md AI-context files)
- Archive the standalone repo's 33-commit history in GIT_HISTORY_ARCHIVE.md
  since its .git was not migrated

This is the source of truth / base for the upcoming upgraded rewrite.
2026-06-13 19:55:28 +02:00

73 lines
2.7 KiB
Markdown
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# How-To: Projekt erweitern
## Neuer Fachbereich (Beispiel: InspectionReport)
### 1. Entity anlegen
- Paket: `model.report`.
- Klasse: `InspectionReport extends AbstractEntity`.
- Felder: `date`, `inspector`, `machine`, `remarks`.
- Named Queries definieren (z.B. `FIND_BY_MACHINE`).
### 2. Manager
```java
@Stateless
@Named
public class InspectionReportManager extends AbstractManager<InspectionReport> {
@PersistenceContext(name = "pu_person")
EntityManager em;
public InspectionReportManager() { super(InspectionReport.class); }
@Override protected EntityManager getEntityManager() { return em; }
// Fachmethoden: findByMachine(Long id)
}
```
### 3. Controller
```java
@ViewScoped
@Named
public class InspectionReportController extends AbstractController<InspectionReport> {
@EJB InspectionReportManager reportManager;
@Inject MachineController machineController;
public InspectionReportController() { setSelected(new InspectionReport()); setCreated(new InspectionReport()); }
@Override protected AbstractManager<InspectionReport> getManager() { return reportManager; }
@Override public void clearEntries() { setSelected(new InspectionReport()); setCreated(new InspectionReport()); getEntities().clear(); }
public void saveReport(){ reportManager.save(getSelected()); successMessage(); }
}
```
### 4. UI Seite
- Pfad: `webapp/report/inspection.xhtml`.
- Binding: `#{inspectionReportController}`.
- Komponenten: Formular für Felder + Speichern Button.
### 5. Navigation
- Menüeintrag in globaler Navigationsstruktur (Tree oder Topbar) analog `createMachineMenu()` Ansatz.
### 6. Tests
- Persistenz Test: Speichern + Laden.
- Manager Fachmethode Test.
## Erweiterung vorhandener Funktionalität
- Beispiel: Neue PDF Sektion → Ergänze Hilfsmethode in `AbstractController` (sofern allgemein). Falls spezifisch für eine Domäne, eher Hilfsklasse im Domain-Paket.
## Konsistenz-Checkliste
- [ ] Entity extends `AbstractEntity`
- [ ] Manager extends `AbstractManager`
- [ ] Controller extends `AbstractController`
- [ ] Negative IDs für neue Objekte vor Persist (falls in Listen)
- [ ] Internationale Zeichen (UTF-8) POM setzt Encoding
- [ ] Logging bei Fehlern
## Deployment Hinweise
- Sicherstellen, dass neue Named Queries beim Serverstart verfügbar (Entity korrekt gescannt).
- Falls neue Ressourcen (Logos, Templates) → in `resources` pflegen.
## Typische Stolpersteine
- LazyInitializationException: Lösung `refresh(entity)` oder explizite Initialisierung im Manager.
- Doppelte Referenzen beim Klonen: IDs auf `null` setzen.
- Fehlende Transaktion: Sicherstellen `@Transactional` oder EJB Standard.
---
Aktualisiert: 2025-10-20