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

CMSPage class.

See Also:
  • Field Details

  • Constructor Details

    • CMSPage

      public CMSPage()

      Constructor for CMSPage.

    • CMSPage

      public CMSPage(CMSPage original)
      creates a deep copy of the original CMSPage. Only copies persisted properties and performs initialization for them
      Parameters:
      original - a CMSPage object.
    • CMSPage

      public CMSPage(CMSPageTemplate original)
      creates a CMSPage from a CMSPageTemplate. Only copies persisted properties and performs initialization for them
      Parameters:
      original - a CMSPageTemplate object.
  • Method Details

    • initialiseCMSComponents

      public void initialiseCMSComponents(CMSTemplateManager templateManager)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(CMSPage o)
      Specified by:
      compareTo in interface Comparable<CMSPage>
    • addSidebarElement

      public void addSidebarElement(CMSSidebarElement element)

      addSidebarElement.

      Parameters:
      element - a io.goobi.viewer.model.cms.widgets.CMSSidebarElement object.
    • getId

      public Long getId()

      Getter for the field id.

      Returns:
      the id
    • setId

      public void setId(Long id)

      Setter for the field id.

      Parameters:
      id - the id to set
    • getDateCreated

      public LocalDateTime getDateCreated()

      Getter for the field dateCreated.

      Returns:
      the dateCreated
    • setDateCreated

      public void setDateCreated(LocalDateTime dateCreated)

      Setter for the field dateCreated.

      Parameters:
      dateCreated - the dateCreated to set
    • getDateUpdated

      public LocalDateTime getDateUpdated()

      getDateUpdated.

      Specified by:
      getDateUpdated in interface Harvestable
      Returns:
      a LocalDateTime object.
    • setDateUpdated

      public void setDateUpdated(LocalDateTime dateUpdated)

      Setter for the field dateUpdated.

      Parameters:
      dateUpdated - the dateUpdated to set
    • isPublished

      public boolean isPublished()

      isPublished.

      Returns:
      the published
    • setPublished

      public void setPublished(boolean published)

      Setter for the field published.

      Parameters:
      published - the published to set
    • isUseDefaultSidebar

      public boolean isUseDefaultSidebar()

      isUseDefaultSidebar.

      Returns:
      the useDefaultSidebar
    • setUseDefaultSidebar

      public void setUseDefaultSidebar(boolean useDefaultSidebar)

      Setter for the field useDefaultSidebar.

      Parameters:
      useDefaultSidebar - the useDefaultSidebar to set
    • getSidebarElements

      public List<CMSSidebarElement> getSidebarElements()

      Getter for the field sidebarElements.

      Returns:
      the sidebarElements
    • setSidebarElements

      public void setSidebarElements(List<CMSSidebarElement> sidebarElements)

      Setter for the field sidebarElements.

      Parameters:
      sidebarElements - the sidebarElements to set
    • addToSidebar

      public void addToSidebar(List<WidgetDisplayElement> widgets)
    • moveUpSidebarElement

      public void moveUpSidebarElement(CMSSidebarElement element)
    • moveDownSidebarElement

      public void moveDownSidebarElement(CMSSidebarElement element)
    • removeSidebarElement

      public void removeSidebarElement(CMSSidebarElement element)
    • containsSidebarElement

      public boolean containsSidebarElement(WidgetDisplayElement widget)
    • getCategories

      public List<CMSCategory> getCategories()

      Getter for the field categories.

      Returns:
      the classifications
    • setCategories

      public void setCategories(List<CMSCategory> categories)

      Setter for the field categories.

      Parameters:
      categories - a List object.
    • addCategory

      public void addCategory(CMSCategory category)

      addCategory.

      Parameters:
      category - a CMSCategory object.
    • removeCategory

      public void removeCategory(CMSCategory category)

      removeCategory.

      Parameters:
      category - a CMSCategory object.
    • getSidebarElementString

      public String getSidebarElementString()

      Getter for the field sidebarElementString.

      Returns:
      the sidebarElementString
    • setSidebarElementString

      public void setSidebarElementString(String sidebarElementString)

      Setter for the field sidebarElementString.

      Parameters:
      sidebarElementString - the sidebarElementString to set
    • getTitle

      public String getTitle()

      getTitle.

      Returns:
      a String object.
    • getTitle

      public String getTitle(Locale locale)

      getTitle.

      Parameters:
      locale - a Locale object.
      Returns:
      a String object.
    • getTitleTranslations

      public de.intranda.metadata.multilanguage.IMetadataValue getTitleTranslations()
    • getMenuTitle

      public String getMenuTitle()

      getMenuTitle.

      Returns:
      a String object.
    • getMenuTitle

      public String getMenuTitle(Locale locale)

      getMenuTitle.

      Parameters:
      locale - a Locale object.
      Returns:
      a String object.
    • getMenuTitleOrTitle

      public String getMenuTitleOrTitle()

      getMenuTitleOrTitle.

      Returns:
      a String object.
    • getMenuTitleOrTitle

      public String getMenuTitleOrTitle(Locale locale)

      getMenuTitleOrTitle.

      Parameters:
      locale - a Locale object.
      Returns:
      a String object.
    • getMenuTitleTranslations

      public TranslatedText getMenuTitleTranslations()
    • getPageSorting

      public Long getPageSorting()

      Getter for the field pageSorting.

      Returns:
      a Long object.
    • getPageSortingOrElse

      public Long getPageSortingOrElse(long defaultOrder)
    • setPageSorting

      public void setPageSorting(Long pageSorting)

      Setter for the field pageSorting.

      Parameters:
      pageSorting - a Long object.
    • getSubThemeDiscriminatorValue

      public String getSubThemeDiscriminatorValue()

      Getter for the field subThemeDiscriminatorValue.

      Returns:
      the subThemeDiscriminatorValue
    • setSubThemeDiscriminatorValue

      public void setSubThemeDiscriminatorValue(String subThemeDiscriminatorValue)

      Setter for the field subThemeDiscriminatorValue.

      Parameters:
      subThemeDiscriminatorValue - the subThemeDiscriminatorValue to set
    • getPageUrl

      public String getPageUrl()

      getPageUrl.

      Returns:
      the pretty url to this page (using alternative url if set)
    • getUrl

      public String 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 - a int.
    • getPersistentUrl

      public String getPersistentUrl()

      Getter for the field persistentUrl.

      Returns:
      the persistentUrl
    • setPersistentUrl

      public void setPersistentUrl(String persistentUrl)

      Setter for the field persistentUrl.

      Parameters:
      persistentUrl - the persistentUrl to set
    • getRelativeUrlPath

      public String getRelativeUrlPath()

      getRelativeUrlPath.

      Returns:
      a String object.
    • getRelativeUrlPath

      public String getRelativeUrlPath(boolean pretty)

      getRelativeUrlPath.

      Parameters:
      pretty - a boolean.
      Returns:
      a String object.
    • isHasSidebarElements

      public boolean isHasSidebarElements()

      isHasSidebarElements.

      Returns:
      a boolean.
    • setParentPageId

      public void setParentPageId(String parentPageId)

      Setter for the field parentPageId.

      Parameters:
      parentPageId - the parentPageId to set
    • getParentPageId

      public String getParentPageId()

      Getter for the field parentPageId.

      Returns:
      the parentPageId
    • isMayContainUrlParameters

      public boolean isMayContainUrlParameters()

      isMayContainUrlParameters.

      Returns:
      the mayContainUrlParameters
    • isContainsPagedComponents

      public boolean isContainsPagedComponents()
    • getRelatedPI

      public String getRelatedPI()

      Getter for the field relatedPI.

      Returns:
      the relatedPI
    • setRelatedPI

      public void setRelatedPI(String relatedPI)

      Setter for the field relatedPI.

      Parameters:
      relatedPI - the relatedPI to set
    • isUseAsDefaultRecordView

      public boolean isUseAsDefaultRecordView()
      Returns:
      the useAsDefaultRecordView
    • setUseAsDefaultRecordView

      public void setUseAsDefaultRecordView(boolean useAsDefaultRecordView)
      Parameters:
      useAsDefaultRecordView - the useAsDefaultRecordView to set
    • getProperty

      public CMSProperty getProperty(String key) throws ClassCastException
      Returns the property with the given key or else creates a new one with that key and returns it
      Parameters:
      key - a String object.
      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

      public String toString()
      Overrides:
      toString in class Object
    • getWrapperElementClass

      public String getWrapperElementClass()

      Getter for the field wrapperElementClass.

      Returns:
      the wrapperElementClass
    • setWrapperElementClass

      public void setWrapperElementClass(String wrapperElementClass)

      Setter for the field wrapperElementClass.

      Parameters:
      wrapperElementClass - the wrapperElementClass to set
    • isSearchable

      public boolean isSearchable()
      Returns:
      the searchable
    • setSearchable

      public void setSearchable(boolean searchable)
      Parameters:
      searchable - the searchable to set
    • deleteExportedTextFiles

      public int deleteExportedTextFiles() throws ViewerConfigurationException
      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

      public List<File> exportTexts(String outputFolderPath, String namingScheme) throws IOException
      Exports text/html fragments from this page's content items for indexing.
      Parameters:
      outputFolderPath - a String object.
      namingScheme - a String object.
      Returns:
      a List object.
      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

      public List<Selectable<CMSCategory>> getSelectableCategories() throws DAOException

      Getter for the field selectableCategories.

      Returns:
      the selectableCategories
      Throws:
      DAOException - if any.
    • resetSelectableCategories

      public void resetSelectableCategories()
    • getPi

      public String getPi()

      getPi.

      Specified by:
      getPi in interface Harvestable
      Returns:
      a String object.
    • hasTopbarComponents

      public boolean hasTopbarComponents()
    • getTopbarComponents

      public List<CMSComponent> getTopbarComponents()
    • getAdminBackendUrl

      public String getAdminBackendUrl()
    • getPersistentComponents

      public List<PersistentCMSComponent> getPersistentComponents()
    • isComponentsLoaded

      public boolean isComponentsLoaded()
    • getComponents

      public List<CMSComponent> getComponents()
    • getAsCMSComponent

      public CMSComponent getAsCMSComponent(PersistentCMSComponent p)
    • removeComponent

      public boolean removeComponent(CMSComponent component)
    • addComponent

      public PersistentCMSComponent addComponent(String filename, CMSTemplateManager templateManager) throws IllegalArgumentException, IllegalStateException
      Throws:
      IllegalArgumentException
      IllegalStateException
    • isComplete

      public boolean isComplete(Locale locale)
      Description copied from interface: IPolyglott
      If this returns true, an associated language tab should have the 'already-translated' class, otherwise the '-partly-translated' class unless IPolyglott.isEmpty(Locale) also returns true
      Specified by:
      isComplete in interface IPolyglott
      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) and IPolyglott.isValid(Locale) are identical. For implementations with only one field, both methods are also always identical
    • isValid

      public boolean isValid(Locale locale)
      Description copied from interface: IPolyglott
      Only meaningfull for the default language for which all required fields must be filled
      Specified by:
      isValid in interface IPolyglott
      Returns:
      true if all required fields contain a value in the given locale
    • isEmpty

      public boolean isEmpty(Locale locale)
      Description copied from interface: IPolyglott
      If this returns true, an associated language tab should have neither the 'already-translated' nor the '-partly-translated' class
      Specified by:
      isEmpty in interface IPolyglott
      Returns:
      true if no fields are filled for the given locale
    • getSelectedLocale

      public Locale getSelectedLocale()
      Specified by:
      getSelectedLocale in interface IPolyglott
      Returns:
      the locale currently set by IPolyglott.setSelectedLocale(Locale)
    • setSelectedLocale

      public void setSelectedLocale(Locale locale)
      Description copied from interface: IPolyglott
      Set the locale to use for display and editing
      Specified by:
      setSelectedLocale in interface IPolyglott
    • hasSearchFunctionality

      public boolean hasSearchFunctionality()
    • getSearch

      public Optional<SearchFunctionality> getSearch()
    • getTemplate

      public Optional<CMSPageTemplate> getTemplate()
    • setComponentOrder

      public void setComponentOrder(CMSComponent component, int order)
      Set the order attribute of the PersistentCMSComponent belonging to the given CMSComponent to 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 -
      order -
    • incrementOrder

      public void incrementOrder(CMSComponent component)
    • decrementOrder

      public void decrementOrder(CMSComponent component)
    • isFirstComponent

      public boolean isFirstComponent(CMSComponent component)
    • isLastComponent

      public boolean isLastComponent(CMSComponent component)
    • setTitle

      public void setTitle(TranslatedText title)
    • setMenuTitle

      public void setMenuTitle(TranslatedText menuTitle)
    • addPersistentComponent

      public void addPersistentComponent(PersistentCMSComponent persistentComponent)
    • getPreviewItems

      public List<CMSContentItem> getPreviewItems()
    • getPreviewItems

      public List<CMSContentItem> getPreviewItems(String itemId)
    • getPreviewItem

      public CMSContentItem getPreviewItem(String itemId)
    • getPreviewComponents

      public List<CMSComponent> getPreviewComponents()
    • getGroupedPageViewComponents

      public List<CMSComponentGroup> getGroupedPageViewComponents()
    • getPageViewComponents

      public List<CMSComponent> getPageViewComponents()
    • isLockComponents

      public boolean isLockComponents()
    • isLegacyPage

      public boolean isLegacyPage()
    • getTemplateId

      public Long getTemplateId()
    • setTemplateId

      public void setTemplateId(Long templateId)