CurrencyConversionServiceSupport.ktInternal support class for currency conversion operations. Handles database persistence, validation, and access control. Marked internal — not part of the public API. CurrencyConversionService is the public-facing facade; this class performs the actual data operations and cache invalidation.
| Dependency | Role |
|---|---|
BaseDOPersistenceService | Generic insert/update/markAsDeleted/undelete operations |
PfPersistenceService | Direct JPA queries (named queries, find by id) |
CurrencyPairDao | Access control checks |
CurrencyConversionCache | Invalidation after write operations |
| Method | Description |
|---|---|
findRate(id) | Selects a rate by id; optionally checks user select access |
selectAllRates(pair, deleted?) | Uses named query FIND_ALL_BY_PAIR; optionally filters by deleted flag |
getActiveRate(rates, date) | Finds the active rate from a list by latest validFrom not after the given date |
validate(rate) checks uniqueness via named queries:
FIND_BY_PAIR_AND_DATE — checks if any rate already exists for this pair+dateFIND_OTHER_BY_PAIR_AND_DATE — excludes the current rateIf a matching deleted rate is found, it is returned to the caller for re-use (undelete + copy-from pattern). This allows users to re-create rates on dates that were previously active but soft-deleted.
Both insert() and updateRate() implement a special algorithm for handling soft-deleted entries:
validate(rate) returns an existing deleted entry if one matchesfinally block| Method | Description |
|---|---|
saveOrUpdate(rate) | Generic insert or update, invalidates cache |
delete(rate) | Soft-deletes a rate, invalidates cache |
markRateAsDeleted(pair, rate) | Full mark-delete flow: validate + markDeleted + cache invalidate |
markRateAsDeleted(pairId, rateId) | Convenience overload that resolves the pair by id |
insert(pairId, rate) | Insert with deferred-call pattern: resolve pair, then delegate |
insert(pair, rate) | Actual insert logic with validation and deleted-entry reuse |
updateRate(pair, rate) | Update with validation, access check, and deleted-entry reuse for date changes |
All mutating methods (insert, update, delete) check the logged-in user has the appropriate access right via currencyPairDao.checkLoggedInUser*Access(). The checkAccess parameter (defaulting to true) allows bypassing these checks for import/bulk operations.
868d6abb7 2025 -> 2026 b78da69bc BaseDao.baseDOChangedRegistry ist now private. 75ea9dc1a WIP: currency conversion with Claude Code. 07edc85de WIP: currency conversion with Claude Code. bd69407de Initial revision with Claude Code.