Class NavigationHelper

    • Field Detail

      • KEY_CURRENT_VIEW

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

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

        protected static final String KEY_SELECTED_NEWS_ARTICLE
        Constant KEY_SELECTED_NEWS_ARTICLE="selectedNewsArticle"
        See Also:
        Constant Field Values
      • KEY_SUBTHEME_DISCRIMINATOR_VALUE

        protected static final String KEY_SUBTHEME_DISCRIMINATOR_VALUE
        Constant KEY_SUBTHEME_DISCRIMINATOR_VALUE="subThemeDicriminatorValue"
        See Also:
        Constant Field Values
      • statusMap

        protected Map<String,​String> statusMap
        Map for setting any navigation status variables. Replaces currentView, etc.
    • Constructor Detail

      • NavigationHelper

        public NavigationHelper()
        Empty constructor.
    • Method Detail

      • 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:
      • setCurrentPage

        public void setCurrentPage​(CMSPage 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 io.goobi.viewer.model.crowdsourcing.campaigns.CampaignRecordStatistic.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)
      • 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)
                            throws DAOException
        Sets the currently selected content view name.
        Parameters:
        currentView - a String object.
        Throws:
        DAOException
      • 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.
      • getDatePatternjQueryDatePicker

        public String getDatePatternjQueryDatePicker()

        getDatePatternjQueryDatePicker.

        Returns:
        a String object.
      • getDateTimePattern

        public String getDateTimePattern()
        Returns:
      • 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

        public String getReadingModeUrl()
        Deprecated.
        renamed to fullscreen

        getReadingModeUrl.

        Returns:
        the reading mode url
      • 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.
      • getSearchUrl

        public String getSearchUrl​(int activeSearchType)

        getSearchUrl.

        Parameters:
        activeSearchType - a int.
        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.
        linkWeight - a int.
        url - a String object.
      • 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()
      • 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.
      • 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()
      • resolvePrettyUrl

        public String resolvePrettyUrl​(String prettyId,
                                       Object... parameters)
      • 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.
      • 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:
      • 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()
      • getTranslationsAsJson

        public String getTranslationsAsJson​(List<String> keys)
      • getRange

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