#900: AuftragsPositionDO.kt

projectforge-business/src/main/kotlin/org/projectforge/business/fibu/AuftragsPositionDO.kt Type: JPA Entity (Hibernate Search indexed) · Purpose: Represents a single position (line item) within an order or proposal · Package: org.projectforge.business.fibu
Source path: projectforge-business/src/main/kotlin/org/projectforge/business/fibu/AuftragsPositionDO.kt 216 lines · 139 code · 50 comments · 27 blank
Core domain entity representing a line item within an AuftragDO (order/proposal). Each order can have multiple positions, uniquely identified by (auftrag_fk, number). Tracks financial data (net sum, person days), status, payment type, classification (art), and invoicing flags. Implements DisplayNameCapable and is fully indexed by Hibernate Search for full-text search capabilities.

Architecture & Design

Entity Metadata

AnnotationValue/Details
@EntityJPA entity
@IndexedHibernate Search full-text index
@TypeBindingHibernateSearchAuftragsPositionTypeBinder — custom binder for position-specific search
@ClassBridge(name = "position")Custom class bridge used for composite search field
@Tablet_fibu_auftrag_position with unique constraint (auftrag_fk, number)

Database Indexes

Index NameColumn
idx_fk_t_fibu_auftrag_position_auftrag_fkauftrag_fk
idx_fk_t_fibu_auftrag_position_task_fktask_fk

Named Queries

FIND_BY_ID = "AuftragPositionDO_FindById" — simple lookup by primary key.

Fields

FieldDB ColumnTypeDescription
numbernumber (not null)ShortPosition number within the order (e.g., 1, 2, 3…)
auftragauftrag_fk (FK, not null)AuftragDOParent order — @JsonIgnore to prevent circular serialization; @JsonSerialize(IdOnlySerializer) on web layer
tasktask_fk (FK, nullable)TaskDOAssociated project task, serialized as ID-only
artart (VARCHAR 30)AuftragsPositionsArt enumClassification: CHANGE_REQUEST, DAUERNDE_LEISTUNG, WARTUNG, NEUENTWICKLUNG
paymentTypepaymentType (VARCHAR 30)AuftragsPositionsPaymentType enumPayment model: FESTPREISPAKET, TIME_AND_MATERIALS, PAUSCHALE
forecastTypeforecast_type (VARCHAR 20)AuftragForecastType enumOverride for parent order's forecast type (current/following month)
statusstatus (VARCHAR 30)AuftragsStatus enumCurrent status (e.g., ABGESCHLOSSEN, IN_ERSTELLUNG)
titeltitel (VARCHAR 255)StringPosition title — @FullTextField for Hibernate Search
bemerkungbemerkung (4000)StringFree-text comment — @FullTextField
nettoSummenetto_summe (12,2)BigDecimalNet amount for this position — @GenericField
personDaysperson_days (12,2)BigDecimalPerson-days assigned; may differ from calculated net sum
vollstaendigFakturiertvollstaendig_fakturiert (not null)BooleanManually set by finance department — only for completed positions
periodOfPerformanceTypeperiod_of_performance_type (VARCHAR 10)PeriodOfPerformanceType enumDefaults to SEEABOVE; OWN if position has its own PoP
periodOfPerformanceBeginperiod_of_performance_beginLocalDateStart of performance period
periodOfPerformanceEndperiod_of_performance_endLocalDateEnd of performance period
modeOfPaymentTypemode_of_payment_type (VARCHAR 13)ModeOfPaymentType enumMode of payment

Computed Properties

Validation

checkVollstaendigFakturiert() — throws UserException if vollstaendigFakturiert is set to true but the status is not ABGESCHLOSSEN (only completed positions may be marked as fully invoiced).

Equality & Hashing

Equality (and hash) is based on number and auftrag.id — two positions are considered equal if they share the same position number within the same parent order.

Hibernate Search Configuration

The entity uses @TypeBinding with HibernateSearchAuftragsPositionTypeBinder and a custom @ClassBridge(name = "position"). Several fields carry @FullTextField (art, forecastType, status, titel, bemerkung) and @GenericField (nettoSumme) for Hibernate Search indexing. The class bridge enables composite search across position-related fields.

Related Classes

Git History

868d6abb7 2025 -> 2026
49b1d6b8d Forecast and orderbook: forecast-Type for orders/positions added (current month or following month)
63081666f Source file headers: 2024-> 2025.
0237d5eba Json serialization refactored: IdOnlySerializer and IdsOnlySerializer introduced.
a35971f85 Issues from last pull request resolved. Great thanx to luzpaz.
56e9a4c44 WIP: orderbook storage.
c193e8288 Ical4j: migration stuff... (all tests OK)
ae2c04ee0 Migration stuff in progress... (all tests of all packages: OK).
3f25c773a Migration stuff in progress...
184f154a5 Migration stuff in progress...
f31e8064e Migration stuff in progress...
87dd5b87c AuftragsCache refactored, migration stuff... (all tests OK)
6f7e0fbc7 Migration stuff in progress...
4c04cfd65 MAJOR-CHANGE! Migration of integer id's to Long id's (including fk's etc.)
c4950ae12 Migration stuff in progress...
f5c09f87f Migration stuff in progress...
c04fb0d51 Migration stuff in progress...
06828f490 Migration stuff in progress...
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.
9a65e1bc0 AuftragDO: statistics refactored (not yet invoiced, to be invoiced, invoiced etc.)
ed17a2353 ForecastExport shows now more invoices (also invoices without orders)
5f7ef41b8 Copyright 2021 -> 2022
c0f2b9de0 Tenants functionality removed everywhere (untested).
db3b02da7 UserException moved from business to common package (AccesssException affected). UserException will now be returned as Toast for Rest clients on default. FileSizeChecker WIP.
ceb63e8a1 Source code header: (C) 2001-2021.
d89920003 Order book filter "to be invoiced" added.
ca0d5470e Remove DateBridges from DOs.
a6a7aece4 Optimize Imports
78b436d9e Replace instances of java.util.date and java.sql.Date with java.time.LocalDate
b78b870bd ShortDisplayNameCapable -> DisplayNameCapable.
7c79f1922 Copyright of source header -> 2020.
2fa37a281 AuftragsPositionDO.formattedNumber simplified.
8241700f0 ShortDisplayNameCapable converted to Kotlin. DO classes implementing ShortDisplayNameCapable refactored.
e7e42d821 AuftragsPositionDO.titel as hibernate search index.
ff4c3dcf3 fix auftrag position layout
19b97fcc3 DateBridge: encoding = EncodingType.STRING for all DateBridges in all DO's.
8675a1dbe Found big performance issue: Declared all Kotlin JPA entities and their properties as open. Lazy loading wasn't supported by Hibernate and results in thousands of JPA queries...
d36fe6ad9 Heavy WIP: refactoring
39cdd224c Hibernate search: DateBridge...
985286296 hibernate 5.4.3 -> 5.4.4, ehcache introduced (again).
12c7143a5 AuftragRest: Added EditPage elements
97d00031d Auftrag*DO, AddressDO, *Rechnung*DO: performance improved (using now LAZY instead of EAGER loading).
2ed09316e AuftragsPositionDO.kt: Resolve warnings
ca013f56b AuftragsPositionDO.kt: all fields must be nullable (for deserialization purposes): vollstaendigFakturiert and periodOfPerformanceType.
05244ff19 CopyRight of all Kotlin file-header updated or created.
6dc8997a3 AuftragsPositionDO.java -> AuftragsPositionDO.kt