Class CmsBean
- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCmsBean()Persists checked menu item access permission for the duration of the user session.CmsBean(CMSTemplateManager templateManager, NavigationHelper navigationHelper) -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckRelatedWork.Action method called when a CMS page is opened.cmsContextAction(boolean resetSearch) Action method called when a CMS page is opened.voidSet the given (wrapped)CMSMediaItemto Media holder set bysetSelectedMediaHolder(io.goobi.viewer.model.cms.media.CMSMediaHolder)voidfillSelectedMediaHolder(CategorizableTranslatedSelectable<CMSMediaItem> mediaItem, boolean saveMedia) Set the given (wrapped)CMSMediaItemto Media holder set bysetSelectedMediaHolder(io.goobi.viewer.model.cms.media.CMSMediaHolder)Additionally save the given media item if the parameter saveMedia is set to truevoidDeprecated.This method only remains to avoid pages failing to load which still call this methodgetAllCategories.getAllCMSPages.getAllLocales.getAllowedCategories(User user) Returns a filtered category list for the given user, unless the user is a superuser.Returns a filtered subtheme discriminator value list for the given user, unless the user is a superuser.getAllowedTemplates(User user) Returns a filtered page template list for the given user, unless the user is a superuser.getAvailableCmsPages.getAvailableParentPages.For CMS pages withCMSPage.getWrapperElementClass()return 'body_' followed by the wrapperElementClass.Returns metadataList types from the configuration where the type value stars with "cms_".getCMSPage(Long pageId) getCMSPage.getter for jsfgetCMSPagesWithSearch.getCssClass.static LocalegetCurrentLocale.Getter for the fieldcurrentPage.getCurrentPageId.Getter for the fieldcurrentWorkPi.getDefaultLocale.getDisplayedPages.protected jakarta.faces.context.FacesContextgetFacesContext.getFieldNames(org.apache.solr.common.SolrDocument solrDoc) getFieldNames.getGroupedQueryResults(List<SearchHit> hits, String groupingField) getLastEditedTimestamp(long pageId) getLastEditedTimestamp.Getter for the fieldlazyModelPages.getLuceneFields.getLuceneFields(boolean includeUntokenized) getLuceneFields.getLuceneFields(boolean includeUntokenized, boolean excludeTokenizedMetadataFields) getLuceneFields.getMostRecentlyEditedPages(int number) Returns the most recently edited CMS pages from the lazy model, which should include all restrictions placed upon the current user.getNavigationMenuItems.getPage.getPage.getPageUrl(Long pageId) Returns the URL to the CMS template of the given page.getPageUrl(Long pageId, boolean pretty) getPageUrl.getPossibleGroupFields.getPossibleSortFields.longCalculates the number of pages needed for the paginator.getQueryResults.getRelatedPages.getRelatedPages(String pi, CMSCategory category) getRelatedPages.getRepresentativeImageForQuery.getRepresentativeImageForQuery(CMSPage page, int width, int height) getRepresentativeImageForQuery.getRepresentativeImageForQuery.getRepresentativeImageForQuery(CMSRecordListContent item, int width, int height) getRepresentativeImageForQuery.Getter for the fieldselectedMediaItem.Getter for the fieldselectedMediaLocale.getStaticPage(String pageName) getStaticPage.Getter for the fieldstaticPages.getSubthemeDiscriminatorValues.getTemplates.getTemplates(boolean enabled) getTest()getUrl.getUrl.getValidCMSPages.booleanhasSearchResults.booleanhasSelectedMediaHolder.voidinit()init.booleanisHasRelatedPages.booleanisLinkedFromNavBar(CMSPage page) isLinkedFromNavBar.booleanisLinkedToStaticPage(CMSPage page) booleanisMappedToStaticPage(CMSPage page) booleanisRelatedWorkLoaded.booleanisSubthemeRequired(User user) isSubthemeRequired.booleanisUserHasAccess(CMSPage page) voidloadTemplates.booleanmayEdit.voidresetCurrentWorkPi.voidResets visible navigation menu items (e.g. when logging in/out).voidSave static page status for all cms pagesPersists the enabled/disabled status of all CMS tempaltes in the DB.voidsetCurrentPage(CMSPage currentPage) Setter for the fieldcurrentPage.voidPage ID setter for PrettyFaces.voidsetCurrentWorkPi(String currentWorkPi) Setter for the fieldcurrentWorkPi.voidsetNavigationHelper(NavigationHelper navigationHelper) Required setter for ManagedProperty injectionvoidsetSearchBean(SearchBean searchBean) Required setter for ManagedProperty injectionvoidSets the searchType in SearchBean to the type assciated with the current static view (e.g. if the current cms page replaces the static page 'advancedSearch' the search type is set to 'advanced') For the normal search pages this is done in the pretty mapping which isn't used if redirecting to cms pagevoidSet aCMSMediaHolderin theCmsMediaBeanwhich may receive aCMSMediaItemselected in the selectMedia dialogvoidsetSelectedMediaItem(CMSMediaItem selectedMediaItem) Setter for the fieldselectedMediaItem.voidsetSelectedMediaLocale(Locale selectedMediaLocale) Setter for the fieldselectedMediaLocale.void
-
Field Details
-
CMSPAGES_FILTER
- See Also:
-
-
Constructor Details
-
CmsBean
public CmsBean()Persists checked menu item access permission for the duration of the user session.
-
-
Method Details
-
init
@PostConstruct public void init()init.
-
getMostRecentlyEditedPages
Returns the most recently edited CMS pages from the lazy model, which should include all restrictions placed upon the current user.- Parameters:
number- Number of requested rows- Returns:
- List
-
setSearchBean
Required setter for ManagedProperty injection- Parameters:
searchBean- the searchBean to set
-
getAllLocales
getAllLocales.
- Returns:
- a
Listobject.
-
forwardToCMSPage
Deprecated.This method only remains to avoid pages failing to load which still call this methodforwardToCMSPage.
-
getDefaultLocale
getDefaultLocale.
- Returns:
- a
Localeobject.
-
getCurrentLocale
getCurrentLocale.
- Returns:
- a
Localeobject.
-
loadTemplates
public void loadTemplates()loadTemplates.
-
getTemplates
getTemplates.
- Returns:
- all existing templates
- Throws:
DAOException
-
getTemplates
- Parameters:
enabled-- Returns:
- All templates with the given enabled status
- Throws:
DAOException
-
getAllowedTemplates
Returns a filtered page template list for the given user, unless the user is a superuser. Other CMS admins get a list matching the template ID list attached to their CMS license.- Parameters:
user- aUserobject.- Returns:
- List of CMS templates whose IDs are among allowed template IDs
- Throws:
DAOException
-
saveTemplatesAction
Persists the enabled/disabled status of all CMS tempaltes in the DB.- Returns:
- Navigation outcome
- Throws:
DAOException
-
getDisplayedPages
getDisplayedPages.
- Returns:
- a
Listobject.
-
getLazyModelPages
Getter for the field
lazyModelPages.- Returns:
- a
TableDataProviderobject.
-
getPageUrl
Returns the URL to the CMS template of the given page. This URL will only resolve if the page has been published or the current user is CMS admin. -
getPageUrl
getPageUrl.
-
getUrl
getUrl.
-
getUrl
getUrl.
-
getAllCMSPages
getAllCMSPages.
- Returns:
- a
Listobject. - Throws:
DAOException- if any.
-
getCMSPage
getCMSPage.
- Parameters:
pageId- aLongobject.- Returns:
- a
CMSPageobject. - Throws:
DAOException- if any.
-
isRelatedWorkLoaded
isRelatedWorkLoaded.
- Returns:
- true if an
ActiveDocumentBeanis registered and the theCMSPage.getRelatedPI()ofgetCurrentPage()is loaded - Throws:
IndexUnreachableException- if any.
-
getCurrentCmsPageIfLoaded
- Returns:
- the
getCurrentPage()if one is set, or an empty Optional if the current page is not a cmsPage (i.e. ifNavigationHelper.isCmsPage()== false)
-
getPage
getPage.
-
getPage
getPage.
- Parameters:
pageId- aLongobject.- Returns:
- a
CMSPageobject. - Throws:
DAOException- if any.
-
getCurrentPage
Getter for the field
currentPage.- Returns:
- a
CMSPageobject.
-
setCurrentPage
Setter for the field
currentPage.- Parameters:
currentPage- aCMSPageobject.
-
getCurrentPageId
getCurrentPageId.
- Returns:
- a
Stringobject.
-
setCurrentPageId
public void setCurrentPageId(String id) throws DAOException, de.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundException Page ID setter for PrettyFaces.- Parameters:
id- aStringobject.- Throws:
DAOException- if any.de.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundException- if any.
-
checkRelatedWork
public void checkRelatedWork() throws de.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundExceptioncheckRelatedWork.
- Throws:
de.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundException- if any.
-
getAllCategories
getAllCategories.
- Returns:
- the return value of
IDAO.getAllCategories() - Throws:
DAOException- if any.
-
getSelectedMediaItem
Getter for the field
selectedMediaItem.- Returns:
- a
CMSMediaItemobject.
-
setSelectedMediaItem
Setter for the field
selectedMediaItem.- Parameters:
selectedMediaItem- aCMSMediaItemobject.
-
getSelectedMediaLocale
Getter for the field
selectedMediaLocale.- Returns:
- a
Localeobject.
-
setSelectedMediaLocale
Setter for the field
selectedMediaLocale.- Parameters:
selectedMediaLocale- aLocaleobject.
-
cmsContextAction
public String cmsContextAction() throws IndexUnreachableException, DAOException, ViewerConfigurationException, RecordNotFoundException, RecordDeletedExceptionAction method called when a CMS page is opened. The exact action depends on the page and content item type.- Returns:
- a
Stringobject. - Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.ViewerConfigurationException- if any.IndexUnreachableExceptionDAOExceptionViewerConfigurationExceptionRecordDeletedExceptionRecordNotFoundExceptionde.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
-
cmsContextAction
public String cmsContextAction(boolean resetSearch) throws IndexUnreachableException, DAOException, ViewerConfigurationException, RecordNotFoundException, RecordDeletedException Action method called when a CMS page is opened. The exact action depends on the page and content item type.- Parameters:
resetSearch- If true, the search parameters in SearchBean will be reset- Returns:
- a
Stringobject. - Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.ViewerConfigurationException- if any.IndexUnreachableExceptionDAOExceptionViewerConfigurationExceptionRecordDeletedExceptionRecordNotFoundExceptionde.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
-
getQueryResults
public List<SearchHit> getQueryResults() throws IndexUnreachableException, PresentationException, DAOExceptiongetQueryResults.
- Returns:
- a
Listobject. - Throws:
IndexUnreachableException- if any.PresentationException- if any.DAOException- if any.
-
getGroupedQueryResults
public List<Map.Entry<String,List<SearchHit>>> getGroupedQueryResults(List<SearchHit> hits, String groupingField) - Parameters:
hits-groupingField-- Returns:
- List<Entry<String, List<SearchHit>>>
-
hasSearchResults
public boolean hasSearchResults()hasSearchResults.
- Returns:
- a boolean.
-
getQueryResultCount
Calculates the number of pages needed for the paginator. The value is taken directly fromSearch.getLastPage(int)- Returns:
- The number of pages to display in the paginator
- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
getFieldNames
getFieldNames.
- Parameters:
solrDoc- aSolrDocumentobject.- Returns:
- a
Listobject.
-
getLuceneFields
getLuceneFields.
- Returns:
- a
Listobject.
-
getLuceneFields
getLuceneFields.
- Parameters:
includeUntokenized- a boolean.- Returns:
- a
Listobject.
-
getLuceneFields
public List<String> getLuceneFields(boolean includeUntokenized, boolean excludeTokenizedMetadataFields) getLuceneFields.
- Parameters:
includeUntokenized- a boolean.excludeTokenizedMetadataFields- a boolean.- Returns:
- a
Listobject.
-
getStaticPages
Getter for the field
staticPages.- Returns:
- a
Listobject. - Throws:
DAOException- if any.
-
getStaticPage
getStaticPage.
- Parameters:
pageName- aStringobject.- Returns:
- a
CMSStaticPageobject. - Throws:
DAOException- if any.
-
isMappedToStaticPage
- Parameters:
page-- Returns:
- true if the given CMS page is mapped to any static page; otherwise
- Throws:
DAOException
-
getAvailableParentPages
getAvailableParentPages.
- Parameters:
page- aCMSPageobject.- Returns:
- A list of all cmsPages except the given one
- Throws:
DAOException- if any.
-
getAvailableCmsPages
getAvailableCmsPages.
- Parameters:
page- aCMSStaticPageobject.- Returns:
- A list of all cmsPages not yet registered to a static page
- Throws:
DAOException- if any.
-
getCMSPagesWithSearch
getCMSPagesWithSearch.
- Returns:
- a list of all valid cms pages which contain a "search" item
- Throws:
DAOException- if any.
-
saveStaticPages
Save static page status for all cms pages- Throws:
DAOException- if any.
-
isLinkedToStaticPage
- Throws:
DAOException
-
getValidCMSPages
getValidCMSPages.
- Returns:
- all cmsPages which are valid and have a menu title
- Throws:
DAOException- if any.
-
getFacesContext
protected jakarta.faces.context.FacesContext getFacesContext()getFacesContext.
- Returns:
- a
FacesContextobject.
-
getSubthemeDiscriminatorValues
getSubthemeDiscriminatorValues.
- Returns:
- a
Listobject. - Throws:
PresentationException- if any.
-
getAllowedSubthemeDiscriminatorValues
public List<String> getAllowedSubthemeDiscriminatorValues(User user) throws PresentationException, IndexUnreachableException Returns a filtered subtheme discriminator value list for the given user, unless the user is a superuser. Other CMS admins get a list matching values list attached to their CMS license.- Parameters:
user- aUserobject.- Returns:
- List of CMS templates whose IDs are among allowed template IDs
- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
isSubthemeRequired
public boolean isSubthemeRequired(User user) throws PresentationException, IndexUnreachableException isSubthemeRequired.
- Parameters:
user- aUserobject.- Returns:
- true if user is limited to a subset of all available subtheme discriminator values; false otherwise
- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
getAllowedCategories
Returns a filtered category list for the given user, unless the user is a superuser. Other CMS admins get a list matching values list attached to their CMS license.- Parameters:
user- aUserobject.- Returns:
- a
Listobject. - Throws:
DAOException- if any.
-
setSearchType
public void setSearchType()Sets the searchType in SearchBean to the type assciated with the current static view (e.g. if the current cms page replaces the static page 'advancedSearch' the search type is set to 'advanced') For the normal search pages this is done in the pretty mapping which isn't used if redirecting to cms page -
isHasRelatedPages
isHasRelatedPages.
- Parameters:
pi- aStringobject.- Returns:
- a boolean.
- Throws:
DAOException- if any.
-
getRelatedPages
getRelatedPages.
- Parameters:
pi- aStringobject.- Returns:
- a
Listobject. - Throws:
DAOException- if any.
-
getRelatedPages
getRelatedPages.
- Parameters:
pi- aStringobject.category- aCMSCategoryobject.- Returns:
- a
Listobject. - Throws:
DAOException- if any.
-
getRepresentativeImageForQuery
public String getRepresentativeImageForQuery(CMSPage page) throws PresentationException, IndexUnreachableException, ViewerConfigurationException getRepresentativeImageForQuery.
- Parameters:
page- aCMSPageobject.- Returns:
- a
Stringobject. - Throws:
PresentationException- if any.IndexUnreachableException- if any.ViewerConfigurationException- if any.
-
getRepresentativeImageForQuery
public String getRepresentativeImageForQuery(CMSRecordListContent item) throws PresentationException, IndexUnreachableException, ViewerConfigurationException getRepresentativeImageForQuery.
- Parameters:
item- aCMSContentItemobject.- Returns:
- a
Stringobject. - Throws:
PresentationException- if any.IndexUnreachableException- if any.ViewerConfigurationException- if any.
-
getRepresentativeImageForQuery
public String getRepresentativeImageForQuery(CMSPage page, int width, int height) throws PresentationException, IndexUnreachableException, ViewerConfigurationException getRepresentativeImageForQuery.
- Parameters:
page- aCMSPageobject.width- a int.height- a int.- Returns:
- a
Stringobject. - Throws:
PresentationException- if any.IndexUnreachableException- if any.ViewerConfigurationException- if any.
-
getRepresentativeImageForQuery
public String getRepresentativeImageForQuery(CMSRecordListContent item, int width, int height) throws PresentationException, IndexUnreachableException, ViewerConfigurationException getRepresentativeImageForQuery.
- Parameters:
item- aCMSContentItemobject.width- a int.height- a int.- Returns:
- a
Stringobject. - Throws:
PresentationException- if any.IndexUnreachableException- if any.ViewerConfigurationException- if any.
-
getPossibleSortFields
public List<String> getPossibleSortFields() throws org.apache.solr.client.solrj.SolrServerException, IOExceptiongetPossibleSortFields.
- Returns:
- a
Listobject. - Throws:
org.apache.solr.client.solrj.SolrServerException- if any.IOException- if any.
-
getPossibleGroupFields
getPossibleGroupFields.
- Returns:
- a
Listobject. - Throws:
org.apache.solr.client.solrj.SolrServerException- if any.IOException- if any.DAOExceptionIndexUnreachableException
-
getPossibleResultGroupNames
- Returns:
- Configured search result group names; empty list if disabled
-
getCmsMetadataListTypes
Returns metadataList types from the configuration where the type value stars with "cms_".- Returns:
- List of configured metadata lists where the type starts with "cms_"
-
getCssClass
getCssClass.
- Returns:
- The
CMSPage.getWrapperElementClass()of the current CMSPage. If no current page is set orNavigationHelper.isCmsPage()returns false, an empty String is returned
-
getLastEditedTimestamp
getLastEditedTimestamp.
- Parameters:
pageId- a long.- Returns:
- a
Longobject. - Throws:
DAOException- if any.
-
getCurrentWorkPi
Getter for the field
currentWorkPi.- Returns:
- the currentWorkPi
-
setCurrentWorkPi
Setter for the field
currentWorkPi.- Parameters:
currentWorkPi- the currentWorkPi to set
-
resetCurrentWorkPi
public void resetCurrentWorkPi()resetCurrentWorkPi.
-
setSelectedMediaHolder
Set aCMSMediaHolderin theCmsMediaBeanwhich may receive aCMSMediaItemselected in the selectMedia dialog- Parameters:
item- aCMSMediaHolderobject.
-
getSelectedMediaHolder
-
fillSelectedMediaHolder
Set the given (wrapped)CMSMediaItemto Media holder set bysetSelectedMediaHolder(io.goobi.viewer.model.cms.media.CMSMediaHolder)- Parameters:
mediaItem- aCategorizableTranslatedSelectableobject.
-
fillSelectedMediaHolder
public void fillSelectedMediaHolder(CategorizableTranslatedSelectable<CMSMediaItem> mediaItem, boolean saveMedia) Set the given (wrapped)CMSMediaItemto Media holder set bysetSelectedMediaHolder(io.goobi.viewer.model.cms.media.CMSMediaHolder)Additionally save the given media item if the parameter saveMedia is set to true- Parameters:
mediaItem- aCategorizableTranslatedSelectableobject.saveMedia- a boolean.
-
hasSelectedMediaHolder
public boolean hasSelectedMediaHolder()hasSelectedMediaHolder.
- Returns:
- true if a mediaHolder is present
-
mayEdit
public boolean mayEdit(CMSPage page) throws DAOException, PresentationException, IndexUnreachableException mayEdit.
- Parameters:
page- aCMSPageobject.- Returns:
- a boolean.
- Throws:
DAOException- if any.PresentationException- if any.IndexUnreachableException- if any.
-
getCmsBodyClass
For CMS pages withCMSPage.getWrapperElementClass()return 'body_' followed by the wrapperElementClass. Otherwise return an empty String- Returns:
- Configured wrapper element class of the current page; otherwise empty string
-
getCmsPagesFilter
getter for jsf- Returns:
- CMSPAGES_FILTER
-
getSortingModes
-
getCurrentPageUrl
-
getTemplateManager
-
getPossibleHitListViews
-
getTest
-
setTest
-
isUserHasAccess
-