#1301: HistoryBaseDaoAdapter.kt

projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/history/HistoryBaseDaoAdapter.kt Utility / Adapter, projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/history/HistoryBaseDaoAdapter.kt 307 lines · 140 code · 147 comments · 20 blank
Utility object bridging BaseDao operations with the history system. Checks if an entity is historizable (via AbstractHistorizableBaseDO inheritance or @WithHistory annotation), creates HistoryEntryDO records for insert/update operations, and supports single-attribute history entries. Contains extensive commented-out legacy code for full history tracking with old/new property diffing.

Architecture

Historizability Detection

History Entry Creation

MethodDescription
createHistoryEntry(entity, opType)Creates a HistoryEntryDO with entity ID, entity name, op type, timestamp, and current user
createHistoryUpdateEntryWithSingleAttribute(entity, propertyName, propertyTypeClass, oldValue, newValue)Creates a history entry with a single HistoryEntryAttrDO comparing old vs new values
insertHistoryEntry(entity, historyEntry, context)Persists the history entry; supports CandHHistoryEntryICustomizer for entity-specific customization
insertHistoryUpdateEntryWithSingleAttribute(...)Combined create+insert for single attribute updates

Public Hook Methods (used by BaseDao)

MethodCalled When
inserted(obj, context)After entity insert; creates INSERT history entry if historizable
updated(obj, historyEntries, context)After entity update; persists all provided history entries if historizable and non-empty

Legacy Code (Commented Out)

The file contains ~200 lines of commented-out Java methods (wrapHistoryUpdate, getSubEntitiesToHistoricizeDeep, getSubEntitiesToHistoricize, etc.) that previously handled automatic diff computation and deep entity history for @PFPersistancyBehavior(autoUpdateCollectionEntries=true) annotated collections. This functionality was refactored into HistoryService or other history components.

Operation Types

Git History

868d6abb7 2025 -> 2026
6a5214adf Employee: displaying history for time attrs
63081666f Source file headers: 2024-> 2025.
7bc8f49c9 Migration stuff in progress... (all tests OK).
d67bce18b Migration stuff in progress...
ad91ccfa4 Migration stuff in progress...
cb03dc74f Migration stuff in progress... (all tests OK).
68be78d38 Migration stuff in progress... (all tests OK).
a155fe352 Migration stuff in progress... (all tests OK).
3a438a2e7 Migration stuff in progress...
fee3ec6cc Migration stuff in progress... (all tests OK).
88d975da7 Migration stuff in progress...
29892fd2e Migration stuff in progress...
a582dad74 Migration stuff in progress... (all tests OK).
1e47d0f3f Migration stuff in progress... (all tests OK).
5f5f25777 Migration stuff in progress... (all tests OK).
f7f5ad4d3 UserPrefDao -> Kotlin.
6b908c61b Migration stuff in progress...
fa973038e HistoryEntry is now longer generic, is now IdObject<Long>.
22136108e Migration stuff in progress...