BankAccountBalanceDao.kt38 class BankAccountBalanceDao : BaseDao<BankAccountBalanceDO>(BankAccountBalanceDO::class.java)
BaseDao is ProjectForge's core persistence framework — provides CRUD operations, access checking infrastructure, and named query execution. Every entity in the system has a matching DAO that extends this base class, overriding hasAccess() and newInstance().
42 override fun hasAccess(user, obj, oldObj, operationType, throwException): Boolean {
49 val bankAccount = obj?.bankAccount
50 if (obj != null && bankAccount == null)
51 return BaseDOPersistenceService.returnFalseOrThrowException(...) ← #1: missing bank account
58 if (!accessChecker.isLoggedInUserMemberOfGroup(ProjectForgeGroup.FINANCE_GROUP))
60 return BaseDOPersistenceService.returnFalseOrThrowException(...) ← #2: not in finance group
68 return bankAccountDao.hasAccess(user, bankAccount, oldBankAccount, ...) ← #3: delegate to parent
69 }Three-step access check:
| Step | Check | Failure message |
|---|---|---|
| 1 | Object has a bank account reference | "Bank account not given." |
| 2 | User is member of FINANCE_GROUP | "User not member of financial staff." |
| 3 | Delegates to bankAccountDao.hasAccess() — checks access to the parent bank account object | As determined by BankAccountDao |
75 fun getByTimePeriod(accountId: Int): List<BankAccountBalanceDO> {
76 val account = bankAccountDao.find(accountId)!!
78 return persistenceService.executeNamedQuery(
79 BankAccountBalanceDO.FIND_BY_BANK_ACCOUNT, ...)!! operator — will throw NullPointerException if bankAccountDao.find(accountId) returns null (bank account not found). The comment says "For access checking" — the find() call implicitly validates the account exists before fetching balances.mu.KotlinLogging from #33 (kotlin-logging 3.0.5) — the standard logging framework across all Kotlin source files.
The Data Access Object for bank account balances — the first actual Kotlin source file in the documentation. Follows the standard ProjectForge DAO pattern: GPLv3 header (lines 1-22), extends
BaseDao<T>(line 38), implementshasAccess()for authorization (lines 42-69), provides a named query methodgetByTimePeriod()(lines 75-83). Annotated@Servicefor Spring dependency injection.