#867: TeamCalendar.kt

projectforge-business/src/main/kotlin/org/projectforge/business/calendar/TeamCalendar.kt Type: Open data class · Purpose: Calendar access model · Source: projectforge-business/src/main/kotlin/org/projectforge/business/calendar/TeamCalendar.kt 73 lines · 37 code · 28 comments · 8 blank
Core domain object representing a team calendar with user access rights. Constructed either from raw properties or from a JPA entity (TeamCalDO) with access resolution via TeamCalCache. Serves as the base class for StyledTeamCalendar (see #861).

Properties

PropertyTypeDefaultDescription
idLong?Unique calendar identifier
titleString?Display name of the calendar
accessACCESS?nullUser's access level to this calendar
externalSubscriptionBooleanfalseWhether this is an externally subscribed calendar

ACCESS Enum

Mirrors DataobjectAccessType but scoped to calendar-level semantics.
ValueMeaning
OWNERUser is the owner of the calendar
FULLFull read/write access
READRead-only access
MINIMALMinimal access (e.g. times only, no details)
NONENo access (only admins receive this)

Constructors

Primary Constructor

TeamCalendar(id: Long?, title: String?, access: ACCESS? = null, externalSubscription: Boolean = false)

Direct construction with explicit property values.

Secondary Constructor (from TeamCalDO)

constructor(teamCalDO: TeamCalDO, userId: Long, teamCalCache: TeamCalCache)

Builds a TeamCalendar from a JPA entity. Resolves the user's access level by calling teamCalCache.teamCalRight.getAccessType(teamCalDO, userId) and mapping the DataobjectAccessType result to the ACCESS enum. Also reads externalSubscription from the entity.

Companion Object

Pseudo-Calendar Constants

ConstantValuePurpose
BIRTHDAYS_FAVS_CAL_ID-2LID for the "favorite peoples' birthdays" pseudo-calendar
BIRTHDAYS_ALL_CAL_ID-3LID for the "all peoples' birthdays" pseudo-calendar

Factory Methods

fun createFavoritesBirthdaysPseudoCalendar(): TeamCalendar

Returns a TeamCalendar with ID -2, localized title "calendar.birthdays.favorites", and ACCESS.READ.

fun createAllBirthdaysPseudoCalendar(): TeamCalendar

Returns a TeamCalendar with ID -3, localized title "calendar.birthdays.all", and ACCESS.READ.

Relationship to StyledTeamCalendar

TeamCalendar is the base class for StyledTeamCalendar (#861), which adds CalendarStyle and a visible flag. This separation follows the decorator pattern: TeamCalendar holds core data and access logic, while StyledTeamCalendar adds UI rendering metadata.

Git History

868d6abb7 2025 -> 2026
63081666f Source file headers: 2024-> 2025.
4c04cfd65 MAJOR-CHANGE! Migration of integer id's to Long id's (including fk's etc.)
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.
5f7ef41b8 Copyright 2021 -> 2022
ceb63e8a1 Source code header: (C) 2001-2021.
7c79f1922 Copyright of source header -> 2020.
d3a178833 Wrong substitution of "calendar" -> "datetime" while refactoring, reverted commit from 12.12.2019.
5dc55cb4a WIP: Calendar: selection of showing timesheets/select timesheet user (dependend on user's role).
b05d8a8be WIP: Calendar: styles and birthdays.
f1d5f2915 Addressbooks and calendars: BaseUserGroupRight introduced and optimized.
f4aee80f0 WIP: CalendarFilter: access to calendars fixed.
05244ff19 CopyRight of all Kotlin file-header updated or created.
46f71e71a WIP CalendarFilter: moved to business module.
bd3a3e824 Module projectforge-jax-rs renamed to projectforge-rest.
d27ecfa74 WIP: CalendarFilter...
7b2661bfc WIP: Calendars, calendars, calendars and colors...