#1268: CandHMaster.kt
projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/candh/CandHMaster.kt Copy-and-History Engine (Singleton), projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/candh/CandHMaster.kt 311 lines · 211 code · 86 comments · 14 blank
The central engine for Copy-and-History operations. A singleton that orchestrates property-level handlers to merge source objects into destination objects and create history entries. Copies persisted properties first, then transient properties (because transient may depend on persisted values). Only Kotlin classes are supported; Java classes emit a warning.
Architecture
Handler Chain
Registered in init block, tried in order:
- BigDecimalHandler — scale-insensitive BigDecimal comparison
- SqlDateHandler — java.sql.Date
- UtilDateHandler — java.util.Date
- CollectionHandler — collection deep copy with add/remove/modify tracking
- BaseDOHandler — BaseDO entities (compare by ID)
- DefaultHandler — fallback for all other types
Copy Process
- Initialize Hibernate proxy if needed
- Copy ID if not in ignore list and IDs differ
- Copy persisted properties first (using
KClassUtils.filterPublicMutableProperties)
- Copy non-persisted/transient properties second
- Skip properties annotated with
@CandHIgnore, transient, static, or inner class members
Key Methods
| Method | Description |
copyValues(src, dest, ...) | Public entry point; creates CandHContext, copies all properties |
propertyWasModified(ctx, pc, type) | Sets copy status to MAJOR or MINOR, triggers history entry creation |
accept(property) | Filters properties: rejects @CandHIgnore, transient, static, inner class |
Git History
868d6abb7 2025 -> 2026
63081666f Source file headers: 2024-> 2025.
4b9ffbee2 Migration stuff in progress... (all tests of all packages: OK).
84e863624 Migration stuff in progress... (all tests of all packages: OK).
b79a1edca Migration stuff in progress... (all tests of all packages: OK).