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
-
Method Summary
Modifier and TypeMethodDescriptionprotected static void
addEmptyDays
(CalendarItemWeek currentWeek, LocalDate date) Add as manyCalendarItemDay
s to 'currentWeek' as there are days between the start of the month and the previous mondaygetActualYear.This method returns a list of all active centuries.getCentury
(Integer year) getCenturyLabel
(Integer century, Locale locale) Getter for the fieldcollection
.int
This method returns 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.QueryResponse
getFacetCounts
(String... fields) Getter for the fieldmonthList
.Getter for the fieldmonthRow
.int
Getter for the fieldrowIndex
.Getter for the fieldselectYear
.int
Getter for the fieldyearEnd
.int
Getter for the fieldyearStart
.static List<CalendarItemMonth>
populateMonthsWithDays
(String selectYear, String collection, String filterQuery) This method generates the data for each month of the selected year.void
void
This method resets the current selection for year, month and day; also selectYear and collection.void
resetYears.This method generates the search string for the calendar search tab.searchCalendar
(CalendarItemMonth month, CalendarItemDay day) searchCalendar.This method generates the search string for incomplete data.This method generates the search string for the time line based search tab.void
setCollection
(String collection) Setter for the fieldcollection
.void
setCurrentDay
(CalendarItemDay currentDay) Setter for the fieldcurrentDay
.void
setCurrentMonth
(CalendarItemMonth currentMonth) Set a new value for month.void
setCurrentYear
(CalendarItemYear currentYear) Set a new value for year.void
setDayRow
(CalendarRow dayRow) Setter for the fielddayRow
.void
setMonthRow
(CalendarRow monthRow) Setter for the fieldmonthRow
.void
setRowIndex
(int rowIndex) Setter for the fieldrowIndex
.void
setSearchBean
(SearchBean searchBean) Required setter for ManagedProperty injectionvoid
setSelectYear
(String selectYear) Select a year.void
setYearEnd
(int yearEnd) Setter for the fieldyearEnd
.void
setYearStart
(int yearStart) Setter for the fieldyearStart
.
-
Constructor Details
-
CalendarBean
public CalendarBean()Constructor for CalendarBean.
-
-
Method Details
-
setSearchBean
Required setter for ManagedProperty injection- Parameters:
searchBean
- the searchBean to set
-
getCurrentYear
Getter for the field
currentYear
.- 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
- aCalendarItemYear
object.- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getRowIndex
public int getRowIndex()Getter for the field
rowIndex
.- Returns:
- a int.
-
setRowIndex
public void setRowIndex(int rowIndex) Setter for the field
rowIndex
.- Parameters:
rowIndex
- a int.
-
getMonthRow
Getter for the field
monthRow
.- Returns:
- a
CalendarRow
object.
-
setMonthRow
Setter for the field
monthRow
.- Parameters:
monthRow
- aCalendarRow
object.
-
getCurrentMonth
Getter for the field
currentMonth
.- Returns:
- a
CalendarItemMonth
object.
-
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
- aCalendarItemMonth
object.- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getCurrentDay
Getter for the field
currentDay
.- Returns:
- a
CalendarItemDay
object.
-
setCurrentDay
Setter for the field
currentDay
.- Parameters:
currentDay
- aCalendarItemDay
object.
-
getCurrentDate
getCurrentDate.
- Returns:
- a
LocalDateTime
object.
-
getCurrentDateAsString
-
getDayRow
Getter for the field
dayRow
.- Returns:
- the dayRow
-
setDayRow
Setter for the field
dayRow
.- Parameters:
dayRow
- the dayRow to set
-
searchTimeline
public String searchTimeline() throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationExceptionThis method generates 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:
- a
String
object. - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.DAOException
- if any.ViewerConfigurationException
- if any.
-
resetCurrentSelection
public void resetCurrentSelection()This method resets the current selection for year, month and day; also selectYear and collection. -
resetAllActiveYears
public void resetAllActiveYears() -
getAllActiveCenturies
public List<CalendarItemCentury> getAllActiveCenturies() throws PresentationException, IndexUnreachableExceptionThis method returns 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
object. - 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, IOException Select a year. If the new value differs from the old one, the data for the new value gets generated.- Parameters:
selectYear
- the selectYear to set- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.IOException
-
getSelectYear
Getter for the field
selectYear
.- Returns:
- the selectYear
-
populateMonthsWithDays
public static List<CalendarItemMonth> populateMonthsWithDays(String selectYear, String collection, String filterQuery) throws PresentationException, IndexUnreachableException This method 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
- aString
object.collection
- aString
object.filterQuery
- aString
object.- Returns:
- a
List
object. - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
addEmptyDays
Add as manyCalendarItemDay
s to 'currentWeek' as there are days between the start of the month and the previous monday- Parameters:
currentWeek
-date
-
-
getMonthList
Getter for the field
monthList
.- Returns:
- the monthList
-
getYearEnd
public int getYearEnd()Getter for the field
yearEnd
.- Returns:
- the yearEnd
-
getYearStart
public int getYearStart()Getter for the field
yearStart
.- Returns:
- the yearStart
-
setYearEnd
public void setYearEnd(int yearEnd) Setter for the field
yearEnd
.- Parameters:
yearEnd
- the yearEnd to set
-
setYearStart
public void setYearStart(int yearStart) Setter for the field
yearStart
.- Parameters:
yearStart
- the yearStart to set
-
setCollection
public void setCollection(String collection) throws PresentationException, IndexUnreachableException Setter for the field
collection
.- Parameters:
collection
- the collection to set- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getCollection
Getter for the field
collection
.- Returns:
- the collection
-
searchCalendar
public String searchCalendar(CalendarItemMonth month, CalendarItemDay day) throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException searchCalendar.
- Parameters:
month
- aCalendarItemMonth
object.day
- aCalendarItemDay
object.- Returns:
- a
String
object. - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.DAOException
- if any.ViewerConfigurationException
- if any.
-
searchCalendar
public String searchCalendar() throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationExceptionThis method generates the search string for the calendar search tab. The search string will be handed over to the search bean to execute the search.- Returns:
- a
String
object. - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.DAOException
- if any.ViewerConfigurationException
- if any.
-
getCountOfIncompleteData
This method 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:
- a
String
object.
-
searchForIncompleteData
public String searchForIncompleteData() throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationExceptionThis method generates the search string for incomplete data. The search string will be handed over to the search bean to execute the search.- Returns:
- a
String
object. - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.DAOException
- if any.ViewerConfigurationException
- if any.
-
getCenturyLabel
-