#995: Kost2ArtDO.kt

projectforge-business/src/main/kotlin/org/projectforge/business/fibu/kost/Kost2ArtDO.kt Type: JPA Entity (DO) · Purpose: Kost2 cost type master data (Kostenart) · Source: projectforge-business/src/main/kotlin/org/projectforge/business/fibu/kost/Kost2ArtDO.kt 118 lines · 56 code · 49 comments · 13 blank
Defines the Kost2 cost types (Kostenarten) — the last two digits (Endziffer) of a Kost2 cost center. Each cost type describes the category of cost: invoiced/non-invoiced, acquisition, maintenance, etc. Uses its 2-digit ID as the natural primary key.

Entity Design

FieldTypeDB ColumnDescription
idLong?PK (2-digit)2-digit cost type number (primary key, not auto-generated)
nameString?VARCHAR(255)Display name of the cost type
descriptionString?VARCHAR(5000)Detailed description
fakturiertBooleanNOT NULLWhether this cost type is invoiced to customers
workFractionBigDecimal?PRECISION(10,5)Fraction of work allocation for this type
projektStandardBooleanIf true, suggested as default cost type for new projects

Persistence Details

Business Semantics

The fakturiert flag is critical: it determines whether expenses under this cost type generate revenue (via customer invoices or subsidies). Non-invoiced cost types represent internal costs. The projektStandard flag controls the UI behavior when creating new project cost centers.

Caching Integration

Kost2ArtDO instances are cached in KostCache's kost2ArtMap (keyed by ID). The updateKost2Arts() method reloads all non-deleted cost types from the database. The allKost2Arts list wraps them as Kost2ArtImpl objects for reporting.

Source Code (abridged)

@Entity @Indexed @Table(name = "T_FIBU_KOST2ART")
class Kost2ArtDO : AbstractHistorizableBaseDO<Long>(), Comparable<Kost2ArtDO> {
    @Id @Column(name = "pk")
    override var id: Long? = null
    var name: String? = null
    var description: String? = null
    var fakturiert: Boolean = false
    var workFraction: BigDecimal? = null
    var projektStandard: Boolean = false
    // equals/hashCode based on id
}

Git History

868d6abb7 2025 -> 2026
63081666f Source file headers: 2024-> 2025.
4c04cfd65 MAJOR-CHANGE! Migration of integer id's to Long id's.
67ce75fe9 Migration stuff in progress...
4f5a458c9 Migration stuff in progress...
c04fb0d51 Migration stuff in progress...
06828f490 Migration stuff in progress...
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.
5f7ef41b8 Copyright 2021 -> 2022
c0f2b9de0 Tenants functionality removed.
ceb63e8a1 Source code header: (C) 2001-2021.
7c79f1922 Copyright 2020.
ca5a7c00f Optimize Imports
a75c0ffbd Kost2ArtDO.java -> Kost2ArtDO.kt