Package io.goobi.viewer.managedbeans
Class CookieBannerBean
java.lang.Object
io.goobi.viewer.managedbeans.CookieBannerBean
- All Implemented Interfaces:
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:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor using the IDAO from theDataManagerclass.CookieBannerBean(IDAO dao) Creates a new testing purposes instance. -
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.Returns a json object to use a configuration object to the viewerJS.cookieBanner.js javascript.Get the copy of the stored cookie banner for editing.Get the initialization status of the bean.booleanCheck if the banner is active, i.e. should be displayed at allvoidSet theCookieBanner.getRequiresConsentAfter()to the current time.voidsave()Save the currentgetCookieBannerForEdit()to the DAO.voidsetBannerActive(boolean active) Activate/deactivate the cookie banner.
-
Constructor Details
-
CookieBannerBean
public CookieBannerBean()Default constructor using the IDAO from theDataManagerclass. -
CookieBannerBean
Creates a new testing purposes instance.- 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- 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
Returns a json object to use a configuration object to the viewerJS.cookieBanner.js javascript.- Returns:
- a json config object
-