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_i18nUtilsThe i18n utilsprotected AmetysObjectResolver_resolverThe Ametys object resolverprotected PageSubscriptionDAO_subscriptionDAOThe subscription daoprotected UserManager_userManagerThe 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 eventintgetPriority(Event event)Retrieves the priority to observe this event.
This can be used to process a supported event before others observers.protected abstract StringgetSiteParameterId()Id of the site parameter to enable/disable the notificationprotected booleanisNotificationEnabled(Page page)Determines if the notification is currently enabledvoidobserve(Event event, Map<String,Object> transientVars)Observes an event.voidservice(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:
servicein interfaceServiceable- Throws:
ServiceException
-
getPriority
public int getPriority(Event event)
Description copied from interface:ObserverRetrieves the priority to observe this event.
This can be used to process a supported event before others observers.- Specified by:
getPriorityin 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:ObserverObserves 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
-
-