Class PageList

java.lang.Object
io.goobi.viewer.model.cms.PageList
All Implemented Interfaces:
Iterable<String>

public class PageList extends Object implements Iterable<String>
A list of strings with some convenience methods. Each string is either the id of a cmsPage or a pageType name The list may be stored as a single string containing all strings in the list separated by ;
Author:
Florian Alpers
  • Constructor Details

    • PageList

      public PageList()
      Creates a new PageList instance.
    • PageList

      public PageList(List<Long> pageIds)
    • PageList

      public PageList(String stringRep)
      Creates a new PageList instance.
      Parameters:
      stringRep - semicolon-separated string of CMS page IDs or page type names.
  • Method Details

    • toString

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

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

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

      public List<String> getPages()
      Getter for the field pages.
      Returns:
      the list of CMS page IDs or page type names managed by this page list
    • setPages

      public void setPages(List<String> pages)
      Setter for the field pages.
      Parameters:
      pages - the list of page names or identifiers managed by this page list
    • getPage

      public String getPage()
      Get the if/pageName of the first page, or an empty string if no pages exist.
      Returns:
      the if/pageName of the first page, or an empty string if no pages exist
    • getPage

      public String getPage(int index)
      getPage.
      Parameters:
      index - zero-based position in the page list.
      Returns:
      the page URL at the given index, or an empty string if the index is out of range
    • getSearch

      Get the matching SearchInterface for the first listed page. This is the SearchFunctionality of that page if any exists, or otherwise the SearchBean
      Returns:
      the matching SearchInterface for the first listed page. This is the SearchFunctionality of that page if any exists, or otherwise the SearchBean
      Throws:
      NumberFormatException - if any.
      DAOException - if any.
    • getSearch

      public SearchInterface getSearch(int pageIndex) throws NumberFormatException, DAOException
      getSearch.
      Parameters:
      pageIndex - zero-based position of the desired page in the list.
      Returns:
      the SearchInterface for the given page, or null if not available
      Throws:
      NumberFormatException - if any.
      DAOException - if any.
    • getUrl

      public String getUrl(int pageIndex) throws NumberFormatException, DAOException
      getUrl.
      Parameters:
      pageIndex - the index of the desired page in the page list
      Returns:
      the url of the page at pageIndex, relative to the host url
      Throws:
      NumberFormatException - if any.
      DAOException - if any.
    • setPage

      public void setPage(String page)
      Sets the pages list to a list containing only the given string.
      Parameters:
      page - CMS page ID or page type name to set as sole entry.
    • iterator

      public Iterator<String> iterator()
      Specified by:
      iterator in interface Iterable<String>
    • getPage

      public CMSPage getPage(String idString) throws DAOException
      getPage.
      Parameters:
      idString - numeric CMS page ID as string.
      Returns:
      the CMS page with the given ID
      Throws:
      DAOException - if any.
    • isEmpty

      public boolean isEmpty()
      isEmpty.
      Returns:
      true if this page list contains no pages, false otherwise