#49: BankAccountDO.kt

plugins/org.projectforge.plugins.banking/src/main/kotlin/org/projectforge/plugins/banking/BankAccountDO.kt

Path: ./plugins/.../BankAccountDO.kt · Type: Kotlin entity (JPA + Hibernate Search) · Lines: 107 · Source: GitHub

107 lines · 64 code · 32 comments · 11 blank

What it does

The JPA entity for bank accounts — the parent of BankAccountBalanceDO (#46). Unlike #46 which extends DefaultBaseDO, this extends BaseUserGroupRightsDO — a richer base class that supports per-object user/group permission assignments. This is why BankAccountDao (#47) can call BaseUserGroupRightUtils.hasAccess() for fine-grained access control.

Inheritance comparison

#46 (Balance)#48 (Account)
Base classDefaultBaseDOBaseUserGroupRightsDO
Access modelGroup-only (FINANCE_GROUP)Group + per-object rights
InterfacesDisplayNameCapable
Indexed fields46 + UsersGroups bridge

Fields

FieldTypeDB columnSearchUI type
nameString?LENGTH_TITLE, not null@FullTextFieldINPUT
descriptionString?LENGTH_TEXT@FullTextField
ibanString?LENGTH_TITLE@FullTextFieldINPUT
bicString?LENGTH_TITLE@FullTextFieldINPUT
bankString?LENGTH_TITLE, not null@FullTextFieldINPUT
importSettingsString?LENGTH=10000, COL=import_settings@FullTextField

Notable details

54 open class BankAccountDO : BaseUserGroupRightsDO(), DisplayNameCapable
55   override val displayName: String
56     @Transient get() { return "$iban $title" }

DisplayNameCapable provides a computed display name (IBAN + name) used in UI dropdowns and search results. displayName is @Transient — not stored in the database, computed at runtime.

72 @get:Transient override var owner: PFUserDO? = null  // "Unused field"

BaseUserGroupRightsDO requires an owner field but bank accounts don't have individual owners — the field is overridden as @Transient (not stored) and always null.

50 @TypeBinding(binder = TypeBinderRef(type = HibernateSearchUsersGroupsTypeBinder::class))

The Hibernate Search bridge indexes which users/groups have rights to each bank account — enabling full-text search queries like "find all bank accounts visible to user 42". Line 49 shows the old @ClassBridge syntax (commented out) replaced by the newer @TypeBinding approach.