Package io.goobi.viewer.managedbeans
Class CalendarBean
java.lang.Object
io.goobi.viewer.managedbeans.CalendarBean
- All Implemented Interfaces:
Serializable
This bean provides data for the calendar and time based search entries.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidaddEmptyDays(CalendarItemWeek currentWeek, LocalDate date) Add as manyCalendarItemDays to 'currentWeek' as there are days between the start of the month and the previous monday.getActualYear.Returns a list of all active centuries.getCentury(Integer year) getCenturyLabel(Integer century, Locale locale) Getter for the fieldcollection.intReturns the count of all data without a value in YEARMONTHDAY for the selected year.getCurrentDate.Getter for the fieldcurrentDay.Getter for the fieldcurrentMonth.Getter for the fieldcurrentYear.Getter for the fielddayRow.org.apache.solr.client.solrj.response.QueryResponsegetFacetCounts(String... fields) Getter for the fieldmonthList.Getter for the fieldmonthRow.intGetter for the fieldrowIndex.Getter for the fieldselectYear.intGetter for the fieldyearEnd.intGetter for the fieldyearStart.static List<CalendarItemMonth> populateMonthsWithDays(String selectYear, String collection, String filterQuery) Generates the data for each month of the selected year.voidvoidResets the current selection for year, month and day; also selectYear and collection.voidresetYears.Generates the search string for the calendar search tab.searchCalendar(CalendarItemMonth month, CalendarItemDay day) searchCalendar.Generates the search string for incomplete data.Generates the search string for the time line based search tab.voidsetCollection(String collection) Setter for the fieldcollection.voidsetCurrentDay(CalendarItemDay currentDay) Setter for the fieldcurrentDay.voidsetCurrentMonth(CalendarItemMonth currentMonth) Set a new value for month.voidsetCurrentYear(CalendarItemYear currentYear) Set a new value for year.voidsetDayRow(CalendarRow dayRow) Setter for the fielddayRow.voidsetMonthRow(CalendarRow monthRow) Setter for the fieldmonthRow.voidsetRowIndex(int rowIndex) Setter for the fieldrowIndex.voidsetSearchBean(SearchBean searchBean) Required setter for ManagedProperty injection.voidsetSelectYear(String selectYear) Select a year.voidsetYearEnd(int yearEnd) Setter for the fieldyearEnd.voidsetYearStart(int yearStart) Setter for the fieldyearStart.
-
Constructor Details
-
CalendarBean
public CalendarBean()Creates a new CalendarBean instance.
-
-
Method Details
-
setSearchBean
Required setter for ManagedProperty injection.- Parameters:
searchBean- the SearchBean instance to inject for testing
-
getCurrentYear
Getter for the fieldcurrentYear.- Returns:
- selected year
-
setCurrentYear
public void setCurrentYear(CalendarItemYear currentYear) throws PresentationException, IndexUnreachableException Set a new value for year. If the selected year is the same as the old selection, the data will be unselected. Otherwise the new data will be generated.- Parameters:
currentYear- newly selected calendar year item- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
getRowIndex
public int getRowIndex()Getter for the fieldrowIndex.- Returns:
- a int.
-
setRowIndex
public void setRowIndex(int rowIndex) Setter for the fieldrowIndex.- Parameters:
rowIndex- a int.
-
getMonthRow
Getter for the fieldmonthRow.- Returns:
- the calendar row containing the month items
-
setMonthRow
Setter for the fieldmonthRow.- Parameters:
monthRow- calendar row containing month items to set
-
getCurrentMonth
Getter for the fieldcurrentMonth.- Returns:
- the currently selected calendar month item
-
setCurrentMonth
public void setCurrentMonth(CalendarItemMonth currentMonth) throws PresentationException, IndexUnreachableException Set a new value for month. If the selected month is the same as the old selection, the month and day will be unselected. Otherwise the data for the month gets generated.- Parameters:
currentMonth- newly selected calendar month item- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
getCurrentDay
Getter for the fieldcurrentDay.- Returns:
- the currently selected calendar day item
-
setCurrentDay
Setter for the fieldcurrentDay.- Parameters:
currentDay- newly selected calendar day item
-
getCurrentDate
getCurrentDate.- Returns:
- the current date/time with the selected year, month, and day applied
-
getCurrentDateAsString
-
getDayRow
Getter for the fielddayRow.- Returns:
- the calendar row containing the day items for the currently selected week row
-
setDayRow
Setter for the fielddayRow.- Parameters:
dayRow- calendar row containing day items to set
-
searchTimeline
public String searchTimeline() throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationExceptionGenerates the search string for the time line based search tab. The search string will be handed over to the search bean to execute the search.- Returns:
- the navigation outcome after executing the timeline search
- Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.ViewerConfigurationException- if any.
-
resetCurrentSelection
public void resetCurrentSelection()Resets the current selection for year, month and day; also selectYear and collection. -
resetAllActiveYears
public void resetAllActiveYears() -
getAllActiveCenturies
public List<CalendarItemCentury> getAllActiveCenturies() throws PresentationException, IndexUnreachableExceptionReturns a list of all active centuries.
The method searches for the facet of the field 'CENTURY'. If the count of a facet is greater than 0, the century is active.
- Returns:
- a list of CalendarItemCentury objects for each century that has at least one indexed record
- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
getCentury
-
getFacetCounts
public org.apache.solr.client.solrj.response.QueryResponse getFacetCounts(String... fields) throws PresentationException, IndexUnreachableException -
resetYears
resetYears.- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
setSelectYear
public void setSelectYear(String selectYear) throws PresentationException, IndexUnreachableException Select a year. If the new value differs from the old one, the data for the new value gets generated.- Parameters:
selectYear- four-digit year string to select and populate calendar data for- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
getSelectYear
Getter for the fieldselectYear.- Returns:
- the four-digit year string currently selected for the calendar view
-
populateMonthsWithDays
public static List<CalendarItemMonth> populateMonthsWithDays(String selectYear, String collection, String filterQuery) throws PresentationException, IndexUnreachableException Generates the data for each month of the selected year.
It runs a facet search for YEARMONTH and YEARMONTHDAY for the current year. For each day of the year, the method checks if the count of the field YEARMONTHDAY is greater than 0. If this is the case, the day is an active element, otherwise it has no hits.- Parameters:
selectYear- four-digit year string to populate data forcollection- Solr collection filter value, or null for allfilterQuery- additional Solr filter query to restrict results- Returns:
- a list of CalendarItemMonth objects with day-level hit data populated for the given year
- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
addEmptyDays
Add as manyCalendarItemDays to 'currentWeek' as there are days between the start of the month and the previous monday.- Parameters:
currentWeek- Week item to prepend empty days todate- First day of the month
-
getMonthList
Getter for the fieldmonthList.- Returns:
- the list of calendar month items for the currently selected year
-
getYearEnd
public int getYearEnd()Getter for the fieldyearEnd.- Returns:
- the last year (inclusive) of the date range displayed in the calendar
-
getYearStart
public int getYearStart()Getter for the fieldyearStart.- Returns:
- the first year (inclusive) of the date range displayed in the calendar
-
setYearEnd
public void setYearEnd(int yearEnd) Setter for the fieldyearEnd.- Parameters:
yearEnd- the last year (inclusive) of the date range to display
-
setYearStart
public void setYearStart(int yearStart) Setter for the fieldyearStart.- Parameters:
yearStart- the first year (inclusive) of the date range to display
-
setCollection
public void setCollection(String collection) throws PresentationException, IndexUnreachableException Setter for the fieldcollection.- Parameters:
collection- Solr collection filter value to restrict the calendar view, or null for all collections- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
getCollection
Getter for the fieldcollection.- Returns:
- the Solr collection filter value restricting the calendar view, or null for all collections
-
searchCalendar
public String searchCalendar(CalendarItemMonth month, CalendarItemDay day) throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException searchCalendar.- Parameters:
month- aCalendarItemMonthobject.day- aCalendarItemDayobject.- Returns:
- the navigation outcome after executing the calendar search for the given month and day
- Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.ViewerConfigurationException- if any.
-
searchCalendar
public String searchCalendar() throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationExceptionGenerates the search string for the calendar search tab. The search string will be handed over to the search bean to execute the search.- Returns:
- the navigation outcome after executing the calendar search
- Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.ViewerConfigurationException- if any.
-
getCountOfIncompleteData
Returns the count of all data without a value in YEARMONTHDAY for the selected year.- Returns:
- a int.
- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
getActualYear
getActualYear.- Returns:
- the currently selected year string, or null if no year has been selected
-
searchForIncompleteData
public String searchForIncompleteData() throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationExceptionGenerates the search string for incomplete data. The search string will be handed over to the search bean to execute the search.- Returns:
- the navigation outcome after executing the search for records with incomplete calendar data
- Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.ViewerConfigurationException- if any.
-
getCenturyLabel
-