Class NavigationHelper
- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringConstantKEY_CURRENT_VIEW="currentView"protected static final StringConstantKEY_MENU_PAGE="menuPage"protected static final StringConstantKEY_PREFERRED_VIEW="preferredView"protected static final StringConstantKEY_SELECTED_NEWS_ARTICLE="selectedNewsArticle"protected static final StringConstantKEY_SUBTHEME_DISCRIMINATOR_VALUE="subThemeDicriminatorValue" -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidIf the current page url is a search page url without or with empty search parameters replaceViewHistory.getCurrentView(jakarta.servlet.ServletRequest)with a search url containing the default sort string.voidaddStaticLinkToBreadcrumb(String linkName, int linkWeight) Adds a link to the breadcrumbs using the current PrettyURL.voidaddStaticLinkToBreadcrumb(String linkName, String url, int linkWeight) Adds a link to the breadcrumbs using the given URL.browsePage.protected List<LabeledLink> createAdminBreadcrumbs(PageType pageType, List<List<String>> labels) 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.getAdvancedSearchUrl.getApplicationName.getApplicationUrl.getBrowseUrl.getBuildDate.getBuildVersion.getCalendarActiveUrl.getCalendarUrl.static StringgetCMSPageNavigationId(CMSPage cmsPage) Produce an identifier string for a cms page to use for identifying the page in the navigation barGet the current date asLocalDateGetter for the fieldcurrentPage.Get thePageTypefor the page name fromgetCurrentPage()Returns the current PrettyURL.Get the current time in milliseconds as stringgetCurrentUrl.getCurrentView.getCurrentViewUrl.getDatePattern.static StringgetDatePattern(String language) static StringgetDatePattern(Locale locale) Get the date/time pattern for the current locale for use with jQuery date picker.getDefaultLocale.Used for social bookmarks.getExitUrl(PageType pageType) static StringgetFullRequestUrl(jakarta.servlet.http.HttpServletRequest request, String prettyFacesURI) getFullRequestUrl.getFulltextActiveUrl.getFulltextUrl.getImageActiveUrl.getImageUrl.getLastRequestTimestamp.getLocalDate(LocalDateTime date) Returns the string representation of the givenDatebased on the currentlocale.Getter for the fieldlocale.Returns the language code of the currentlocalein the ISO 639-1 (two-character) format.getMenuPage.getMessageValueList(String keyPrefix) getMessageValueList.getMetadataActiveUrl.getMetadataUrl.getObjectUrl.getPageUrl(PageType page) getPageUrl.getPageUrl(String pageType) getPageUrl.Returns the manually selected view type (will be used for search result browsing, if set).getPreviousViewUrl.getRange(long from, long to) Deprecated.renamed to fullscreengetRecordUrl(String pi, String docStructType, int order, boolean anchorOrGroup, boolean hasImages) getRequestPath(jakarta.faces.context.ExternalContext externalContext) getRequestPath.static StringgetRequestPath(jakarta.servlet.http.HttpServletRequest request, String prettyFacesURI) getRequestPath.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.getRssUrl.getSearchUrl.getSearchUrl(int activeSearchType) getSearchUrl.getSearchUrl(int activeSearchType, CMSPage cmsPage) getSearchUrl.getSelectedNewsArticle.getSortUrl.Getter for the fieldstatusMap.getStatusMapValue(String key) getStatusMapValue.getSubThemeDiscriminatorQuerySuffix.Returns the value of the configured sub-theme discriminator field.Returns ISO 639-1 language codes of available JSF locales.Returns ISO 639-1 language codes of available JSF locales as json array.getSupportedLocales.getTermUrl.getTheme()Getter for the fieldtheme.getThemeOrSubtheme.getThumbsActiveUrl.getThumbsUrl.getTimeZone.getTocActiveUrl.getTocUrl.getTranslation(String msgKey, String language) Returns a simple translation for the given language (or current language, if none given).getTranslation(String msgKey, String language, boolean escape) Returns a simple translation for the given language (or current language, if none given).getTranslationsAsJson(List<String> keys) getTranslationWithParams(String msgKey, String... params) Returns the translation for the givenmsgKeyand replaces all {i} placeholders with values from the givenparams.getTranslationWithParamsUnescaped(String msgKey, String... params) Returns the translation for the givenmsgKeyand replaces all {i} placeholders with values from the givenparams.getVersion.getViewAction(String view) getViewAction.homePage()homePage.voidinit()init.booleanisCmsPage.booleanChecks whether to display a noindex meta tag on the current page.booleanChecks 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.booleanisRtl()booleanbooleanbooleanbooleanisSubthemeSelected.voidredirectToCurrentView.voidredirectToPreviousView.voidreload()reload.voidresetCurrentPage.voidresetTheme.resolvePrettyUrl(String prettyId, Object... parameters) Deprecated, for removal: This API element is subject to removal in a future version.Apparently not used.searchPage.voidsetBreadcrumbBean(BreadcrumbBean breadcrumbBean) Required setter for ManagedProperty injectionvoidsetCmsBean(CmsBean cmsBean) voidsetCmsPage(boolean isCmsPage) setCmsPage.voidsetCrowdsourcingAnnotationPage(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 identifiervoidsetCurrentBreadcrumbPage(String pageName, String pageWeight, String pageURL) setCurrentBreadcrumbPage.voidsetCurrentPage(CMSPage cmsPage) voidsetCurrentPage(String currentPage) Setter for the fieldcurrentPage.voidsetCurrentPage(String currentPage, boolean resetBreadcrubs, boolean resetCurrentDocument) Setter for the fieldcurrentPage.voidsetCurrentPage(String currentPage, boolean resetBreadcrubs, boolean resetCurrentDocument, boolean setCmsPage) Setter for the fieldcurrentPage.voidsetCurrentPageAdmin.voidsetCurrentPageAdmin(String pageName) setCurrentPageAdmin.voidsetCurrentPageAdmin(String pageName, List<List<String>> labels) voidsetCurrentPageBrowse.voidsetCurrentPageBrowse(CollectionView collection) setCurrentPageBrowse.voidsetCurrentPageIndex.voidsetCurrentPageSearch.voidsetCurrentPageSearchTermList.voidsetCurrentPageSitelinks.voidsetCurrentPageStatistics.voidsetCurrentPageTags.voidsetCurrentPageTimeMatrix.voidsetCurrentPageUser.voidsetCurrentView(String currentView) Sets the currently selected content view name.voidsetLocaleString(String inLocale) setLocaleString.voidsetMenuPage(String page) setMenuPage.voidsetPreferredView(String preferredView) Sets the manually selected view type (will be used for search result browsing, if set).voidsetSelectedNewsArticle.voidsetStatusMap(Map<String, String> statusMap) Setter for the fieldstatusMap.voidsetStatusMapValue(String key, String value) setStatusMapValue.voidvoidsetSubThemeDiscriminatorValue(String subThemeDiscriminatorValue) setSubThemeDiscriminatorValue.urlEncode.urlEncodeUnicode.
-
Field Details
-
KEY_CURRENT_VIEW
ConstantKEY_CURRENT_VIEW="currentView"- See Also:
-
KEY_PREFERRED_VIEW
ConstantKEY_PREFERRED_VIEW="preferredView"- See Also:
-
KEY_SELECTED_NEWS_ARTICLE
ConstantKEY_SELECTED_NEWS_ARTICLE="selectedNewsArticle"- See Also:
-
KEY_MENU_PAGE
ConstantKEY_MENU_PAGE="menuPage"- See Also:
-
KEY_SUBTHEME_DISCRIMINATOR_VALUE
ConstantKEY_SUBTHEME_DISCRIMINATOR_VALUE="subThemeDicriminatorValue"- See Also:
-
-
Constructor Details
-
NavigationHelper
public NavigationHelper()Empty constructor.
-
-
Method Details
-
setCmsBean
-
init
@PostConstruct public void init()init.
-
setBreadcrumbBean
Required setter for ManagedProperty injection- Parameters:
breadcrumbBean- the breadcrumbBean to set
-
searchPage
searchPage.
- Returns:
- a
Stringobject.
-
homePage
homePage.
- Returns:
- a
Stringobject.
-
browsePage
browsePage.
- Returns:
- a
Stringobject.
-
getCurrentPage
Getter for the field
currentPage.- Returns:
- a
Stringobject.
-
isCmsPage
public boolean isCmsPage()isCmsPage.
- Returns:
- the isCmsPage
-
setCmsPage
public void setCmsPage(boolean isCmsPage) setCmsPage.
- Parameters:
isCmsPage- the isCmsPage to set
-
setCurrentPage
- Parameters:
cmsPage-
-
setCurrentPage
Setter for the field
currentPage.- Parameters:
currentPage- aStringobject.
-
setCurrentPage
public void setCurrentPage(String currentPage, boolean resetBreadcrubs, boolean resetCurrentDocument) Setter for the field
currentPage.- Parameters:
currentPage- aStringobject.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- aStringobject.resetBreadcrubs- a boolean.resetCurrentDocument- a boolean.setCmsPage- a boolean.
-
setCurrentBreadcrumbPage
setCurrentBreadcrumbPage.
-
getPreferredView
Returns the manually selected view type (will be used for search result browsing, if set).- Returns:
- a
Stringobject.
-
setPreferredView
Sets the manually selected view type (will be used for search result browsing, if set).- Parameters:
preferredView- aStringobject.
-
setCurrentPageIndex
public void setCurrentPageIndex()setCurrentPageIndex.
-
setCurrentPageSearch
public void setCurrentPageSearch()setCurrentPageSearch.
-
setCurrentPageBrowse
public void setCurrentPageBrowse()setCurrentPageBrowse.
-
setCurrentPageBrowse
setCurrentPageBrowse.
- Parameters:
collection- aCollectionViewobject.
-
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- aCampaignobject.pi- aStringobject.status- aCrowdsourcingStatusobject.
-
setCurrentPageUser
public void setCurrentPageUser()setCurrentPageUser.
-
setCurrentPageAdmin
setCurrentPageAdmin.
- Parameters:
pageName- aStringobject.
-
setCurrentPageAdmin
-
createAdminBreadcrumbs
- Parameters:
pageType-labels-- Returns:
- List
-
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
getViewAction.
-
getCurrentView
getCurrentView.
- Returns:
- the currentView
-
setCurrentView
Sets the currently selected content view name.- Parameters:
currentView- aStringobject.
-
getDefaultLocale
getDefaultLocale.
- Returns:
- a
Localeobject.
-
getLocale
Getter for the field
locale.- Returns:
- a
Localeobject.
-
getLocaleString
Returns the language code of the current
localein the ISO 639-1 (two-character) format.- Returns:
- a
Stringobject.
-
getSupportedLocales
getSupportedLocales.
- Returns:
- a
Iteratorobject.
-
getSupportedLanguages
Returns ISO 639-1 language codes of available JSF locales.- Returns:
- a
Listobject.
-
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
setLocaleString.
- Parameters:
inLocale- aStringobject.
-
getDatePattern
getDatePattern.
- Returns:
- a
Stringobject.
-
getDatePattern
-
getDatePattern
-
getDatePatternjQueryDatePicker
Get the date/time pattern for the current locale for use with jQuery date picker. Uses the value ofgetDatePattern()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
- Returns:
- Appropriate date/time pattern for the current locale
-
reload
public void reload()reload.
-
getApplicationUrl
getApplicationUrl.
- Returns:
- a
Stringobject.
-
getEncodedUrl
Used for social bookmarks.- Returns:
- a
Stringobject.
-
getCurrentUrl
getCurrentUrl.
- Returns:
- a
Stringobject.
-
getRssUrl
getRssUrl.
- Returns:
- a
Stringobject.
-
getRequestPath
getRequestPath.
- Parameters:
externalContext- aExternalContextobject.- Returns:
- the complete Request Path, eg http://hostname.de/viewer/pathxyz/pathxyz/
-
getRequestPath
public static String getRequestPath(jakarta.servlet.http.HttpServletRequest request, String prettyFacesURI) getRequestPath.
-
getFullRequestUrl
public static String getFullRequestUrl(jakarta.servlet.http.HttpServletRequest request, String prettyFacesURI) getFullRequestUrl.
-
getCurrentPrettyUrl
Returns the current PrettyURL.- Returns:
- a
Stringobject.
-
getTimeZone
getTimeZone.
- Returns:
- a
TimeZoneobject.
-
setMenuPage
setMenuPage.
- Parameters:
page- aStringobject.
-
getMenuPage
getMenuPage.
- Returns:
- a
Stringobject.
-
getTheme
Getter for the field
theme.- Returns:
- a
Stringobject.
-
getSubThemeDiscriminatorValue
Returns the value of the configured sub-theme discriminator field. The value can be set viasetSubThemeDiscriminatorValue(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
Stringobject. - Throws:
IndexUnreachableException- if any.
-
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
setSubThemeDiscriminatorValue.
- Parameters:
subThemeDiscriminatorValue- aStringobject.
-
resetTheme
public void resetTheme()resetTheme.
-
getObjectUrl
getObjectUrl.
- Returns:
- a
Stringobject.
-
getImageUrl
getImageUrl.
- Returns:
- a
Stringobject.
-
getCurrentPageTypeUrl
-
getImageActiveUrl
getImageActiveUrl.
- Returns:
- a
Stringobject.
-
getReadingModeUrl
Deprecated.renamed to fullscreengetReadingModeUrl.
- Returns:
- the reading mode url
-
getCalendarUrl
getCalendarUrl.
- Returns:
- a
Stringobject.
-
getCalendarActiveUrl
getCalendarActiveUrl.
- Returns:
- a
Stringobject.
-
getTocUrl
getTocUrl.
- Returns:
- a
Stringobject.
-
getTocActiveUrl
getTocActiveUrl.
- Returns:
- a
Stringobject.
-
getThumbsUrl
getThumbsUrl.
- Returns:
- a
Stringobject.
-
getThumbsActiveUrl
getThumbsActiveUrl.
- Returns:
- a
Stringobject.
-
getMetadataUrl
getMetadataUrl.
- Returns:
- a
Stringobject.
-
getMetadataActiveUrl
getMetadataActiveUrl.
- Returns:
- a
Stringobject.
-
getFulltextUrl
getFulltextUrl.
- Returns:
- a
Stringobject.
-
getFulltextActiveUrl
getFulltextActiveUrl.
- Returns:
- a
Stringobject.
-
getRecordUrl
public String getRecordUrl(String pi, String docStructType, int order, boolean anchorOrGroup, boolean hasImages) - Parameters:
pi-docStructType-order-anchorOrGroup-hasImages-- Returns:
- Record URL
-
getSearchUrl
getSearchUrl.
- Returns:
- a
Stringobject.
-
getAdvancedSearchUrl
getAdvancedSearchUrl.
- Returns:
- a
Stringobject.
-
getPageUrl
getPageUrl.
-
getPageUrl
getPageUrl.
-
getSearchUrl
getSearchUrl.
- Parameters:
activeSearchType- a int.- Returns:
- a
Stringobject.
-
getSearchUrl
getSearchUrl.
- Parameters:
activeSearchType- a int.cmsPage-- Returns:
- a
Stringobject.
-
getTermUrl
getTermUrl.
- Returns:
- a
Stringobject.
-
getBrowseUrl
getBrowseUrl.
- Returns:
- a
Stringobject.
-
getSortUrl
getSortUrl.
- Returns:
- a
Stringobject.
-
addStaticLinkToBreadcrumb
Adds a link to the breadcrumbs using the current PrettyURL. Can be called from XHTML.- Parameters:
linkName- aStringobject.linkWeight- a int.
-
addStaticLinkToBreadcrumb
Adds a link to the breadcrumbs using the given URL. Can be called from XHTML. -
getLocalDate
Returns the string representation of the givenDatebased on the currentlocale.- Parameters:
date- aLocalDateTimeobject.- Returns:
- a
Stringobject.
-
getMessageValueList
getMessageValueList.
-
setSelectedNewsArticle
setSelectedNewsArticle.
- Parameters:
art- aStringobject.
-
getSelectedNewsArticle
getSelectedNewsArticle.
- Returns:
- a
Stringobject.
-
getLastRequestTimestamp
getLastRequestTimestamp.
- Returns:
- a
Stringobject.
-
getSessionIPAddress
-
getSessionId
-
getStatusMapValue
getStatusMapValue.
-
setStatusMapValue
setStatusMapValue.
-
getStatusMap
Getter for the field
statusMap.- Returns:
- the statusMap
-
setStatusMap
Setter for the field
statusMap.- Parameters:
statusMap- the statusMap to set
-
getTranslationWithParams
Returns the translation for the givenmsgKeyand replaces all {i} placeholders with values from the givenparams.- Parameters:
msgKey- Message key to translateparams- One or more parameter values to replace the placeholders.- Returns:
- Translated, escaped key with parameter replacements
-
getTranslationWithParamsUnescaped
Returns the translation for the givenmsgKeyand replaces all {i} placeholders with values from the givenparams. Does not carry out character escaping- Parameters:
msgKey- Message key to translateparams- One or more parameter values to replace the placeholders.- Returns:
- Translated, escaped key with parameter replacements
-
getTranslation
Returns a simple translation for the given language (or current language, if none given).- Parameters:
msgKey- Message key to translatelanguage- Optional desired language- Returns:
- Translated, escaped key
-
getTranslation
Returns a simple translation for the given language (or current language, if none given).- Parameters:
msgKey- Message key to translatelanguage- Optional desired languageescape- 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
getSubThemeDiscriminatorQuerySuffix.
- Returns:
- a
Stringobject. - Throws:
IndexUnreachableException- if any.
-
getCurrentPageType
Get thePageTypefor the page name fromgetCurrentPage()- Returns:
- a
PageTypeobject.
-
getPreviousViewUrl
getPreviousViewUrl.
- Returns:
- a
Stringobject.
-
redirectToPreviousView
redirectToPreviousView.
- Throws:
IOException- if any.
-
getCurrentViewUrl
getCurrentViewUrl.
- Returns:
- a
Stringobject.
-
getCurrentViewPrettyUrl
-
getExitUrl
-
getExitUrl
- Parameters:
pageType-- Returns:
- Appropriate exit URL
-
resolvePrettyUrl
- Parameters:
prettyId-parameters-- Returns:
- Resolved Pretty URL
-
redirectToCurrentView
redirectToCurrentView.
- Throws:
IOException- if any.
-
urlEncode
urlEncode.
-
urlEncodeUnicode
urlEncodeUnicode.
-
getThemeOrSubtheme
getThemeOrSubtheme.
- Returns:
- a
Stringobject.
-
isSubthemeSelected
isSubthemeSelected.
- Returns:
- true exactly if
getSubThemeDiscriminatorValue()is not blank - Throws:
IndexUnreachableException- if any.
-
getVersion
getVersion.
- Returns:
- a
Stringobject.
-
getBuildDate
getBuildDate.
- Returns:
- a
Stringobject.
-
getBuildVersion
getBuildVersion.
- Returns:
- a
Stringobject.
-
getApplicationName
getApplicationName.
- Returns:
- a
Stringobject.
-
getResource
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
-
isRtl
-
isSolrIndexOnline
public boolean isSolrIndexOnline() -
addSearchUrlWithCurrentSortStringToHistory
public void addSearchUrlWithCurrentSortStringToHistory()If the current page url is a search page url without or with empty search parameters replaceViewHistory.getCurrentView(jakarta.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
Get the current time in milliseconds as string- Returns:
- the current time in milliseconds as string
-
getCurrentDate
Get the current date asLocalDate- Returns:
- the current date as
LocalDate
-
returnTo
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 attributeSimply returns the given string to redirect to a page via jsf- Parameters:
page- the string to return- Returns:
- the passed string 'page'
-
getTranslationsAsJson
- Parameters:
keys-- Returns:
- JSON with translations for the given message keys
-
getRange
-
getAsId
-