Class NavigationHelper
- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
ConstantKEY_CURRENT_VIEW="currentView"
protected static final String
ConstantKEY_MENU_PAGE="menuPage"
protected static final String
ConstantKEY_PREFERRED_VIEW="preferredView"
protected static final String
ConstantKEY_SELECTED_NEWS_ARTICLE="selectedNewsArticle"
protected static final String
ConstantKEY_SUBTHEME_DISCRIMINATOR_VALUE="subThemeDicriminatorValue"
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
If the current page url is a search page url without or with empty search parameters replaceViewHistory.getCurrentView(javax.servlet.ServletRequest)
with a search url containing the default sort string.void
addStaticLinkToBreadcrumb
(String linkName, int linkWeight) Adds a link to the breadcrumbs using the current PrettyURL.void
addStaticLinkToBreadcrumb
(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 String
getCMSPageNavigationId
(CMSPage cmsPage) Produce an identifier string for a cms page to use for identifying the page in the navigation barGet the current date asLocalDate
Getter for the fieldcurrentPage
.Get thePageType
for the page name fromgetCurrentPage()
Returns the current PrettyURL.Get the current time in milliseconds as stringgetCurrentUrl.getCurrentView.getCurrentViewUrl.getDatePattern.static String
getDatePattern
(String language) static String
getDatePattern
(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 String
getFullRequestUrl
(javax.servlet.http.HttpServletRequest request, String prettyFacesURI) getFullRequestUrl.getFulltextActiveUrl.getFulltextUrl.getImageActiveUrl.getImageUrl.getLastRequestTimestamp.getLocalDate
(LocalDateTime date) Returns the string representation of the givenDate
based on the currentlocale
.Getter for the fieldlocale
.Returns the language code of the currentlocale
in 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 fullscreengetRequestPath
(javax.faces.context.ExternalContext externalContext) getRequestPath.static String
getRequestPath
(javax.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 givenmsgKey
and replaces all {i} placeholders with values from the givenparams
.getTranslationWithParamsUnescaped
(String msgKey, String... params) Returns the translation for the givenmsgKey
and replaces all {i} placeholders with values from the givenparams
.getVersion.getViewAction
(String view) getViewAction.This method checks the Solr height attribute of the current page.homePage()
homePage.void
init()
init.boolean
isCmsPage.boolean
Checks whether to display a noindex meta tag on the current page.boolean
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.boolean
isRtl()
boolean
boolean
boolean
boolean
isSubthemeSelected.void
redirectToCurrentView.void
redirectToPreviousView.void
reload()
reload.void
resetCurrentPage.void
resetTheme.resolvePrettyUrl
(String prettyId, Object... parameters) Deprecated, for removal: This API element is subject to removal in a future version.Apparently not used.searchPage.void
setBreadcrumbBean
(BreadcrumbBean breadcrumbBean) Required setter for ManagedProperty injectionvoid
setCmsBean
(CmsBean cmsBean) void
setCmsPage
(boolean isCmsPage) setCmsPage.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 identifiervoid
setCurrentBreadcrumbPage
(String pageName, String pageWeight, String pageURL) setCurrentBreadcrumbPage.void
setCurrentPage
(CMSPage cmsPage) void
setCurrentPage
(String currentPage) Setter for the fieldcurrentPage
.void
setCurrentPage
(String currentPage, boolean resetBreadcrubs, boolean resetCurrentDocument) Setter for the fieldcurrentPage
.void
setCurrentPage
(String currentPage, boolean resetBreadcrubs, boolean resetCurrentDocument, boolean setCmsPage) Setter for the fieldcurrentPage
.void
setCurrentPageAdmin.void
setCurrentPageAdmin
(String pageName) setCurrentPageAdmin.void
setCurrentPageAdmin
(String pageName, List<List<String>> labels) void
setCurrentPageBrowse.void
setCurrentPageBrowse
(CollectionView collection) setCurrentPageBrowse.void
setCurrentPageIndex.void
setCurrentPageSearch.void
setCurrentPageSearchTermList.void
setCurrentPageSitelinks.void
setCurrentPageStatistics.void
setCurrentPageTags.void
setCurrentPageTimeMatrix.void
setCurrentPageUser.void
setCurrentView
(String currentView) Sets the currently selected content view name.void
setLocaleString
(String inLocale) setLocaleString.void
setMenuPage
(String page) setMenuPage.void
setPreferredView
(String preferredView) Sets the manually selected view type (will be used for search result browsing, if set).void
setSelectedNewsArticle.void
setStatusMap
(Map<String, String> statusMap) Setter for the fieldstatusMap
.void
setStatusMapValue
(String key, String value) setStatusMapValue.void
void
setSubThemeDiscriminatorValue
(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
String
object.
-
homePage
homePage.
- Returns:
- a
String
object.
-
browsePage
browsePage.
- Returns:
- a
String
object.
-
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
-
setCurrentPage
- Parameters:
cmsPage
-
-
setCurrentPage
Setter for the field
currentPage
.- Parameters:
currentPage
- aString
object.
-
setCurrentPage
public void setCurrentPage(String currentPage, boolean resetBreadcrubs, boolean resetCurrentDocument) Setter for the field
currentPage
.- Parameters:
currentPage
- aString
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
- aString
object.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
String
object.
-
setPreferredView
Sets the manually selected view type (will be used for search result browsing, if set).- Parameters:
preferredView
- aString
object.
-
setCurrentPageIndex
public void setCurrentPageIndex()setCurrentPageIndex.
-
setCurrentPageSearch
public void setCurrentPageSearch()setCurrentPageSearch.
-
setCurrentPageBrowse
public void setCurrentPageBrowse()setCurrentPageBrowse.
-
setCurrentPageBrowse
setCurrentPageBrowse.
- Parameters:
collection
- aCollectionView
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
- aCampaign
object.pi
- aString
object.status
- aCrowdsourcingStatus
object.
-
setCurrentPageUser
public void setCurrentPageUser()setCurrentPageUser.
-
setCurrentPageAdmin
setCurrentPageAdmin.
- Parameters:
pageName
- aString
object.
-
setCurrentPageAdmin
-
createAdminBreadcrumbs
-
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
- aString
object.
-
getDefaultLocale
getDefaultLocale.
- Returns:
- a
Locale
object.
-
getLocale
Getter for the field
locale
.- Returns:
- a
Locale
object.
-
getLocaleString
Returns the language code of the current
locale
in the ISO 639-1 (two-character) format.- Returns:
- a
String
object.
-
getSupportedLocales
getSupportedLocales.
- Returns:
- a
Iterator
object.
-
getSupportedLanguages
Returns ISO 639-1 language codes of available JSF locales.- Returns:
- a
List
object.
-
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
- aString
object.
-
getDatePattern
getDatePattern.
- Returns:
- a
String
object.
-
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
String
object.
-
getEncodedUrl
Used for social bookmarks.- Returns:
- a
String
object.
-
getCurrentUrl
getCurrentUrl.
- Returns:
- a
String
object.
-
getRssUrl
getRssUrl.
- Returns:
- a
String
object.
-
getRequestPath
getRequestPath.
- Parameters:
externalContext
- aExternalContext
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.
-
getFullRequestUrl
public static String getFullRequestUrl(javax.servlet.http.HttpServletRequest request, String prettyFacesURI) getFullRequestUrl.
-
getCurrentPrettyUrl
Returns the current PrettyURL.- Returns:
- a
String
object.
-
getTimeZone
getTimeZone.
- Returns:
- a
TimeZone
object.
-
setMenuPage
setMenuPage.
- Parameters:
page
- aString
object.
-
getMenuPage
getMenuPage.
- Returns:
- a
String
object.
-
getTheme
Getter for the field
theme
.- Returns:
- a
String
object.
-
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
String
object. - 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
- aString
object.
-
resetTheme
public void resetTheme()resetTheme.
-
getObjectUrl
getObjectUrl.
- Returns:
- a
String
object.
-
getImageUrl
getImageUrl.
- Returns:
- a
String
object.
-
getCurrentPageTypeUrl
-
getImageActiveUrl
getImageActiveUrl.
- Returns:
- a
String
object.
-
getReadingModeUrl
Deprecated.renamed to fullscreengetReadingModeUrl.
- Returns:
- the reading mode url
-
getViewImagePathFullscreen
public String getViewImagePathFullscreen() throws IndexUnreachableException, DAOException, ViewerConfigurationExceptionThis 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
getCalendarUrl.
- Returns:
- a
String
object.
-
getCalendarActiveUrl
getCalendarActiveUrl.
- Returns:
- a
String
object.
-
getTocUrl
getTocUrl.
- Returns:
- a
String
object.
-
getTocActiveUrl
getTocActiveUrl.
- Returns:
- a
String
object.
-
getThumbsUrl
getThumbsUrl.
- Returns:
- a
String
object.
-
getThumbsActiveUrl
getThumbsActiveUrl.
- Returns:
- a
String
object.
-
getMetadataUrl
getMetadataUrl.
- Returns:
- a
String
object.
-
getMetadataActiveUrl
getMetadataActiveUrl.
- Returns:
- a
String
object.
-
getFulltextUrl
getFulltextUrl.
- Returns:
- a
String
object.
-
getFulltextActiveUrl
getFulltextActiveUrl.
- Returns:
- a
String
object.
-
getSearchUrl
getSearchUrl.
- Returns:
- a
String
object.
-
getAdvancedSearchUrl
getAdvancedSearchUrl.
- Returns:
- a
String
object.
-
getPageUrl
getPageUrl.
-
getPageUrl
getPageUrl.
-
getSearchUrl
getSearchUrl.
- Parameters:
activeSearchType
- a int.- Returns:
- a
String
object.
-
getSearchUrl
getSearchUrl.
- Parameters:
activeSearchType
- a int.cmsPage
-- Returns:
- a
String
object.
-
getTermUrl
getTermUrl.
- Returns:
- a
String
object.
-
getBrowseUrl
getBrowseUrl.
- Returns:
- a
String
object.
-
getSortUrl
getSortUrl.
- Returns:
- a
String
object.
-
addStaticLinkToBreadcrumb
Adds a link to the breadcrumbs using the current PrettyURL. Can be called from XHTML.- Parameters:
linkName
- aString
object.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 givenDate
based on the currentlocale
.- Parameters:
date
- aLocalDateTime
object.- Returns:
- a
String
object.
-
getMessageValueList
getMessageValueList.
-
setSelectedNewsArticle
setSelectedNewsArticle.
- Parameters:
art
- aString
object.
-
getSelectedNewsArticle
getSelectedNewsArticle.
- Returns:
- a
String
object.
-
getLastRequestTimestamp
getLastRequestTimestamp.
- Returns:
- a
String
object.
-
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 givenmsgKey
and 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 givenmsgKey
and 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
String
object. - Throws:
IndexUnreachableException
- if any.
-
getCurrentPageType
Get thePageType
for the page name fromgetCurrentPage()
- Returns:
- a
PageType
object.
-
getPreviousViewUrl
getPreviousViewUrl.
- Returns:
- a
String
object.
-
redirectToPreviousView
redirectToPreviousView.
- Throws:
IOException
- if any.
-
getCurrentViewUrl
getCurrentViewUrl.
- Returns:
- a
String
object.
-
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
String
object.
-
isSubthemeSelected
isSubthemeSelected.
- Returns:
- true exactly if
getSubThemeDiscriminatorValue()
is not blank - Throws:
IndexUnreachableException
- if any.
-
getVersion
getVersion.
- Returns:
- a
String
object.
-
getBuildDate
getBuildDate.
- Returns:
- a
String
object.
-
getBuildVersion
getBuildVersion.
- Returns:
- a
String
object.
-
getApplicationName
getApplicationName.
- Returns:
- a
String
object.
-
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(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
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
-