Package io.goobi.viewer.model.cms.pages
Class CMSPage
java.lang.Object
io.goobi.viewer.model.cms.pages.CMSPage
- All Implemented Interfaces:
Harvestable,IPolyglott,Serializable,Comparable<CMSPage>
@Entity
public class CMSPage
extends Object
implements Comparable<CMSPage>, Harvestable, IPolyglott, Serializable
Represents a CMS page with configurable content components, metadata, and URL mappings.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCMSPage()Creates a new CMSPage instance.creates a deep copy of the original CMSPage.CMSPage(CMSPageTemplate original) creates a CMSPage from aCMSPageTemplate. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCategory(CMSCategory category) addCategory.addComponent(String filename, CMSTemplateManager templateManager) voidaddPersistentComponent(PersistentCMSComponent persistentComponent) voidaddSidebarElement(CMSSidebarElement element) addSidebarElement.voidaddToSidebar(List<WidgetDisplayElement> widgets) intbooleanvoiddecrementOrder(CMSComponent component) intDeletes exported HTML/TEXT fragments from a related record's data folder.booleanorg.jdom2.DocumentExports relevant page contents as JDOM2 document for indexing.exportTexts(String outputFolderPath, String namingScheme) Exports text/html fragments from this page's content items for indexing.Returns the access condition configured for this CMS page.Getter for the fieldcategories.Getter for the fielddateCreated.getDateUpdated.getId()Getter for the fieldid.intGets the pagination number for this page's main list if it contains one.getMenuTitle.getMenuTitle(Locale locale) getMenuTitle.getMenuTitleOrTitle.getMenuTitleOrTitle(Locale locale) getMenuTitleOrTitle.Getter for the fieldpageSorting.getPageSortingOrElse(long defaultOrder) getPageUrl.Getter for the fieldparentPageId.Getter for the fieldpersistentUrl.getPi()getPi.getPreviewItem(String itemId) getPreviewItems(String itemId) getProperty(String key) Returns the property with the given key or else creates a new one with that key and returns it.Getter for the fieldrelatedPI.getRelativeUrlPath.getRelativeUrlPath(boolean pretty) getRelativeUrlPath.Getter for the fieldselectableCategories.Getter for the fieldsidebarElements.Getter for the fieldsidebarElementString.Getter for the fieldsubTheme.getTitle()getTitle.getTitle.de.intranda.metadata.multilanguage.IMetadataValuegetUrl()Like getPageUrl() but does not require CmsBean (which is unavailable in different threads).Getter for the fieldwrapperElementClass.inthashCode()booleanbooleanvoidincrementOrder(CMSComponent component) voidinitialiseCMSComponents(CMSTemplateManager templateManager) booleanisComplete(Locale locale) If this returns true, an associated language tab should have the 'already-translated' class, otherwise the '-partly-translated' class unlessIPolyglott.isEmpty(Locale)also returns true.booleanbooleanbooleanIf this returns true, an associated language tab should have neither the 'already-translated' nor the '-partly-translated' class.booleanisFirstComponent(CMSComponent component) booleanisHasSidebarElements.booleanisLastComponent(CMSComponent component) booleanbooleanbooleanisMayContainUrlParameters.booleanisPublished.booleanbooleanbooleanisUseDefaultSidebar.booleanOnly meaningful for the default language for which all required fields must be filled.voidmoveDownSidebarElement(CMSSidebarElement element) voidmoveUpSidebarElement(CMSSidebarElement element) voidremoveCategory(CMSCategory category) removeCategory.booleanremoveComponent(CMSComponent component) voidremoveSidebarElement(CMSSidebarElement element) voidvoidsetAccessCondition(String accessCondition) voidsetCategories(List<CMSCategory> categories) Setter for the fieldcategories.voidsetComponentOrder(CMSComponent component, int order) Set the order attribute of thePersistentCMSComponentbelonging to the givenCMSComponentto the given order value.voidsetDateCreated(LocalDateTime dateCreated) Setter for the fielddateCreated.voidsetDateUpdated(LocalDateTime dateUpdated) Setter for the fielddateUpdated.voidSetter for the fieldid.voidsetListPage(int listPage) Sets the pagination number for this page's main list if it contains one.voidsetMenuTitle(TranslatedText menuTitle) voidsetPageSorting(Long pageSorting) Setter for the fieldpageSorting.voidsetParentPageId(String parentPageId) Setter for the fieldparentPageId.voidsetPersistentUrl(String persistentUrl) Setter for the fieldpersistentUrl.voidsetPublished(boolean published) Setter for the fieldpublished.voidsetRelatedPI(String relatedPI) Setter for the fieldrelatedPI.voidsetSearchable(boolean searchable) voidsetSelectedLocale(Locale locale) Sets the locale to use for display and editing.voidsetSidebarElements(List<CMSSidebarElement> sidebarElements) Setter for the fieldsidebarElements.voidsetSidebarElementString(String sidebarElementString) Setter for the fieldsidebarElementString.voidsetSubTheme(String subTheme) Setter for the fieldsubTheme.voidsetTemplateId(Long templateId) voidsetTitle(TranslatedText title) voidsetUseAsDefaultRecordView(boolean useAsDefaultRecordView) voidsetUseDefaultSidebar(boolean useDefaultSidebar) Setter for the fielduseDefaultSidebar.voidsetWrapperElementClass(String wrapperElementClass) Setter for the fieldwrapperElementClass.toString()voidRetrieve all categories fresh from the DAO and write them to this depending on the state of the selectableCategories list.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.goobi.viewer.model.translations.IPolyglott
getLocales, isDefaultLocaleSelected, isSelected, setSelectedLocale
-
Field Details
-
GLOBAL_LANGUAGE
ConstantGLOBAL_LANGUAGE="global".- See Also:
-
CLASSIFICATION_OVERVIEWPAGE
ConstantCLASSIFICATION_OVERVIEWPAGE="overviewpage".- See Also:
-
TOPBAR_SLIDER_ID
- See Also:
-
-
Constructor Details
-
CMSPage
public CMSPage()Creates a new CMSPage instance. -
CMSPage
creates a deep copy of the original CMSPage. Only copies persisted properties and performs initialization for them- Parameters:
original- source page to copy from
-
CMSPage
creates a CMSPage from aCMSPageTemplate. Only copies persisted properties and performs initialization for them- Parameters:
original- template to derive the new page from
-
-
Method Details
-
initialiseCMSComponents
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<CMSPage>
-
addSidebarElement
addSidebarElement.- Parameters:
element- sidebar element to append to the list
-
getId
Getter for the fieldid.- Returns:
- the database primary key of this page
-
setId
Setter for the fieldid.- Parameters:
id- the database primary key to set
-
getDateCreated
Getter for the fielddateCreated.- Returns:
- the date and time when this page was created
-
setDateCreated
Setter for the fielddateCreated.- Parameters:
dateCreated- the date and time when this page was created
-
getDateUpdated
getDateUpdated.- Specified by:
getDateUpdatedin interfaceHarvestable- Returns:
- the date and time when this record was last updated
-
setDateUpdated
Setter for the fielddateUpdated.- Parameters:
dateUpdated- the date and time when this page was last updated
-
isPublished
public boolean isPublished()isPublished.- Returns:
- true if the publication status is PUBLISHED, false otherwise
-
setPublished
public void setPublished(boolean published) Setter for the fieldpublished.- Parameters:
published- true sets the publication status to PUBLISHED, false sets it to PRIVATE
-
isUseDefaultSidebar
public boolean isUseDefaultSidebar()isUseDefaultSidebar.- Returns:
- true if this page uses the default sidebar instead of a custom one, false otherwise
-
setUseDefaultSidebar
public void setUseDefaultSidebar(boolean useDefaultSidebar) Setter for the fielduseDefaultSidebar.- Parameters:
useDefaultSidebar- true if this page should use the default sidebar instead of a custom one
-
getSidebarElements
Getter for the fieldsidebarElements.- Returns:
- the list of sidebar elements configured for this page
-
setSidebarElements
Setter for the fieldsidebarElements.- Parameters:
sidebarElements- the list of sidebar widget elements to assign to this page
-
addToSidebar
-
moveUpSidebarElement
-
moveDownSidebarElement
-
removeSidebarElement
-
containsSidebarElement
-
getCategories
Getter for the fieldcategories.- Returns:
- the list of categories assigned to this page
-
setCategories
Setter for the fieldcategories.- Parameters:
categories- list of categories to assign to this page
-
addCategory
addCategory.- Parameters:
category- category to add if not already present
-
removeCategory
removeCategory.- Parameters:
category- category to remove from this page
-
getSidebarElementString
Getter for the fieldsidebarElementString.- Returns:
- the serialized sidebar element configuration string
-
setSidebarElementString
Setter for the fieldsidebarElementString.- Parameters:
sidebarElementString- serialized sidebar element configuration string
-
getTitle
getTitle.- Returns:
- the CMS page title in the default language
-
getTitle
getTitle.- Parameters:
locale- locale of the desired title translation- Returns:
- the CMS page title in the given locale
-
getTitleTranslations
public de.intranda.metadata.multilanguage.IMetadataValue getTitleTranslations() -
getMenuTitle
getMenuTitle.- Returns:
- the CMS page menu title in the default language
-
getMenuTitle
getMenuTitle.- Parameters:
locale- locale of the desired menu title translation- Returns:
- the CMS page menu title in the given locale
-
getMenuTitleOrTitle
getMenuTitleOrTitle.- Returns:
- the CMS page menu title in the default language, falling back to the title if the menu title is empty
-
getMenuTitleOrTitle
getMenuTitleOrTitle.- Parameters:
locale- locale of the desired translation- Returns:
- the CMS page menu title in the given locale, falling back to the title if not available
-
getMenuTitleTranslations
-
getPageSorting
Getter for the fieldpageSorting.- Returns:
- the numeric sort position used for page ordering, or null if not set
-
getPageSortingOrElse
-
setPageSorting
Setter for the fieldpageSorting.- Parameters:
pageSorting- numeric sort position for page ordering
-
getSubTheme
Getter for the fieldsubTheme.- Returns:
- the sub-theme discriminator value for this page, or an empty string if none is set
-
setSubTheme
Setter for the fieldsubTheme.- Parameters:
subTheme- sub-theme discriminator value for this page
-
getPageUrl
getPageUrl.- Returns:
- the pretty url to this page (using alternative url if set)
-
getUrl
Like getPageUrl() but does not require CmsBean (which is unavailable in different threads).- Returns:
- URL to this page
-
getListPage
public int getListPage()Gets the pagination number for this page's main list if it contains one.- Returns:
- a int.
-
setListPage
public void setListPage(int listPage) Sets the pagination number for this page's main list if it contains one.- Parameters:
listPage- current pagination page number of the main list
-
getPersistentUrl
Getter for the fieldpersistentUrl.- Returns:
- the custom URL path for this page, without leading or trailing slashes
-
setPersistentUrl
Setter for the fieldpersistentUrl.- Parameters:
persistentUrl- the custom URL path for this page; leading and trailing slashes are stripped
-
getRelativeUrlPath
getRelativeUrlPath.- Returns:
- the relative URL path for this CMS page, using static or persistent URL if available
-
getRelativeUrlPath
getRelativeUrlPath.- Parameters:
pretty- if true, use static or persistent URL when available- Returns:
- the relative URL path for this CMS page, optionally using the pretty URL
-
isHasSidebarElements
public boolean isHasSidebarElements()isHasSidebarElements.- Returns:
- true if this page uses the default sidebar or has at least one custom sidebar element, false otherwise
-
setParentPageId
Setter for the fieldparentPageId.- Parameters:
parentPageId- the string ID of the parent CMS page, or null if this page has no parent
-
getParentPageId
Getter for the fieldparentPageId.- Returns:
- the string ID of the parent CMS page, or null if this page has no parent
-
isMayContainUrlParameters
public boolean isMayContainUrlParameters()isMayContainUrlParameters.- Returns:
- true if this page contains paged components that require URL parameters, false otherwise
-
isContainsPagedComponents
public boolean isContainsPagedComponents() -
getRelatedPI
Getter for the fieldrelatedPI.- Returns:
- the persistent identifier of the record associated with this CMS page, or null if none is set
-
setRelatedPI
Setter for the fieldrelatedPI.- Parameters:
relatedPI- the persistent identifier of the record associated with this CMS page
-
isUseAsDefaultRecordView
public boolean isUseAsDefaultRecordView() -
setUseAsDefaultRecordView
public void setUseAsDefaultRecordView(boolean useAsDefaultRecordView) -
getProperty
Returns the property with the given key or else creates a new one with that key and returns it.- Parameters:
key- property key to look up or create- Returns:
- the property with the given key or else creates a new one with that key and returns it
- Throws:
ClassCastException- if the returned property has the wrong generic type.
-
toString
-
getWrapperElementClass
Getter for the fieldwrapperElementClass.- Returns:
- the
wrapperElementClass
-
setWrapperElementClass
Setter for the fieldwrapperElementClass.- Parameters:
wrapperElementClass- thewrapperElementClassto set
-
isSearchable
public boolean isSearchable() -
setSearchable
public void setSearchable(boolean searchable) -
getAccessCondition
Returns the access condition configured for this CMS page.- Returns:
- the access condition property value, or null if no access condition is configured
-
setAccessCondition
-
deleteExportedTextFiles
Deletes exported HTML/TEXT fragments from a related record's data folder. Should be called when deleting this CMS page.- Returns:
- Number of deleted files
- Throws:
ViewerConfigurationException- if any.
-
exportTexts
Exports text/html fragments from this page's content items for indexing.- Parameters:
outputFolderPath- destination directory for exported text fragmentsnamingScheme- filename pattern used when writing exported files- Returns:
- a list of exported text fragment files written to the output folder
- Throws:
IOException- if any.
-
exportAsXml
public org.jdom2.Document exportAsXml()Exports relevant page contents as JDOM2 document for indexing.- Returns:
Document
-
writeSelectableCategories
public void writeSelectableCategories()Retrieve all categories fresh from the DAO and write them to this depending on the state of the selectableCategories list. Saving the categories from selectableCategories directly leads to ConcurrentModificationexception when persisting page -
getSelectableCategories
Getter for the fieldselectableCategories.- Returns:
- the list of all allowed categories wrapped as selectable items, with selection state reflecting current page categories
- Throws:
DAOException- if any.
-
resetSelectableCategories
public void resetSelectableCategories() -
getPi
getPi.- Specified by:
getPiin interfaceHarvestable- Returns:
- the persistent identifier (PI) of this harvestable record
-
hasTopbarComponents
public boolean hasTopbarComponents() -
getTopbarComponents
-
getAdminBackendUrl
-
getPersistentComponents
-
isComponentsLoaded
public boolean isComponentsLoaded() -
getComponents
-
getAsCMSComponent
-
removeComponent
-
addComponent
public PersistentCMSComponent addComponent(String filename, CMSTemplateManager templateManager) throws IllegalArgumentException, IllegalStateException -
isComplete
Description copied from interface:IPolyglottIf this returns true, an associated language tab should have the 'already-translated' class, otherwise the '-partly-translated' class unlessIPolyglott.isEmpty(Locale)also returns true.- Specified by:
isCompletein interfaceIPolyglott- Parameters:
locale- the locale to check translation completeness for- Returns:
- true if
IPolyglott.isValid(Locale)returns true for the given locale and all fields contain a value which have a value in the default locale. For the default locale,IPolyglott.isComplete(Locale)andIPolyglott.isValid(Locale)are identical. For implementations with only one field, both methods are also always identical
-
isValid
Description copied from interface:IPolyglottOnly meaningful for the default language for which all required fields must be filled.- Specified by:
isValidin interfaceIPolyglott- Parameters:
locale- the locale to validate required fields for- Returns:
- true if all required fields contain a value in the given locale
-
isEmpty
Description copied from interface:IPolyglottIf this returns true, an associated language tab should have neither the 'already-translated' nor the '-partly-translated' class.- Specified by:
isEmptyin interfaceIPolyglott- Parameters:
locale- the locale to check for empty fields- Returns:
- true if no fields are filled for the given locale
-
getSelectedLocale
- Specified by:
getSelectedLocalein interfaceIPolyglott- Returns:
- the locale currently set by
IPolyglott.setSelectedLocale(Locale)
-
setSelectedLocale
Description copied from interface:IPolyglottSets the locale to use for display and editing.- Specified by:
setSelectedLocalein interfaceIPolyglott- Parameters:
locale- the locale to select
-
hasSearchFunctionality
public boolean hasSearchFunctionality() -
getSearch
-
getTemplate
-
setComponentOrder
Set the order attribute of thePersistentCMSComponentbelonging to the givenCMSComponentto the given order value. Also, sets the order value of all Components which previously had the given order to the order value of the given component- Parameters:
component- the CMS component whose order to setorder- the new order value to assign
-
incrementOrder
-
decrementOrder
-
isFirstComponent
-
isLastComponent
-
setTitle
-
setMenuTitle
-
addPersistentComponent
-
getPreviewItems
-
getPreviewItems
-
getPreviewItem
-
getPreviewComponents
-
getGroupedPageViewComponents
-
getPageViewComponents
-
isLockComponents
public boolean isLockComponents() -
isLegacyPage
public boolean isLegacyPage() -
getTemplateId
-
setTemplateId
-