Package io.goobi.viewer.model.cms.pages
Class CMSPageTemplate
java.lang.Object
io.goobi.viewer.model.cms.pages.CMSPageTemplate
- All Implemented Interfaces:
IPolyglott,Serializable,Comparable<CMSPageTemplate>
@Entity
public class CMSPageTemplate
extends Object
implements Comparable<CMSPageTemplate>, IPolyglott, Serializable
Template to create a
CMSPage. Contains some general information about the template as well as a list of components and
sidebar widgets to be included in the page- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new CMSPage instance.CMSPageTemplate(CMSPage original) CMSPageTemplate(CMSPageTemplate original) Creates a deep copy of the original CMSPage. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCategory(CMSCategory category) addCategory.addComponent(CMSComponent template) addComponent(String filename, CMSTemplateManager templateManager) voidaddSidebarElement(CMSSidebarElement element) addSidebarElement.voidaddToSidebar(List<WidgetDisplayElement> widgets) intbooleanvoiddecrementOrder(CMSComponent component) booleanGetter for the fieldcategories.Getter for the fielddateCreated.getId()Getter for the fieldid.getName()Getter for the fieldselectableCategories.Getter for the fieldsidebarElements.Getter for the fieldsidebarElementString.Getter for the fieldsubTheme.getTitle()getTitle.getTitle.de.intranda.metadata.multilanguage.IMetadataValueGetter for the fieldwrapperElementClass.inthashCode()booleanvoidincrementOrder(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.booleanbooleanIf this returns true, an associated language tab should have neither the 'already-translated' nor the '-partly-translated' class.booleanisFirstComponent(CMSComponent component) booleanisHasSidebarElements.booleanisLanguageComplete(Locale locale) isLanguageComplete.booleanisLastComponent(CMSComponent component) booleanbooleanbooleanisPublished.booleanisUseDefaultSidebar.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) booleanremoveComponent(PersistentCMSComponent component) voidremoveSidebarElement(CMSSidebarElement element) voidvoidsetCategories(List<CMSCategory> categories) Setter for the fieldcategories.voidsetComponentOrder(CMSComponent component, int order) Sets 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.voidsetDescription(TranslatedText description) voidSetter for the fieldid.voidsetLegacyTemplate(boolean legacyTemplate) voidsetLockComponents(boolean lockComponents) voidsetPublished(boolean published) Setter for the fieldpublished.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.voidvoidsetUseDefaultSidebar(boolean useDefaultSidebar) Setter for the fielduseDefaultSidebar.voidsetWrapperElementClass(String wrapperElementClass) Setter for the fieldwrapperElementClass.toString()voidRetrieves 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
-
Constructor Details
-
CMSPageTemplate
public CMSPageTemplate()Creates a new CMSPage instance. -
CMSPageTemplate
Creates a deep copy of the original CMSPage. Only copies persisted properties and performs initialization for them- Parameters:
original- template to copy all persistent properties from.
-
CMSPageTemplate
-
-
Method Details
-
initialiseCMSComponents
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<CMSPageTemplate>
-
addSidebarElement
addSidebarElement.- Parameters:
element- sidebar widget element to append to the list.
-
getId
Getter for the fieldid.- Returns:
- the database primary key of this page template
-
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 template was created
-
setDateCreated
Setter for the fielddateCreated.- Parameters:
dateCreated- the date and time when this page template was created
-
getDateUpdated
-
setDateUpdated
Setter for the fielddateUpdated.- Parameters:
dateUpdated- the date and time when this page template 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 template 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 template should use the default sidebar instead of a custom one
-
getSidebarElements
Getter for the fieldsidebarElements.- Returns:
- the list of sidebar elements configured for this template
-
setSidebarElements
Setter for the fieldsidebarElements.- Parameters:
sidebarElements- the list of sidebar widget elements to assign to this template
-
addToSidebar
-
moveUpSidebarElement
-
moveDownSidebarElement
-
removeSidebarElement
-
containsSidebarElement
-
getCategories
Getter for the fieldcategories.- Returns:
- the list of categories assigned to this template
-
setCategories
Setter for the fieldcategories.- Parameters:
categories- list of categories to assign to this template.
-
addCategory
addCategory.- Parameters:
category- category to add if not already present.
-
removeCategory
removeCategory.- Parameters:
category- category to remove from this template.
-
getSidebarElementString
Getter for the fieldsidebarElementString.- Returns:
- the serialized string representation of the sidebar elements
-
setSidebarElementString
Setter for the fieldsidebarElementString.- Parameters:
sidebarElementString- the serialized string representation of sidebar elements
-
isLanguageComplete
isLanguageComplete.- Parameters:
locale- locale to check translation completeness for.- Returns:
- true if the title and all persistent components are complete for the given locale, false otherwise
-
getTitle
getTitle.- Returns:
- the CMS page template title in the default language
-
getTitle
getTitle.- Parameters:
locale- locale to retrieve the title translation for.- Returns:
- the CMS page template title in the given locale
-
getTitleTranslations
public de.intranda.metadata.multilanguage.IMetadataValue getTitleTranslations() -
getDescription
-
setDescription
-
getSubTheme
Getter for the fieldsubTheme.- Returns:
- the sub-theme name associated with this template, or an empty string if none is set
-
setSubTheme
Setter for the fieldsubTheme.- Parameters:
subTheme- the sub-theme name to associate with this template; null is treated as empty string
-
isHasSidebarElements
public boolean isHasSidebarElements()isHasSidebarElements.- Returns:
- true if this template uses the default sidebar or has at least one custom sidebar element, false otherwise
-
toString
-
getWrapperElementClass
Getter for the fieldwrapperElementClass.- Returns:
- the
wrapperElementClass
-
setWrapperElementClass
Setter for the fieldwrapperElementClass.- Parameters:
wrapperElementClass- thewrapperElementClassto set
-
writeSelectableCategories
public void writeSelectableCategories()Retrieves 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 template categories
- Throws:
DAOException- if any.
-
resetSelectableCategories
public void resetSelectableCategories() -
getAdminBackendUrl
-
getPersistentComponents
-
getComponents
-
getAsCMSComponent
-
removeComponent
-
removeComponent
-
addComponent
-
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
-
hasSearchFunctionality
public boolean hasSearchFunctionality() -
getSearch
-
setComponentOrder
Sets 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
-
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
-
isLockComponents
public boolean isLockComponents() -
setLockComponents
public void setLockComponents(boolean lockComponents) -
isLegacyTemplate
public boolean isLegacyTemplate() -
setLegacyTemplate
public void setLegacyTemplate(boolean legacyTemplate) -
addComponent
public PersistentCMSComponent addComponent(String filename, CMSTemplateManager templateManager) throws IllegalArgumentException, IllegalStateException -
isContainsPagedComponents
public boolean isContainsPagedComponents() -
getName
-
setTitleTranslations
-