#785: Buchungssatz.java
projectforge-business/src/main/java/org/projectforge/reporting/Buchungssatz.java Java interface — accounting entry (booking record) contract for the reporting layer. Source: projectforge-business/src/main/java/org/projectforge/reporting/Buchungssatz.java 86 lines · 23 code · 43 comments · 20 blank
Defines the read-only contract for a single accounting entry (Buchungssatz) in financial reports. Implemented by BuchungssatzDO (JPA entity) and BuchungssatzImpl (reporting adapter). The interface is the Adapter pattern between the persistence layer (DO) and the reporting layer (BWA, Kost reports): it extracts only the fields needed for reporting, hiding JPA internals from report consumers.
Fields
| Method | Type | Purpose |
|---|
getId() | Long | Surrogate database key |
getYear() | Integer | Booking year |
getMonth() | Integer | Booking month (1-12) |
getFormattedMonth() | String | Month zero-padded (01-12) |
getSatznr() | Integer | Sequence number within month |
getDatum() | LocalDate | Booking date |
getBetrag() | BigDecimal | Monetary amount |
getSh() | SHType | Debit/Credit flag (Soll/Haben) |
Adapter Pattern
The interface sits between BuchungssatzDO (the JPA entity with Hibernate annotations, lazy-loading, and persistence concerns) and the reporting engines (ReportBwa, KostReportSenior). By defining a pure read-only interface, the reporting layer never touches JPA entities directly — it only sees this contract. This prevents accidental lazy-loading in report generation (which would cause LazyInitializationException outside a transaction) and decouples report logic from ORM specifics.
Key Commit: 4c04cfd65 — int→Long Migration
The getId() return type was changed from Integer to Long as part of the MAJOR id migration. This required updating all implementations (BuchungssatzDO, BuchungssatzImpl) and all report generators that called getId(). The interface acted as a contract boundary: changing the return type here forced a compiler-enforced update of all callers, preventing silent breakage.
Git History
868d6abb7 2025→2026 | 63081666f 2024→2025 | 4c04cfd65 MAJOR: int→Long migration | b6092df09 2023→2024 | a6a7aece4 Optimize imports | 57761f2a2 Remove unnecessary public keywords | 9456bbb6c Month→1-based Integer | 8c31eba2a Heavy migration Calendar/DateHolder | 9ebb88522 Initial commit
Key Commit: 9456bbb6c — Month 1-based
Changed month representation from 0-based (Calendar-style) to 1-based (human-readable). The getFormattedMonth() method was added to provide zero-padded strings ("01"–"12") for consistent display and sorting. This was part of a broader effort to eliminate 0-based month confusion across the codebase (affecting EmployeeSalary, VacationServiceImpl, AccountingRecord, and MonthlyEmployeeFilter).