Class CalendarView
- All Implemented Interfaces:
Serializable
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the Solr field name used for parent lookups.Returns the parent identifier used for calendar queries.Getter for the fieldcalendarItems.getVolumeYears.getYear()Getter for the fieldyear.booleanChecks whether the conditions for displaying the calendar view have been met.voidPopulates the calendar with items.voidSetter for the fieldyear.
-
Constructor Details
-
CalendarView
public CalendarView(String pi, String anchorPi, String anchorField, String year) throws IndexUnreachableException, PresentationException Constructor.- Parameters:
pi- Record identifieranchorPi- Anchor record identifier (must be same as pi if this is an anchor)anchorField- Solr field name linking volumes to their anchoryear- Year of a volume; null, if this is an anchor!- Throws:
IndexUnreachableException- if any.PresentationException- if any.
-
CalendarView
public CalendarView(String pi, String anchorPi, String anchorField, String year, String docStructType) throws IndexUnreachableException, PresentationException Constructor with explicit docstruct.The docstruct is consulted by
isDisplay()againstConfiguration.getCalendarDocStructTypes()so that the calendar view only appears for record types where it makes sense — multi-year date metadata alone (e.g. on a podcast anchor) is not enough. A null docstruct disables the whitelist check (legacy callers and unit-test fixtures).- Parameters:
pi- Record identifieranchorPi- Anchor record identifier (must be same as pi if this is an anchor)anchorField- Solr field name linking volumes to their anchoryear- Year of a volume; null, if this is an anchor!docStructType- DOCSTRCT of the top struct element; null to skip the whitelist gate- Throws:
IndexUnreachableException- if any.PresentationException- if any.
-
-
Method Details
-
isDisplay
Checks whether the conditions for displaying the calendar view have been met.When a non-empty
calendar whitelistis configured and this view was constructed with a docstruct that is not in the list, the calendar view is suppressed regardless of how many years or items are indexed. This prevents records that happen to have multi-year date metadata (e.g. podcast anchors) from rendering an empty calendar grid in place of the regular issue-list TOC. A null docstruct (legacy callers) skips the whitelist gate.- Returns:
- true if more than one selectable year is available or more than one item for the currently selected year; false otherwise
- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
populateCalendar
Populates the calendar with items.- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
getVolumeYears
getVolumeYears.- Returns:
- a list of year strings for volumes of this anchor that have calendar day data
- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
getYear
Getter for the fieldyear.- Returns:
- the four-digit year string currently displayed in the calendar
-
setYear
Setter for the fieldyear.- Parameters:
year- the four-digit year string to display; triggers calendar population
-
getAnchorPi
Returns the parent identifier used for calendar queries.For anchor volumes this is the anchor PI, for group members it is the group identifier value (i.e. the PI of the GROUP document).
- Returns:
- the parent persistent identifier used for calendar hit queries
-
getAnchorField
Returns the Solr field name used for parent lookups.For anchor volumes this is
PI_ANCHOR, for group members it is the group identifier field (e.g.GROUPID_NEWSPAPER).- Returns:
- the Solr field name used for parent identifier lookups in calendar queries
-
getCalendarItems
Getter for the fieldcalendarItems.- Returns:
- list of calendar month items representing the current calendar year
-