Class AbstractPageSubscriptionObserver
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.pagesubscription.observer.AbstractPageSubscriptionObserver
-
- All Implemented Interfaces:
Observer
,LogEnabled
,Serviceable
- Direct Known Subclasses:
PageSubscriptionDeletePageObserver
,PageSubscriptionExplorerObserver
,PageSubscriptionValidateContentObserver
public abstract class AbstractPageSubscriptionObserver extends AbstractLogEnabled implements Observer, Serviceable
Abstract implementation of the observers of Page Subscription.
-
-
Field Summary
Fields Modifier and Type Field Description protected I18nUtils
_i18nUtils
The i18n utilsprotected AmetysObjectResolver
_resolver
The Ametys object resolverprotected PageSubscriptionDAO
_subscriptionDAO
The subscription daoprotected UserManager
_userManager
The user manager-
Fields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description AbstractPageSubscriptionObserver()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected String
_getAbsolutePageUrl(Page page)
Get the absolute URL of a pageprotected abstract String
_getMailBody(Event event, Page page)
Create the mail body depend on the eventprotected abstract String
_getMailSubject(Event event, Page page)
Create the mail subject depend on the eventprotected abstract Collection<Page>
_getPages(Event event)
Get the pages linked to the eventint
getPriority(Event event)
Retrieves the priority to observe this event.
This can be used to process a supported event before others observers.protected abstract String
getSiteParameterId()
Id of the site parameter to enable/disable the notificationprotected boolean
isNotificationEnabled(Page page)
Determines if the notification is currently enabledvoid
observe(Event event, Map<String,Object> transientVars)
Observes an event.void
service(ServiceManager smanager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_userManager
protected UserManager _userManager
The user manager
-
_resolver
protected AmetysObjectResolver _resolver
The Ametys object resolver
-
_i18nUtils
protected I18nUtils _i18nUtils
The i18n utils
-
_subscriptionDAO
protected PageSubscriptionDAO _subscriptionDAO
The subscription dao
-
-
Constructor Detail
-
AbstractPageSubscriptionObserver
public AbstractPageSubscriptionObserver()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getPriority
public int getPriority(Event event)
Description copied from interface:Observer
Retrieves the priority to observe this event.
This can be used to process a supported event before others observers.- Specified by:
getPriority
in interfaceObserver
- Parameters:
event
- the event.- Returns:
- the priority where 0 the max priority and Integer.MAX_VALUE the min priority.
-
observe
public void observe(Event event, Map<String,Object> transientVars)
Description copied from interface:Observer
Observes an event.
-
isNotificationEnabled
protected boolean isNotificationEnabled(Page page)
Determines if the notification is currently enabled- Parameters:
page
- The page- Returns:
- true if the notification is enabled
-
getSiteParameterId
protected abstract String getSiteParameterId()
Id of the site parameter to enable/disable the notification- Returns:
- The id of site
-
_getAbsolutePageUrl
protected String _getAbsolutePageUrl(Page page)
Get the absolute URL of a page- Parameters:
page
- The page to retrieve the url- Returns:
- The absolute url of the page
-
_getMailSubject
protected abstract String _getMailSubject(Event event, Page page)
Create the mail subject depend on the event- Parameters:
event
- the eventpage
- the page- Returns:
- the mail subject
-
_getMailBody
protected abstract String _getMailBody(Event event, Page page)
Create the mail body depend on the event- Parameters:
event
- the eventpage
- the page- Returns:
- the mail body
-
_getPages
protected abstract Collection<Page> _getPages(Event event)
Get the pages linked to the event- Parameters:
event
- the event- Returns:
- the pages linked to the event
-
-