CalendarData#
A named working calendar. Add instances to ProjectData.calendars and reference them by ID from TaskData.calendarId and ResourceData.calendarId. Create one with new CalendarData() and the fluent setters.
Declaration#
Constructors#
CalendarData()#
public
Creates a calendar with every field at its default. Set id before the data reaches the engine.
Fields#
| Field | Type | Default | Description |
|---|---|---|---|
id |
Id |
null |
Calendar ID. Required: a null ID throws NullPointerException when the data is imported. Id.str("global") replaces the built-in default calendar. |
worktime |
Worktime |
null |
Working hours, weekdays and date exceptions. null gives the built-in working time: Monday to Friday, 08:00-12:00 and 13:00-17:00. |
The "global" calendar#
Every project has a calendar with the ID "global". Without a CalendarData of that ID, it's Monday to Friday, 08:00-12:00 and 13:00-17:00. A CalendarData with id = Id.str("global") replaces it. Which tasks and assignments fall back to "global" is covered in Working time and calendars.
Methods#
withId#
public CalendarData
Assigns id and returns this instance for chaining.
Returns - this CalendarData.
withWorktime#
public CalendarData
Assigns worktime and returns this instance for chaining.
Returns - this CalendarData.
deepClone#
public CalendarData
Returns a copy that shares no Worktime, list or map with this instance. Id is immutable and is shared.
Returns - a new CalendarData with the same values.
copy#
public CalendarData
Returns a shallow copy. The copy shares the worktime object with this instance.
Returns - a new CalendarData with the same field values.
equals, hashCode, toString#
public boolean
public int
public String
Inherited from ValueRecord. Two CalendarData are equal when their id and worktime are equal. toString() lists both fields, for logging.
Errors#
In Validation.STRICT mode, the call that receives the data throws InputException with kind InputErrorKind.VALIDATION:
| Path | When |
|---|---|
calendars[i] |
Two calendars share an ID ("duplicate calendar id"). IDs compare by their key, so Id.num(1) and Id.str("1") collide. In Validation.REPAIR mode the later calendar replaces the earlier one at the earlier position instead, and a note records it. |
calendars[i] |
The calendar has no working time at all: no working hours on any weekday and no date exception with hours ("calendar has no working time"). |
These checks also run when SchedulingConfig.useCalendars is false. The rules for hours, days and dates are listed on Worktime.
Example#
;
;
Related#
Worktime- the working time it holdsProjectData- where calendars are listedCalendarMode- which calendars place a task's work- Working time and calendars - defining calendars and assigning them