Class CookieBannerBean

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

@Named @ViewScoped public class CookieBannerBean extends Object implements Serializable
JSF backing bean for enabling and configuring the cookie banner feature. This bean is view-scoped, i.e. created fresh for each new page loaded.
See Also:
  • Constructor Details

    • CookieBannerBean

      public CookieBannerBean()
      Default constructor using the IDAO from the DataManager class.
    • CookieBannerBean

      public CookieBannerBean(IDAO dao)
      Creates a new testing purposes instance.
      Parameters:
      dao - the IDAO implementation to use
  • Method Details

    • getCookieBanner

      public CookieBanner getCookieBanner()
      Get the stored cookie banner to display on a viewer web-page. Do not use for modifications
      Returns:
      the cookie banner stored in the DAO
    • getStatus

      public CookieBannerBean.BeanStatus getStatus()
      Get the initialization status of the bean. Useful for detecting problems with DAO communication
      Returns:
      the status of the current bean
    • getCookieBannerForEdit

      public CookieBanner getCookieBannerForEdit()
      Get the copy of the stored cookie banner for editing. Changes are persisted to the object stored in the database by calling save()
      Returns:
      the cookie banner for editing
    • getCmsPageMap

      public Map<CMSPage,Boolean> getCmsPageMap()
      To use when selecting CMS-Pages on which to ignore the cookie-banner. Pages mapped to "true" are stored in CookieBanner.getIgnoreList() when calling save()
      Returns:
      Map
    • save

      public void save()
      Save the current getCookieBannerForEdit() to the DAO. Set the banners ignore list from getCmsPageMap() before
    • resetUserConsent

      public void resetUserConsent() throws DAOException
      Set the CookieBanner.getRequiresConsentAfter() to the current time. Applies directly to the persisted object
      Throws:
      DAOException
    • setBannerActive

      public void setBannerActive(boolean active) throws DAOException
      Activate/deactivate the cookie banner. Applies directly to the persisted object
      Parameters:
      active - true to activate the banner; false to deactivate it
      Throws:
      DAOException
    • isBannerActive

      public boolean isBannerActive()
      Check if the banner is active, i.e. should be displayed at all
      Returns:
      true if the banner should be shown if appropriate
    • getCookieBannerConfig

      public String getCookieBannerConfig()
      Returns a json object to use a configuration object to the viewerJS.cookieBanner.js javascript.
      Returns:
      a json config object