Class CmsPageEditBean

java.lang.Object
io.goobi.viewer.managedbeans.CmsPageEditBean
All Implemented Interfaces:
Serializable

@Named @ViewScoped public class CmsPageEditBean extends Object implements Serializable
JSF backing bean for creating and editing CMS pages including content and metadata.
See Also:
  • Constructor Details

    • CmsPageEditBean

      public CmsPageEditBean()
  • Method Details

    • setup

      @PostConstruct public void setup()
      setup.
    • savePageAndForwardToEdit

      public void savePageAndForwardToEdit() throws DAOException
      savePageAndForwardToEdit.
      Throws:
      DAOException - if any.
    • saveSelectedPage

      public void saveSelectedPage() throws DAOException
      Adds the current page to the database, if it doesn't exist or updates it otherwise.
      Throws:
      DAOException - if any.
    • deleteSelectedPage

      public String deleteSelectedPage() throws DAOException
      Action method for deleting selectedPage from the database.
      Returns:
      Return view
      Throws:
      DAOException - if any.
    • deletePage

      public boolean deletePage(CMSPage page) throws DAOException
      Deletes given CMS page from the database.
      Parameters:
      page - Page to delete
      Returns:
      true if deletion was successful; false otherwise
      Throws:
      DAOException - if any.
    • setSelectedPage

      public void setSelectedPage(CMSPage currentPage) throws DAOException
      Setter for the field selectedPage.
      Parameters:
      currentPage - CMS page to select; null clears the selection
      Throws:
      DAOException - if any.
    • getSelectedPageId

      public String getSelectedPageId()
      getSelectedPageId.
      Returns:
      ID of selectedPage
    • setSelectedPageId

      public void setSelectedPageId(String id) throws DAOException
      setSelectedPageId.
      Parameters:
      id - string representation of the CMS page database ID
      Throws:
      DAOException
    • getSelectedPage

      public CMSPage getSelectedPage()
      Getter for the field selectedPage.
      Returns:
      the CMS page currently selected for editing
    • createAndOpenNewPage

      public String createAndOpenNewPage(String title, String relatedPI)
      Create a new CMSPage based on the given template. title and relatedPI are set on the page if given Opens the view to create/edit the cmsPage
      Parameters:
      title - The title to be used for the current locale, optional
      relatedPI - The PI of a related work, optional
      Returns:
      the absolute URL to the new CMS page creation view with optional title and PI query parameters
    • getSidebarWidgets

      public Map<WidgetDisplayElement,Boolean> getSidebarWidgets()
      Getter for the field sidebarWidgets.
      Returns:
      a map of sidebar widget display elements to their selection state
    • setSidebarWidgets

      public void setSidebarWidgets(Map<WidgetDisplayElement,Boolean> sidebarWidgets)
      Setter for the field sidebarWidgets.
      Parameters:
      sidebarWidgets - map of widgets to their selection state
    • getSelectedWidgets

      public List<WidgetDisplayElement> getSelectedWidgets()
      getSelectedWidgets.
      Returns:
      a list of sidebar widget display elements that are currently selected for the CMS page
    • resetSelectedWidgets

      public void resetSelectedWidgets()
      resetSelectedWidgets.
    • getAndResetSelectedWidgets

      public List<WidgetDisplayElement> getAndResetSelectedWidgets()
      getAndResetSelectedWidgets.
      Returns:
      a list of the currently selected sidebar widgets, after which all selections are cleared
    • getSelectedComponent

      public String getSelectedComponent()
      Getter for the field selectedComponent.
      Returns:
      the template filename of the selected component to add
    • setSelectedComponent

      public void setSelectedComponent(String selectedComponent)
      Setter for the field selectedComponent.
      Parameters:
      selectedComponent - template filename of the component to add
    • getAvailableComponents

      public List<SelectItem> getAvailableComponents(CMSPage page)
      getAvailableComponents.
      Parameters:
      page - CMS page used to filter out incompatible paged components
      Returns:
      a list of select items representing CMS components available for the given page, grouped by type
    • getAvailableMetadataFields

      public List<String> getAvailableMetadataFields()
      Get the list of metadata fields which may be displayed. This is the main metadata list
      Returns:
      the main metadata list
    • mayRemoveCategoryFromPage

      public boolean mayRemoveCategoryFromPage(CMSCategory cat) throws DAOException
      mayRemoveCategoryFromPage.
      Parameters:
      cat - category whose removal eligibility is being checked
      Returns:
      false only if the user has limited privileges for categories and only one category is set for the selected page
      Throws:
      DAOException - if any.
    • isEditMode

      public boolean isEditMode()
      isEditMode.
      Returns:
      true if an existing CMS page is being edited (as opposed to creating a new one), false otherwise
    • setEditMode

      public void setEditMode(boolean editMode)
      Setter for the field editMode.
      Parameters:
      editMode - true when editing an existing page; false for new pages
    • setNewSelectedPage

      public void setNewSelectedPage()
      setNewSelectedPage.
    • setNewSelectedPage

      public void setNewSelectedPage(Long templateId)
      setNewSelectedPage.
      Parameters:
      templateId - database ID of the page template to base the new page on
    • getPageEditState

      public CMSPageEditState getPageEditState()
      Getter for the field pageEditState.
      Returns:
      the current state of the CMS page edit UI
    • setPageEditState

      public void setPageEditState(CMSPageEditState pageEditState)
      Setter for the field pageEditState.
      Parameters:
      pageEditState - active section of the page edit UI
    • deleteComponent

      public boolean deleteComponent(CMSComponent component)
      deleteComponent.
      Parameters:
      component - CMS component to remove from the selected page
      Returns:
      true if the component was successfully removed from the page, false otherwise
    • addComponent

      public void addComponent()
      addComponent.
    • setSaveAsTemplate

      public void setSaveAsTemplate(boolean saveAsTemplate)
      Setter for the field saveAsTemplate.
      Parameters:
      saveAsTemplate - true to save the current page as a template after saving
    • isSaveAsTemplate

      public boolean isSaveAsTemplate()
      isSaveAsTemplate.
      Returns:
      true if the current page should be saved as a template, false otherwise
    • setTemplateName

      public void setTemplateName(String templateName)
      Setter for the field templateName.
      Parameters:
      templateName - display name for the template to be created
    • getTemplateName

      public String getTemplateName()
      Getter for the field templateName.
      Returns:
      the template name, falling back to the selected page title if blank
    • isTemplateLockComponents

      public boolean isTemplateLockComponents()
      isTemplateLockComponents.
      Returns:
      true if components are locked when the page template is applied, false otherwise
    • setTemplateLockComponents

      public void setTemplateLockComponents(boolean templateLockComponents)
      Setter for the field templateLockComponents.
      Parameters:
      templateLockComponents - true to prevent component editing in pages based on this template