Class NavigationHelper

java.lang.Object
io.goobi.viewer.managedbeans.NavigationHelper
All Implemented Interfaces:
Serializable

@Named @SessionScoped public class NavigationHelper extends Object implements Serializable
This bean contains useful navigation parameters.
See Also:
  • Field Details

    • KEY_CURRENT_VIEW

      protected static final String KEY_CURRENT_VIEW
      Constant KEY_CURRENT_VIEW="currentView"
      See Also:
    • KEY_PREFERRED_VIEW

      protected static final String KEY_PREFERRED_VIEW
      Constant KEY_PREFERRED_VIEW="preferredView"
      See Also:
    • KEY_SELECTED_NEWS_ARTICLE

      protected static final String KEY_SELECTED_NEWS_ARTICLE
      Constant KEY_SELECTED_NEWS_ARTICLE="selectedNewsArticle"
      See Also:
    • KEY_MENU_PAGE

      protected static final String KEY_MENU_PAGE
      Constant KEY_MENU_PAGE="menuPage"
      See Also:
    • KEY_SUBTHEME_DISCRIMINATOR_VALUE

      protected static final String KEY_SUBTHEME_DISCRIMINATOR_VALUE
      Constant KEY_SUBTHEME_DISCRIMINATOR_VALUE="subThemeDicriminatorValue"
      See Also:
  • Constructor Details

    • NavigationHelper

      public NavigationHelper()
      Empty constructor.
  • Method Details

    • setCmsBean

      public void setCmsBean(CmsBean cmsBean)
    • init

      @PostConstruct public void init()

      init.

    • setBreadcrumbBean

      public void setBreadcrumbBean(BreadcrumbBean breadcrumbBean)
      Required setter for ManagedProperty injection
      Parameters:
      breadcrumbBean - the breadcrumbBean to set
    • searchPage

      public String searchPage()

      searchPage.

      Returns:
      a String object.
    • homePage

      public String homePage()

      homePage.

      Returns:
      a String object.
    • browsePage

      public String browsePage()

      browsePage.

      Returns:
      a String object.
    • getCurrentPage

      public String getCurrentPage()

      Getter for the field currentPage.

      Returns:
      a String object.
    • isCmsPage

      public boolean isCmsPage()

      isCmsPage.

      Returns:
      the isCmsPage
    • setCmsPage

      public void setCmsPage(boolean isCmsPage)

      setCmsPage.

      Parameters:
      isCmsPage - the isCmsPage to set
    • getCMSPageNavigationId

      public static String getCMSPageNavigationId(CMSPage cmsPage)
      Produce an identifier string for a cms page to use for identifying the page in the navigation bar
      Parameters:
      cmsPage -
      Returns:
      String
    • setCurrentPage

      public void setCurrentPage(CMSPage cmsPage)
      Parameters:
      cmsPage -
    • setCurrentPage

      public void setCurrentPage(String currentPage)

      Setter for the field currentPage.

      Parameters:
      currentPage - a String object.
    • setCurrentPage

      public void setCurrentPage(String currentPage, boolean resetBreadcrubs, boolean resetCurrentDocument)

      Setter for the field currentPage.

      Parameters:
      currentPage - a String object.
      resetBreadcrubs - a boolean.
      resetCurrentDocument - a boolean.
    • setCurrentPage

      public void setCurrentPage(String currentPage, boolean resetBreadcrubs, boolean resetCurrentDocument, boolean setCmsPage)

      Setter for the field currentPage.

      Parameters:
      currentPage - a String object.
      resetBreadcrubs - a boolean.
      resetCurrentDocument - a boolean.
      setCmsPage - a boolean.
    • setCurrentBreadcrumbPage

      public void setCurrentBreadcrumbPage(String pageName, String pageWeight, String pageURL)

      setCurrentBreadcrumbPage.

      Parameters:
      pageName - a String object.
      pageWeight - a String object.
      pageURL - a String object.
    • getPreferredView

      public String getPreferredView()
      Returns the manually selected view type (will be used for search result browsing, if set).
      Returns:
      a String object.
    • setPreferredView

      public void setPreferredView(String preferredView)
      Sets the manually selected view type (will be used for search result browsing, if set).
      Parameters:
      preferredView - a String object.
    • setCurrentPageIndex

      public void setCurrentPageIndex()

      setCurrentPageIndex.

    • setCurrentPageSearch

      public void setCurrentPageSearch()

      setCurrentPageSearch.

    • setCurrentPageBrowse

      public void setCurrentPageBrowse()

      setCurrentPageBrowse.

    • setCurrentPageBrowse

      public void setCurrentPageBrowse(CollectionView collection)

      setCurrentPageBrowse.

      Parameters:
      collection - a CollectionView object.
    • setCurrentPageTags

      public void setCurrentPageTags()

      setCurrentPageTags.

    • setCurrentPageStatistics

      public void setCurrentPageStatistics()

      setCurrentPageStatistics.

    • setCrowdsourcingAnnotationPage

      public void setCrowdsourcingAnnotationPage(Campaign campaign, String pi, CrowdsourcingStatus status)
      Set the current page to a crowdsourcing annotation page with the given campaign as parent and the given pi as current identifier
      Parameters:
      campaign - a Campaign object.
      pi - a String object.
      status - a CrowdsourcingStatus object.
    • setCurrentPageUser

      public void setCurrentPageUser()

      setCurrentPageUser.

    • setCurrentPageAdmin

      public void setCurrentPageAdmin(String pageName)

      setCurrentPageAdmin.

      Parameters:
      pageName - a String object.
    • setCurrentPageAdmin

      public void setCurrentPageAdmin(String pageName, List<List<String>> labels)
    • createAdminBreadcrumbs

      protected List<LabeledLink> createAdminBreadcrumbs(PageType pageType, List<List<String>> labels)
    • setCurrentPageAdmin

      public void setCurrentPageAdmin()

      setCurrentPageAdmin.

    • setCurrentPageSitelinks

      public void setCurrentPageSitelinks()

      setCurrentPageSitelinks.

    • setCurrentPageTimeMatrix

      public void setCurrentPageTimeMatrix()

      setCurrentPageTimeMatrix.

    • setCurrentPageSearchTermList

      public void setCurrentPageSearchTermList()

      setCurrentPageSearchTermList.

    • resetCurrentPage

      public void resetCurrentPage()

      resetCurrentPage.

    • getViewAction

      public String getViewAction(String view)

      getViewAction.

      Parameters:
      view - a String object.
      Returns:
      a String object.
    • getCurrentView

      public String getCurrentView()

      getCurrentView.

      Returns:
      the currentView
    • setCurrentView

      public void setCurrentView(String currentView)
      Sets the currently selected content view name.
      Parameters:
      currentView - a String object.
    • getDefaultLocale

      public Locale getDefaultLocale()

      getDefaultLocale.

      Returns:
      a Locale object.
    • getLocale

      public Locale getLocale()

      Getter for the field locale.

      Returns:
      a Locale object.
    • getLocaleString

      public String getLocaleString()

      Returns the language code of the current locale in the ISO 639-1 (two-character) format.

      Returns:
      a String object.
    • getSupportedLocales

      public Iterator<Locale> getSupportedLocales()

      getSupportedLocales.

      Returns:
      a Iterator object.
    • getSupportedLanguages

      public List<String> getSupportedLanguages()
      Returns ISO 639-1 language codes of available JSF locales.
      Returns:
      a List object.
    • getSupportedLanguagesAsJson

      public String getSupportedLanguagesAsJson()
      Returns ISO 639-1 language codes of available JSF locales as json array.
      Returns:
      a String to be interpreted as json array of strings.
    • setLocaleString

      public void setLocaleString(String inLocale)

      setLocaleString.

      Parameters:
      inLocale - a String object.
    • getDatePattern

      public String getDatePattern()

      getDatePattern.

      Returns:
      a String object.
    • getDatePattern

      public static String getDatePattern(String language)
    • getDatePattern

      public static String getDatePattern(Locale locale)
    • getDatePatternjQueryDatePicker

      public String getDatePatternjQueryDatePicker()
      Get the date/time pattern for the current locale for use with jQuery date picker. Uses the value of getDatePattern() and adapts the month and year patterns in the following way:
      • MM --> mm
      • yyyy --> yy
      Returns:
      a date pattern suitable for jquery date picker
    • getDateTimePattern

      public String getDateTimePattern()
      Returns:
      Appropriate date/time pattern for the current locale
    • reload

      public void reload()

      reload.

    • getApplicationUrl

      public String getApplicationUrl()

      getApplicationUrl.

      Returns:
      a String object.
    • getEncodedUrl

      public String getEncodedUrl()
      Used for social bookmarks.
      Returns:
      a String object.
    • getCurrentUrl

      public String getCurrentUrl()

      getCurrentUrl.

      Returns:
      a String object.
    • getRssUrl

      public String getRssUrl()

      getRssUrl.

      Returns:
      a String object.
    • getRequestPath

      public String getRequestPath(javax.faces.context.ExternalContext externalContext)

      getRequestPath.

      Parameters:
      externalContext - a ExternalContext object.
      Returns:
      the complete Request Path, eg http://hostname.de/viewer/pathxyz/pathxyz/
    • getRequestPath

      public static String getRequestPath(javax.servlet.http.HttpServletRequest request, String prettyFacesURI)

      getRequestPath.

      Parameters:
      request - a HttpServletRequest object.
      prettyFacesURI - a String object.
      Returns:
      a String object.
    • getFullRequestUrl

      public static String getFullRequestUrl(javax.servlet.http.HttpServletRequest request, String prettyFacesURI)

      getFullRequestUrl.

      Parameters:
      request - a HttpServletRequest object.
      prettyFacesURI - a String object.
      Returns:
      a String object.
    • getCurrentPrettyUrl

      public String getCurrentPrettyUrl()
      Returns the current PrettyURL.
      Returns:
      a String object.
    • getTimeZone

      public TimeZone getTimeZone()

      getTimeZone.

      Returns:
      a TimeZone object.
    • setMenuPage

      public void setMenuPage(String page)

      setMenuPage.

      Parameters:
      page - a String object.
    • getMenuPage

      public String getMenuPage()

      getMenuPage.

      Returns:
      a String object.
    • getTheme

      public String getTheme()

      Getter for the field theme.

      Returns:
      a String object.
    • getSubThemeDiscriminatorValue

      public String getSubThemeDiscriminatorValue() throws IndexUnreachableException
      Returns the value of the configured sub-theme discriminator field. The value can be set via setSubThemeDiscriminatorValue(java.lang.String) (e.g. via PrettyFacces). If a record is currently loaded and has a dicriminatorField:discriminatorValue pair, the currently set value is replaced with that from the record.
      Returns:
      a String object.
      Throws:
      IndexUnreachableException - if any.
    • determineCurrentSubThemeDiscriminatorValue

      public String determineCurrentSubThemeDiscriminatorValue()
      Get the subthemeDiscriminator value either from a property of the currently loaded CMS page or the currently loaded document in the activeDocumentbean if the current page is a docmentPage.
      Returns:
      the subtheme name determined from current cmsPage or current document. If Configuration.getSubthemeDiscriminatorField() is blank, always return an empty string
    • setSubThemeDiscriminatorValue

      public void setSubThemeDiscriminatorValue()
    • setSubThemeDiscriminatorValue

      public void setSubThemeDiscriminatorValue(String subThemeDiscriminatorValue)

      setSubThemeDiscriminatorValue.

      Parameters:
      subThemeDiscriminatorValue - a String object.
    • resetTheme

      public void resetTheme()

      resetTheme.

    • getObjectUrl

      public String getObjectUrl()

      getObjectUrl.

      Returns:
      a String object.
    • getImageUrl

      public String getImageUrl()

      getImageUrl.

      Returns:
      a String object.
    • getCurrentPageTypeUrl

      public String getCurrentPageTypeUrl()
    • getImageActiveUrl

      public String getImageActiveUrl()

      getImageActiveUrl.

      Returns:
      a String object.
    • getReadingModeUrl

      @Deprecated(since="24.10") public String getReadingModeUrl()
      Deprecated.
      renamed to fullscreen

      getReadingModeUrl.

      Returns:
      the reading mode url
    • getViewImagePathFullscreen

      public String getViewImagePathFullscreen() throws IndexUnreachableException, DAOException, ViewerConfigurationException
      This method checks the Solr height attribute of the current page. If this is > 0, than the current page is displayed with OpenLayers
      Returns:
      the path which viewImageFullscreen.xhtml the user should see for the current page.
      Throws:
      IndexUnreachableException - if any.
      DAOException - if any.
      ViewerConfigurationException - if any.
    • getCalendarUrl

      public String getCalendarUrl()

      getCalendarUrl.

      Returns:
      a String object.
    • getCalendarActiveUrl

      public String getCalendarActiveUrl()

      getCalendarActiveUrl.

      Returns:
      a String object.
    • getTocUrl

      public String getTocUrl()

      getTocUrl.

      Returns:
      a String object.
    • getTocActiveUrl

      public String getTocActiveUrl()

      getTocActiveUrl.

      Returns:
      a String object.
    • getThumbsUrl

      public String getThumbsUrl()

      getThumbsUrl.

      Returns:
      a String object.
    • getThumbsActiveUrl

      public String getThumbsActiveUrl()

      getThumbsActiveUrl.

      Returns:
      a String object.
    • getMetadataUrl

      public String getMetadataUrl()

      getMetadataUrl.

      Returns:
      a String object.
    • getMetadataActiveUrl

      public String getMetadataActiveUrl()

      getMetadataActiveUrl.

      Returns:
      a String object.
    • getFulltextUrl

      public String getFulltextUrl()

      getFulltextUrl.

      Returns:
      a String object.
    • getFulltextActiveUrl

      public String getFulltextActiveUrl()

      getFulltextActiveUrl.

      Returns:
      a String object.
    • getSearchUrl

      public String getSearchUrl()

      getSearchUrl.

      Returns:
      a String object.
    • getAdvancedSearchUrl

      public String getAdvancedSearchUrl()

      getAdvancedSearchUrl.

      Returns:
      a String object.
    • getPageUrl

      public String getPageUrl(String pageType)

      getPageUrl.

      Parameters:
      pageType - a String object.
      Returns:
      a String object.
    • getPageUrl

      public String getPageUrl(PageType page)

      getPageUrl.

      Parameters:
      page - a PageType object.
      Returns:
      a String object.
    • getSearchUrl

      public String getSearchUrl(int activeSearchType)

      getSearchUrl.

      Parameters:
      activeSearchType - a int.
      Returns:
      a String object.
    • getSearchUrl

      public String getSearchUrl(int activeSearchType, CMSPage cmsPage)

      getSearchUrl.

      Parameters:
      activeSearchType - a int.
      cmsPage -
      Returns:
      a String object.
    • getTermUrl

      public String getTermUrl()

      getTermUrl.

      Returns:
      a String object.
    • getBrowseUrl

      public String getBrowseUrl()

      getBrowseUrl.

      Returns:
      a String object.
    • getSortUrl

      public String getSortUrl()

      getSortUrl.

      Returns:
      a String object.
    • addStaticLinkToBreadcrumb

      public void addStaticLinkToBreadcrumb(String linkName, int linkWeight)
      Adds a link to the breadcrumbs using the current PrettyURL. Can be called from XHTML.
      Parameters:
      linkName - a String object.
      linkWeight - a int.
    • addStaticLinkToBreadcrumb

      public void addStaticLinkToBreadcrumb(String linkName, String url, int linkWeight)
      Adds a link to the breadcrumbs using the given URL. Can be called from XHTML.
      Parameters:
      linkName - a String object.
      url - a String object.
      linkWeight - a int.
    • getLocalDate

      public String getLocalDate(LocalDateTime date)
      Returns the string representation of the given Date based on the current locale.
      Parameters:
      date - a LocalDateTime object.
      Returns:
      a String object.
    • getMessageValueList

      public List<String> getMessageValueList(String keyPrefix)

      getMessageValueList.

      Parameters:
      keyPrefix - a String object.
      Returns:
      a List object.
    • setSelectedNewsArticle

      public void setSelectedNewsArticle(String art)

      setSelectedNewsArticle.

      Parameters:
      art - a String object.
    • getSelectedNewsArticle

      public String getSelectedNewsArticle()

      getSelectedNewsArticle.

      Returns:
      a String object.
    • getLastRequestTimestamp

      public String getLastRequestTimestamp()

      getLastRequestTimestamp.

      Returns:
      a String object.
    • getSessionIPAddress

      public String getSessionIPAddress()
    • getSessionId

      public Optional<String> getSessionId()
    • getStatusMapValue

      public String getStatusMapValue(String key)

      getStatusMapValue.

      Parameters:
      key - a String object.
      Returns:
      a String object.
    • setStatusMapValue

      public void setStatusMapValue(String key, String value)

      setStatusMapValue.

      Parameters:
      key - a String object.
      value - a String object.
    • getStatusMap

      public Map<String,String> getStatusMap()

      Getter for the field statusMap.

      Returns:
      the statusMap
    • setStatusMap

      public void setStatusMap(Map<String,String> statusMap)

      Setter for the field statusMap.

      Parameters:
      statusMap - the statusMap to set
    • getTranslationWithParams

      public String getTranslationWithParams(String msgKey, String... params)
      Returns the translation for the given msgKey and replaces all {i} placeholders with values from the given params.
      Parameters:
      msgKey - Message key to translate
      params - One or more parameter values to replace the placeholders.
      Returns:
      Translated, escaped key with parameter replacements
    • getTranslationWithParamsUnescaped

      public String getTranslationWithParamsUnescaped(String msgKey, String... params)
      Returns the translation for the given msgKey and replaces all {i} placeholders with values from the given params. Does not carry out character escaping
      Parameters:
      msgKey - Message key to translate
      params - One or more parameter values to replace the placeholders.
      Returns:
      Translated, escaped key with parameter replacements
    • getTranslation

      public String getTranslation(String msgKey, String language)
      Returns a simple translation for the given language (or current language, if none given).
      Parameters:
      msgKey - Message key to translate
      language - Optional desired language
      Returns:
      Translated, escaped key
    • getTranslation

      public String getTranslation(String msgKey, String language, boolean escape)
      Returns a simple translation for the given language (or current language, if none given).
      Parameters:
      msgKey - Message key to translate
      language - Optional desired language
      escape - If true the return string will be Java-escaped
      Returns:
      Translated key
    • isDisplayNoIndexMetaTag

      public boolean isDisplayNoIndexMetaTag()
      Checks whether to display a noindex meta tag on the current page.
      Returns:
      true for a set of current page values; false otherwise
    • isDocumentPage

      public boolean isDocumentPage()
      Checks if the current page displays document information, solely based on the String getCurrentPage() The Pages for which this method should return true are set in the PageType class.
      Returns:
      a boolean.
    • getSubThemeDiscriminatorQuerySuffix

      public String getSubThemeDiscriminatorQuerySuffix() throws IndexUnreachableException

      getSubThemeDiscriminatorQuerySuffix.

      Returns:
      a String object.
      Throws:
      IndexUnreachableException - if any.
    • getCurrentPageType

      public PageType getCurrentPageType()
      Get the PageType for the page name from getCurrentPage()
      Returns:
      a PageType object.
    • getPreviousViewUrl

      public String getPreviousViewUrl()

      getPreviousViewUrl.

      Returns:
      a String object.
    • redirectToPreviousView

      public void redirectToPreviousView() throws IOException

      redirectToPreviousView.

      Throws:
      IOException - if any.
    • getCurrentViewUrl

      public String getCurrentViewUrl()

      getCurrentViewUrl.

      Returns:
      a String object.
    • getCurrentViewPrettyUrl

      public String getCurrentViewPrettyUrl()
    • getExitUrl

      public String getExitUrl()
    • getExitUrl

      public String getExitUrl(PageType pageType)
      Parameters:
      pageType -
      Returns:
      Appropriate exit URL
    • resolvePrettyUrl

      public String resolvePrettyUrl(String prettyId, Object... parameters)
      Parameters:
      prettyId -
      parameters -
      Returns:
      Resolved Pretty URL
    • redirectToCurrentView

      public void redirectToCurrentView() throws IOException

      redirectToCurrentView.

      Throws:
      IOException - if any.
    • urlEncode

      public String urlEncode(String s)

      urlEncode.

      Parameters:
      s - a String object.
      Returns:
      a String object.
    • urlEncodeUnicode

      public String urlEncodeUnicode(String s)

      urlEncodeUnicode.

      Parameters:
      s - a String object.
      Returns:
      a String object.
    • getThemeOrSubtheme

      public String getThemeOrSubtheme()

      getThemeOrSubtheme.

      Returns:
      a String object.
    • isSubthemeSelected

      public boolean isSubthemeSelected() throws IndexUnreachableException

      isSubthemeSelected.

      Returns:
      true exactly if getSubThemeDiscriminatorValue() is not blank
      Throws:
      IndexUnreachableException - if any.
    • getVersion

      public String getVersion()

      getVersion.

      Returns:
      a String object.
    • getBuildDate

      public String getBuildDate()

      getBuildDate.

      Returns:
      a String object.
    • getBuildVersion

      public String getBuildVersion()

      getBuildVersion.

      Returns:
      a String object.
    • getApplicationName

      public String getApplicationName()

      getApplicationName.

      Returns:
      a String object.
    • getResource

      public String getResource(String path)
      Get the path to a viewer resource relative to the root path ("/viewer") If it exists, the resource from the theme, otherwise from the core If the resource exists neither in theme nor core. An Exception will be thrown
      Parameters:
      path - The resource path relative to the first "resources" directory
      Returns:
      Resource path
    • isRtl

      public boolean isRtl()
    • isRtl

      public boolean isRtl(String locale)
    • isRtl

      public boolean isRtl(Locale locale)
    • isSolrIndexOnline

      public boolean isSolrIndexOnline()
    • addSearchUrlWithCurrentSortStringToHistory

      public void addSearchUrlWithCurrentSortStringToHistory()
      If the current page url is a search page url without or with empty search parameters replace ViewHistory.getCurrentView(javax.servlet.ServletRequest) with a search url containing the default sort string. This is done so the view history contains the current random seed for random search list sorting and returning to the page yields the same ordering as the original call. Must be called in the pretty mappings for all search urls which deliver randomly sorted hitlists
    • getCurrentTime

      public String getCurrentTime()
      Get the current time in milliseconds as string
      Returns:
      the current time in milliseconds as string
    • getCurrentDate

      public LocalDate getCurrentDate()
      Get the current date as LocalDate
      Returns:
      the current date as LocalDate
    • returnTo

      @Deprecated(forRemoval=true) public String returnTo(String page)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Apparently not used. And should be easily replacable by just entering the 'page' string in the action attribute
      Simply returns the given string to redirect to a page via jsf
      Parameters:
      page - the string to return
      Returns:
      the passed string 'page'
    • getTranslationsAsJson

      public String getTranslationsAsJson(List<String> keys)
      Parameters:
      keys -
      Returns:
      JSON with translations for the given message keys
    • getRange

      public List<Integer> getRange(long from, long to)
    • getAsId

      public String getAsId(String text)