Package io.goobi.viewer.managedbeans
Class NavigationHelper
java.lang.Object
io.goobi.viewer.managedbeans.NavigationHelper
- All Implemented Interfaces:
Serializable
JSF session-scoped backing bean providing navigation state, URL building, and breadcrumb
tracking for the viewer frontend. Initialised via
@PostConstruct init() which resolves
the user's locale from the current JSF view root and seeds the status map with default values.
Lifecycle: Created once per HTTP session; survives across page navigations and is destroyed when the session expires.
Thread safety: Not explicitly synchronised; all state is expected to be accessed from the JSF request thread of the owning session only.
- 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
ConstructorsConstructorDescriptionEmpty constructor.NavigationHelper(String theme, FileResourceManager fileResourceManager) -
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.Deprecated.Deprecated.Calendar view has been retired; usegetTocUrl()static StringgetCMSPageNavigationId(CMSPage cmsPage) Produce an identifier string for a cms page to use for identifying the page in the navigation bar.Get the current date asLocalDate.Getter for the fieldcurrentPage.Get thePageTypefor the page name fromgetCurrentPage().Returns the current PrettyURL.Gets the current time in milliseconds as string.getCurrentUrl.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(HttpServletRequest request, String prettyFacesURI) getFullRequestUrl.getFulltextActiveUrl.getFulltextUrl.getImageActiveUrl.getImageUrl.getLastRequestTimestamp.getLicenceIconResources(List<String> icons) Resolves a list of licence icon names to their resource URIs, filtering out any icons whose resolved path is blank or a directory (trailing slash).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.getMeiActiveUrl.getMeiUrl.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) getRecordUrl(String pi, String docStructType, int order, boolean anchorOrGroup, boolean hasImages) getRequestPath(ExternalContext externalContext) getRequestPath.static StringgetRequestPath(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.getResource(String path, boolean considerAlternativeSuffixes) 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.getResource(String path, List<String> alternativeSuffixes) 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) searchPage.voidsetActiveDocumentBean(ActiveDocumentBean activeDocumentBean) Setter for testing — allows injecting a mock ActiveDocumentBean without CDI.voidsetBreadcrumbBean(BreadcrumbBean breadcrumbBean) Required setter for ManagedProperty injection.voidsetBrowseBean(BrowseBean browseBean) Setter for testing — allows injecting a mock BrowseBean without CDI.voidsetCalendarBean(CalendarBean calendarBean) Setter for testing — allows injecting a mock CalendarBean without CDI.voidsetCmsBean(CmsBean cmsBean) voidsetCmsPage(boolean isCmsPage) setCmsPage.voidsetCrowdsourcingAnnotationPage(Campaign campaign, String pi, CrowdsourcingStatus status) Sets the current page to a crowdsourcing annotation page with the given campaign as parent and the given pi as current identifier.voidsetCurrentBreadcrumbPage(String pageName, String pageWeight, String pageURL) setCurrentBreadcrumbPage.voidsetCurrentPage(CMSPage cmsPage) Sets the CMS page as the current page for navigation purposes.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.voidsetCurrentPageForError(String errorType) Sets the current page for the error page, mapping generic error types (general, general_no_url) to the "error" page name so that the browser title shows "Fehler" instead of unrelated translations.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).voidsetSearchBean(SearchBean searchBean) Setter for testing — allows injecting a mock SearchBean without CDI.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. -
NavigationHelper
-
-
Method Details
-
setCmsBean
-
setActiveDocumentBean
Setter for testing — allows injecting a mock ActiveDocumentBean without CDI. -
setBrowseBean
Setter for testing — allows injecting a mock BrowseBean without CDI. -
setSearchBean
Setter for testing — allows injecting a mock SearchBean without CDI. -
setCalendarBean
Setter for testing — allows injecting a mock CalendarBean without CDI. -
init
init. -
setBreadcrumbBean
Required setter for ManagedProperty injection.- Parameters:
breadcrumbBean- breadcrumb bean to inject
-
searchPage
searchPage.- Returns:
- the search page name after setting it as the current navigation page
-
homePage
homePage.- Returns:
- the home page name after setting it as the current navigation page
-
browsePage
browsePage.- Returns:
- the browse page name after setting it as the current navigation page
-
getCurrentPage
Getter for the fieldcurrentPage.- Returns:
- the name of the currently active navigation page, with quotes escaped
-
isCmsPage
public boolean isCmsPage()isCmsPage.- Returns:
- true if the current page is a CMS page, false otherwise
-
setCmsPage
public void setCmsPage(boolean isCmsPage) setCmsPage.- Parameters:
isCmsPage- true if the current page is a CMS page
-
setCurrentPage
Sets the CMS page as the current page for navigation purposes.Skips execution on JSF postback requests to avoid triggering during AJAX calls, which could conflict with parallel record loads. This mirrors the former
<f:viewAction onPostback="false">behavior that was declared in the view.- Parameters:
cmsPage- CMS page to set as current page
-
setCurrentPage
Setter for the fieldcurrentPage.- Parameters:
currentPage- page name to set as current
-
setCurrentPageForError
Sets the current page for the error page, mapping generic error types (general, general_no_url) to the "error" page name so that the browser title shows "Fehler" instead of unrelated translations.Specific error types (e.g. recordNotFound, download) are passed through directly so that their own message keys are used as the page title.
- Parameters:
errorType- the error type string set by the exception handler; may be null
-
setCurrentPage
public void setCurrentPage(String currentPage, boolean resetBreadcrubs, boolean resetCurrentDocument) Setter for the fieldcurrentPage.- Parameters:
currentPage- page name to set as currentresetBreadcrubs- if true, reset breadcrumbsresetCurrentDocument- if true, reset the loaded document
-
setCurrentPage
public void setCurrentPage(String currentPage, boolean resetBreadcrubs, boolean resetCurrentDocument, boolean setCmsPage) Setter for the fieldcurrentPage.- Parameters:
currentPage- page name to set as currentresetBreadcrubs- if true, reset breadcrumbsresetCurrentDocument- if true, reset the loaded documentsetCmsPage- if true, mark current page as CMS page
-
setCurrentBreadcrumbPage
setCurrentBreadcrumbPage.- Parameters:
pageName- display name for the breadcrumb entrypageWeight- breadcrumb sort weight as stringpageURL- relative URL for the breadcrumb link
-
getPreferredView
Returns the manually selected view type (will be used for search result browsing, if set).- Returns:
- the manually selected view type name, or null if none has been set
-
setPreferredView
Sets the manually selected view type (will be used for search result browsing, if set).- Parameters:
preferredView- view type name to set as preferred
-
setCurrentPageIndex
public void setCurrentPageIndex()setCurrentPageIndex. -
setCurrentPageSearch
public void setCurrentPageSearch()setCurrentPageSearch. -
setCurrentPageBrowse
public void setCurrentPageBrowse()setCurrentPageBrowse. -
setCurrentPageBrowse
setCurrentPageBrowse.- Parameters:
collection- collection view to use for the breadcrumb link
-
setCurrentPageTags
public void setCurrentPageTags()setCurrentPageTags. -
setCurrentPageStatistics
public void setCurrentPageStatistics()setCurrentPageStatistics. -
setCrowdsourcingAnnotationPage
public void setCrowdsourcingAnnotationPage(Campaign campaign, String pi, CrowdsourcingStatus status) Sets the current page to a crowdsourcing annotation page with the given campaign as parent and the given pi as current identifier.- Parameters:
campaign- crowdsourcing campaign to use as breadcrumb parentpi- persistent identifier of the record being annotatedstatus- annotation or review status determining the URL action segment
-
setCurrentPageUser
public void setCurrentPageUser()setCurrentPageUser. -
setCurrentPageAdmin
setCurrentPageAdmin.- Parameters:
pageName- admin page name to activate
-
setCurrentPageAdmin
-
createAdminBreadcrumbs
- Parameters:
pageType- page type for which the breadcrumb hierarchy is builtlabels- optional label overrides for each breadcrumb level- 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.- Parameters:
view- view name to return as action string- Returns:
- the given view name unchanged, for use as a JSF action outcome
-
getCurrentView
getCurrentView.- Returns:
- the name of the currently selected content view
-
setCurrentView
Sets the currently selected content view name.- Parameters:
currentView- view name to set as current
-
getDefaultLocale
getDefaultLocale.- Returns:
- the default locale from the JSF application, or null if no FacesContext is available
-
getLocale
Getter for the fieldlocale.- Returns:
- the currently active locale
-
getLocaleString
Returns the language code of the currentlocalein the ISO 639-1 (two-character) format.- Returns:
- the two-character ISO 639-1 language code of the current locale
-
getSupportedLocales
getSupportedLocales.- Returns:
- an iterator over all supported application locales
-
getSupportedLanguages
Returns ISO 639-1 language codes of available JSF locales.- Returns:
- a list of ISO 639-1 language codes for all supported application locales
-
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- ISO 639-1 language code to set as locale
-
getDatePattern
getDatePattern.- Returns:
- the locale-appropriate date format pattern for the current locale
-
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:
- the absolute base URL of the viewer application ending with a slash
-
getEncodedUrl
Used for social bookmarks.- Returns:
- the current page URL encoded for use in social bookmark links
-
getCurrentUrl
getCurrentUrl.- Returns:
- the absolute URL of the current request, or null if no request URL is available
-
getRssUrl
getRssUrl.- Returns:
- the URL to the RSS feed for the current locale
-
getRequestPath
getRequestPath.- Parameters:
externalContext- JSF external context providing the current request- Returns:
- the complete Request Path, eg http://hostname.de/viewer/pathxyz/pathxyz/
-
getRequestPath
getRequestPath.- Parameters:
request- incoming HTTP servlet requestprettyFacesURI- PrettyFaces forwarded URI, may be null or empty- Returns:
- the complete request URL including scheme, host, port and path
-
getFullRequestUrl
getFullRequestUrl.- Parameters:
request- incoming HTTP servlet requestprettyFacesURI- PrettyFaces forwarded URI, may be null or empty- Returns:
- the full request URL including query string for standard URLs, or the pretty URL without query string
-
getCurrentPrettyUrl
Returns the current PrettyURL.- Returns:
- the current PrettyFaces URL of the active request
-
getTimeZone
getTimeZone.- Returns:
- the default system time zone
-
setMenuPage
setMenuPage.- Parameters:
page- menu page name to store in the status map
-
getMenuPage
getMenuPage.- Returns:
- the currently active menu page name stored in the status map
-
getTheme
Getter for the fieldtheme.- Returns:
- the name of the currently active viewer theme
-
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:
- the current sub-theme discriminator value, or "-" if none is set
- 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- discriminator value identifying the active sub-theme
-
resetTheme
public void resetTheme()resetTheme. -
getObjectUrl
getObjectUrl.- Returns:
- the absolute base URL for the object view page
-
getImageUrl
getImageUrl.- Returns:
- the absolute base URL for the image view page
-
getCurrentPageTypeUrl
-
getImageActiveUrl
getImageActiveUrl.- Returns:
- the absolute base URL for the active image view page (with leading "!")
-
getCalendarUrl
Deprecated.Calendar view has been retired; usegetTocUrl()getCalendarUrl.- Returns:
- the absolute base URL for the TOC (formerly calendar) view page
-
getCalendarActiveUrl
Deprecated.Calendar view has been retired; usegetTocActiveUrl()getCalendarActiveUrl.- Returns:
- the absolute active URL for the TOC (formerly calendar) view page (with leading "!")
-
getTocUrl
getTocUrl.- Returns:
- the absolute base URL for the TOC view page
-
getTocActiveUrl
getTocActiveUrl.- Returns:
- the absolute active URL for the TOC view page (with leading "!")
-
getThumbsUrl
getThumbsUrl.- Returns:
- the absolute base URL for the thumbnail view page
-
getThumbsActiveUrl
getThumbsActiveUrl.- Returns:
- the absolute active URL for the thumbnail view page (with leading "!")
-
getMetadataUrl
getMetadataUrl.- Returns:
- the absolute base URL for the metadata view page
-
getMetadataActiveUrl
getMetadataActiveUrl.- Returns:
- the absolute active URL for the metadata view page (with leading "!")
-
getFulltextUrl
getFulltextUrl.- Returns:
- the absolute base URL for the fulltext view page
-
getMeiActiveUrl
getMeiActiveUrl.- Returns:
- the absolute active URL for the MEI music view page (with leading "!")
-
getMeiUrl
getMeiUrl.- Returns:
- the absolute base URL for the MEI music view page
-
getFulltextActiveUrl
getFulltextActiveUrl.- Returns:
- the absolute active URL for the fulltext view page (with leading "!")
-
getRecordUrl
public String getRecordUrl(String pi, String docStructType, int order, boolean anchorOrGroup, boolean hasImages) - Parameters:
pi- persistent identifier of the recorddocStructType- structural type used to determine the page typeorder- page order within the recordanchorOrGroup- true if the record is an anchor or grouphasImages- true if the record has image pages- Returns:
- Record URL
-
getSearchUrl
getSearchUrl.- Returns:
- the absolute URL for the regular search page
-
getAdvancedSearchUrl
getAdvancedSearchUrl.- Returns:
- the absolute URL for the advanced search page
-
getPageUrl
getPageUrl.- Parameters:
pageType- page type name to resolve to a URL- Returns:
- the absolute URL for the given page type name, or empty string if the page type is unknown
-
getPageUrl
getPageUrl.- Parameters:
page- page type whose absolute URL is returned- Returns:
- the absolute URL for the given page type
-
getSearchUrl
getSearchUrl.- Parameters:
activeSearchType- integer constant identifying the search type- Returns:
- the absolute URL for the search page matching the given search type
-
getSearchUrl
getSearchUrl.- Parameters:
activeSearchType- integer constant identifying the search typecmsPage- optional CMS page with search functionality to redirect to instead- Returns:
- the absolute URL for the search page matching the given type, or the CMS search page URL if provided
-
getTermUrl
getTermUrl.- Returns:
- the absolute URL for the term browse search page
-
getBrowseUrl
getBrowseUrl.- Returns:
- the absolute URL for the browse page
-
getSortUrl
getSortUrl.- Returns:
- the absolute URL for the search page used as sort target
-
addStaticLinkToBreadcrumb
Adds a link to the breadcrumbs using the current PrettyURL. Can be called from XHTML.- Parameters:
linkName- display label for the breadcrumblinkWeight- breadcrumb sort weight
-
addStaticLinkToBreadcrumb
Adds a link to the breadcrumbs using the given URL. Can be called from XHTML.- Parameters:
linkName- display label for the breadcrumburl- target URL for the breadcrumb linklinkWeight- breadcrumb sort weight
-
getLocalDate
Returns the string representation of the givenDatebased on the currentlocale.- Parameters:
date- date-time value to format- Returns:
- the locale-formatted date string for the given date-time in the current locale
-
getMessageValueList
getMessageValueList.- Parameters:
keyPrefix- message key prefix to filter translations- Returns:
- a list of message key strings matching the given prefix, sorted in reverse order
-
setSelectedNewsArticle
setSelectedNewsArticle.- Parameters:
art- identifier or key of the selected news article
-
getSelectedNewsArticle
getSelectedNewsArticle.- Returns:
- the identifier of the currently selected news article stored in the status map
-
getLastRequestTimestamp
getLastRequestTimestamp.- Returns:
- the timestamp string of the last request stored in the current HTTP session
-
getSessionIPAddress
-
getSessionId
-
getStatusMapValue
getStatusMapValue.- Parameters:
key- status map key to look up- Returns:
- the value associated with the given key in the navigation status map
-
setStatusMapValue
setStatusMapValue.- Parameters:
key- status map key to setvalue- value to associate with the key
-
getStatusMap
Getter for the fieldstatusMap.- Returns:
- the navigation status map holding key-value pairs for the current navigation state
-
setStatusMap
Setter for the fieldstatusMap.- Parameters:
statusMap- navigation status map to replace the current one
-
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:
- true if the current page is a document display page (as defined in
PageType), false otherwise
-
getSubThemeDiscriminatorQuerySuffix
getSubThemeDiscriminatorQuerySuffix.- Returns:
- the Solr query suffix for filtering by the current sub-theme discriminator value
- Throws:
IndexUnreachableException- if any.
-
getCurrentPageType
Get thePageTypefor the page name fromgetCurrentPage().- Returns:
- the PageType corresponding to the current page name
-
getPreviousViewUrl
getPreviousViewUrl.- Returns:
- the URL of the previously visited view, or "/" if no previous view is available
-
redirectToPreviousView
redirectToPreviousView.- Throws:
IOException- if any.
-
getCurrentViewUrl
getCurrentViewUrl.- Returns:
- the URL of the currently active view, or "/" if no current view is available
-
getCurrentViewPrettyUrl
-
getExitUrl
-
getExitUrl
- Parameters:
pageType- current page type used to look up the configured exit view- Returns:
- Appropriate exit URL
-
resolvePrettyUrl
- Parameters:
prettyId- PrettyFaces mapping ID to resolveparameters- optional parameter values to fill into the URL pattern- Returns:
- Resolved Pretty URL
-
redirectToCurrentView
redirectToCurrentView.- Throws:
IOException- if any.
-
urlEncode
urlEncode.- Parameters:
s- string to URL-encode- Returns:
- the URL-encoded representation of the input string
-
urlEncodeUnicode
urlEncodeUnicode.- Parameters:
s- string to encode with Unicode-safe escaping- Returns:
- the input string with critical URL characters Unicode-safely escaped
-
getThemeOrSubtheme
getThemeOrSubtheme.- Returns:
- the active sub-theme discriminator value if set, otherwise the default theme name
-
isSubthemeSelected
isSubthemeSelected.- Returns:
- true exactly if
getSubThemeDiscriminatorValue()is not blank - Throws:
IndexUnreachableException- if any.
-
getVersion
getVersion.- Returns:
- the version string of the viewer application
-
getBuildDate
getBuildDate.- Returns:
- the build date string of the viewer application
-
getBuildVersion
getBuildVersion.- Returns:
- the build version string of the viewer application
-
getApplicationName
getApplicationName.- Returns:
- the display name of the viewer application
-
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
-
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" directoryconsiderAlternativeSuffixes- Whether to check files with different file extensions in the theme if the given file doesn't exist there. This does not effect the core path.- Returns:
- Resource path
-
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" directoryalternativeSuffixes- a list of alternative file extensions to check in the theme if the given file doesn't exist there. This does not effect the core path. May be an empty list, but not null. Suffixes should be written without the extension separator dot- Returns:
- Resource path
-
getLicenceIconResources
Resolves a list of licence icon names to their resource URIs, filtering out any icons whose resolved path is blank or a directory (trailing slash). This method is intended for use in Facelets templates that pass the result directly to<ui:include>, where an invalid path would cause aTagAttributeExceptionat view-build time.- Parameters:
icons- list of icon file names (e.g. "cc0.svg"); blank entries are ignored- Returns:
- ordered list of resolved resource URIs suitable for use as
<ui:include src="...">values
-
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
Gets 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
-
getTranslationsAsJson
- Parameters:
keys- list of message keys to translate- Returns:
- JSON with translations for the given message keys
-
getRange
-
getAsId
-
getTocActiveUrl()