BookType.ktBookType is a straightforward enumeration of media types supported by ProjectForge's book-management feature. It implements I18nEnum so that each value's label (e.g. "Audio Book", "E-Book", "Magazine") can be localised. The enum covers both traditional bibliographic categories (book, thesis) and modern digital media (ebook, software, film).
| Enum Constant | Key | i18n Property | Typical Use |
|---|---|---|---|
AUDIO_BOOK | audiobook | book.type.audiobook | Spoken-word recordings |
BOOK | book | book.type.book | Standard printed book (default) |
EBOOK | ebook | book.type.ebook | Electronic books (EPUB, PDF, etc.) |
MAGAZINE | magazine | book.type.magazine | Periodical magazines |
ARTICLE | article | book.type.article | Individual journal/conference articles |
NEWSPAPER | newspaper | book.type.newspaper | Daily or weekly newspapers |
PERIODICAL | periodical | book.type.periodical | Generic periodicals not covered above |
FILM | film | book.type.film | Movies and film recordings |
SOFTWARE | software | book.type.software | Software / digital media |
THESIS | thesis | book.type.thesis | Academic theses and dissertations |
MISC | misc | book.type.misc | Catch-all for uncategorised entries |
The enum is used as a property type on the BookDO entity (the domain object for bibliographic entries). Because it implements I18nEnum, the UI layer can call BookType.BOOK.i18nKey to obtain the property key "book.type.book" and look up the localised string (e.g. "Buch" in German, "Book" in English). This keeps display logic out of the enum itself.
The key constructor parameter serves dual purposes: it forms the rightmost segment of the i18n key and can be used as a database-safe stored value (e.g. "ebook" rather than "EBOOK"). The convention of passing a lowercase key to the i18n property path avoids casing issues in different front-end frameworks.
I18nEnumI18nEnum is a ProjectForge interface that requires a single property: val i18nKey: String. Any enum implementing it can be rendered in the UI by looking up the returned key in the application's resource bundles. This pattern avoids hard-coding display strings in enum constants and enables multi-language support without modifying Kotlin source code.
| Commit | Description |
|---|---|
868d6abb7 | Copyright year bump: 2025 → 2026 |
63081666f | Source file headers: 2024 → 2025 |
4c04cfd65 | MAJOR: Migration of integer IDs to Long (entity-wide change, touched enums via recompilation) |
923f5c64b | Migration stuff in progress… (likely part of the ID migration or Kotlin conversion) |
b6092df09 | Copyright 2023 → 2024 |
ab45d51fa | Copyright 2001-2022 → 2001-2023 |
ceb63e8a1 | Source code header: (C) 2001-2021 |
7c79f1922 | Copyright of source header → 2020 |
dd5ca38ac | CopyRight of all java file-headers updated or created |
9ebb88522 | Initial commit |
Book types are a small, stable, closed set. An enum provides compile-time type safety, avoids a join at query time, and eliminates the need for a separate administration UI to manage categories. The trade-off is that adding a new type requires a code change and a redeployment — acceptable for a domain where new media categories are rare.
FILM and SOFTWARE?ProjectForge's book module is really a general bibliographic/media catalogue. The name "book" is a simplification for the user-facing module label; internally, the system tracks a broader range of media. The expanded enum values reflect the actual use cases of the user base (likely an organisation that manages diverse reference materials).
I18nEnum instead of storing display names directly?Hard-coding display strings in Kotlin enums would make multi-language support impossible without duplicating the enum for each locale. The I18nEnum pattern decouples the symbolic constant (EBOOK) from its human-readable label, allowing translators to provide localised values in resource-bundle properties files.