Package io.goobi.viewer.managedbeans
Class CookieBannerBean
java.lang.Object
io.goobi.viewer.managedbeans.CookieBannerBean
- All Implemented Interfaces:
Serializable
This this the java backend class for enabling and configuring the cookie banner feature. This bean is view scoped, i.e. created fresh for each new
page loaded
- See Also:
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionDefault constructor using the IDAO from theDataManager
classCookieBannerBean
(IDAO dao) Constructor for testing purposes -
Method Summary
Modifier and TypeMethodDescriptionTo use when selecting CMS-Pages on which to ignore the cookie-banner.Get the stored cookie banner to display on a viewer web-page.Return a json object to use a configuration object to the viewerJS.cookieBanner.js javascriptGet the copy of the stored cookie banner for editing.Get the initialization status of the bean.boolean
Check if the banner is active, i.e. should be displayed at allvoid
Set theCookieBanner.getRequiresConsentAfter()
to the current time.void
save()
Save the currentgetCookieBannerForEdit()
to the DAO.void
setBannerActive
(boolean active) Activate/deactivate the cookie banner.
-
Constructor Details
-
CookieBannerBean
public CookieBannerBean()Default constructor using the IDAO from theDataManager
class -
CookieBannerBean
Constructor for testing purposes- Parameters:
dao
- the IDAO implementation to use
-
-
Method Details
-
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
Get the initialization status of the bean. Useful for detecting problems with DAO communication- Returns:
- the status of the current bean
-
getCookieBannerForEdit
Get the copy of the stored cookie banner for editing. Changes are persisted to the object stored in the database by callingsave()
- Returns:
- the cookie banner for editing
-
getCmsPageMap
To use when selecting CMS-Pages on which to ignore the cookie-banner. Pages mapped to "true" are stored inCookieBanner.getIgnoreList()
when callingsave()
- Returns:
- Map
-
save
public void save()Save the currentgetCookieBannerForEdit()
to the DAO. Set the banners ignore list fromgetCmsPageMap()
before -
resetUserConsent
Set theCookieBanner.getRequiresConsentAfter()
to the current time. Applies directly to the persisted object- Throws:
DAOException
-
setBannerActive
Activate/deactivate the cookie banner. Applies directly to the persisted object- Parameters:
active
-- 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
Return a json object to use a configuration object to the viewerJS.cookieBanner.js javascript- Returns:
- a json config object
-