Class CmsBean
- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCmsBean()
CmsBean
(CMSTemplateManager templateManager, NavigationHelper navigationHelper) -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkRelatedWork.Action method called when a CMS page is opened.cmsContextAction
(boolean resetSearch) Action method called when a CMS page is opened.void
Set the given (wrapped)CMSMediaItem
to Media holder set bysetSelectedMediaHolder(io.goobi.viewer.model.cms.media.CMSMediaHolder)
void
fillSelectedMediaHolder
(CategorizableTranslatedSelectable<CMSMediaItem> mediaItem, boolean saveMedia) Set the given (wrapped)CMSMediaItem
to Media holder set bysetSelectedMediaHolder(io.goobi.viewer.model.cms.media.CMSMediaHolder)
Additionally save the given media item if the parameter saveMedia is set to truevoid
Deprecated.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 Locale
getCurrentLocale.Getter for the fieldcurrentPage
.getCurrentPageId.Getter for the fieldcurrentWorkPi
.getDefaultLocale.getDisplayedPages.protected javax.faces.context.FacesContext
getFacesContext.getFieldNames
(org.apache.solr.common.SolrDocument solrDoc) getFieldNames.getGlossaries.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.long
Calculates 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.boolean
hasSearchResults.boolean
hasSelectedMediaHolder.void
init()
init.boolean
isHasRelatedPages.boolean
isLinkedFromNavBar
(CMSPage page) isLinkedFromNavBar.boolean
isLinkedToStaticPage
(CMSPage page) boolean
isMappedToStaticPage
(CMSPage page) boolean
isRelatedWorkLoaded.boolean
isSubthemeRequired
(User user) isSubthemeRequired.void
loadTemplates.boolean
mayEdit.void
resetCurrentWorkPi.void
Save static page status for all cms pagesPersists the enabled/disabled status of all CMS tempaltes in the DB.void
setCurrentPage
(CMSPage currentPage) Setter for the fieldcurrentPage
.void
Page ID setter for PrettyFaces.void
setCurrentWorkPi
(String currentWorkPi) Setter for the fieldcurrentWorkPi
.void
setNavigationHelper
(NavigationHelper navigationHelper) Required setter for ManagedProperty injectionvoid
setSearchBean
(SearchBean searchBean) Required setter for ManagedProperty injectionvoid
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 pagevoid
Set aCMSMediaHolder
in theCmsMediaBean
which may receive aCMSMediaItem
selected in the selectMedia dialogvoid
setSelectedMediaItem
(CMSMediaItem selectedMediaItem) Setter for the fieldselectedMediaItem
.void
setSelectedMediaLocale
(Locale selectedMediaLocale) Setter for the fieldselectedMediaLocale
.void
-
Field Details
-
CMSPAGES_FILTER
- See Also:
-
-
Constructor Details
-
CmsBean
public CmsBean()
-
-
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
List
object.
-
forwardToCMSPage
Deprecated.This method only remains to avoid pages failing to load which still call this methodforwardToCMSPage.
-
getDefaultLocale
getDefaultLocale.
- Returns:
- a
Locale
object.
-
getCurrentLocale
getCurrentLocale.
- Returns:
- a
Locale
object.
-
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
- aUser
object.- 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
List
object.
-
getLazyModelPages
Getter for the field
lazyModelPages
.- Returns:
- a
TableDataProvider
object.
-
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
List
object. - Throws:
DAOException
- if any.
-
getCMSPage
getCMSPage.
- Parameters:
pageId
- aLong
object.- Returns:
- a
CMSPage
object. - Throws:
DAOException
- if any.
-
isRelatedWorkLoaded
isRelatedWorkLoaded.
- Returns:
- true if an
ActiveDocumentBean
is 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
- aLong
object.- Returns:
- a
CMSPage
object. - Throws:
DAOException
- if any.
-
getCurrentPage
Getter for the field
currentPage
.- Returns:
- a
CMSPage
object.
-
setCurrentPage
Setter for the field
currentPage
.- Parameters:
currentPage
- aCMSPage
object.
-
getCurrentPageId
getCurrentPageId.
- Returns:
- a
String
object.
-
setCurrentPageId
public void setCurrentPageId(String id) throws DAOException, de.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundException Page ID setter for PrettyFaces.- Parameters:
id
- aString
object.- 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
CMSMediaItem
object.
-
setSelectedMediaItem
Setter for the field
selectedMediaItem
.- Parameters:
selectedMediaItem
- aCMSMediaItem
object.
-
getSelectedMediaLocale
Getter for the field
selectedMediaLocale
.- Returns:
- a
Locale
object.
-
setSelectedMediaLocale
Setter for the field
selectedMediaLocale
.- Parameters:
selectedMediaLocale
- aLocale
object.
-
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
String
object. - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.DAOException
- if any.ViewerConfigurationException
- if any.IndexUnreachableException
DAOException
ViewerConfigurationException
RecordDeletedException
RecordNotFoundException
de.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
String
object. - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.DAOException
- if any.ViewerConfigurationException
- if any.IndexUnreachableException
DAOException
ViewerConfigurationException
RecordDeletedException
RecordNotFoundException
de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
-
getQueryResults
public List<SearchHit> getQueryResults() throws IndexUnreachableException, PresentationException, DAOExceptiongetQueryResults.
- Returns:
- a
List
object. - 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
- aSolrDocument
object.- Returns:
- a
List
object.
-
getLuceneFields
getLuceneFields.
- Returns:
- a
List
object.
-
getLuceneFields
getLuceneFields.
- Parameters:
includeUntokenized
- a boolean.- Returns:
- a
List
object.
-
getLuceneFields
public List<String> getLuceneFields(boolean includeUntokenized, boolean excludeTokenizedMetadataFields) getLuceneFields.
- Parameters:
includeUntokenized
- a boolean.excludeTokenizedMetadataFields
- a boolean.- Returns:
- a
List
object.
-
getStaticPages
Getter for the field
staticPages
.- Returns:
- a
List
object. - Throws:
DAOException
- if any.
-
getStaticPage
getStaticPage.
- Parameters:
pageName
- aString
object.- Returns:
- a
CMSStaticPage
object. - 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
- aCMSPage
object.- Returns:
- A list of all cmsPages except the given one
- Throws:
DAOException
- if any.
-
getAvailableCmsPages
getAvailableCmsPages.
- Parameters:
page
- aCMSStaticPage
object.- 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 javax.faces.context.FacesContext getFacesContext()getFacesContext.
- Returns:
- a
FacesContext
object.
-
getSubthemeDiscriminatorValues
getSubthemeDiscriminatorValues.
- Returns:
- a
List
object. - 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
- aUser
object.- 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
- aUser
object.- 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
- aUser
object.- Returns:
- a
List
object. - 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
- aString
object.- Returns:
- a boolean.
- Throws:
DAOException
- if any.
-
getRelatedPages
getRelatedPages.
- Parameters:
pi
- aString
object.- Returns:
- a
List
object. - Throws:
DAOException
- if any.
-
getRelatedPages
getRelatedPages.
- Parameters:
pi
- aString
object.category
- aCMSCategory
object.- Returns:
- a
List
object. - Throws:
DAOException
- if any.
-
getGlossaries
getGlossaries.
- Returns:
- a
List
object.
-
getRepresentativeImageForQuery
public String getRepresentativeImageForQuery(CMSPage page) throws PresentationException, IndexUnreachableException, ViewerConfigurationException getRepresentativeImageForQuery.
- Parameters:
page
- aCMSPage
object.- Returns:
- a
String
object. - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.ViewerConfigurationException
- if any.
-
getRepresentativeImageForQuery
public String getRepresentativeImageForQuery(CMSRecordListContent item) throws PresentationException, IndexUnreachableException, ViewerConfigurationException getRepresentativeImageForQuery.
- Parameters:
item
- aCMSContentItem
object.- Returns:
- a
String
object. - 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
- aCMSPage
object.width
- a int.height
- a int.- Returns:
- a
String
object. - 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
- aCMSContentItem
object.width
- a int.height
- a int.- Returns:
- a
String
object. - 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
List
object. - Throws:
org.apache.solr.client.solrj.SolrServerException
- if any.IOException
- if any.
-
getPossibleGroupFields
getPossibleGroupFields.
- Returns:
- a
List
object. - Throws:
org.apache.solr.client.solrj.SolrServerException
- if any.IOException
- if any.DAOException
IndexUnreachableException
-
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
Long
object. - 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 aCMSMediaHolder
in theCmsMediaBean
which may receive aCMSMediaItem
selected in the selectMedia dialog- Parameters:
item
- aCMSMediaHolder
object.
-
getSelectedMediaHolder
-
fillSelectedMediaHolder
Set the given (wrapped)CMSMediaItem
to Media holder set bysetSelectedMediaHolder(io.goobi.viewer.model.cms.media.CMSMediaHolder)
- Parameters:
mediaItem
- aCategorizableTranslatedSelectable
object.
-
fillSelectedMediaHolder
public void fillSelectedMediaHolder(CategorizableTranslatedSelectable<CMSMediaItem> mediaItem, boolean saveMedia) Set the given (wrapped)CMSMediaItem
to 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
- aCategorizableTranslatedSelectable
object.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
- aCMSPage
object.- 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
-