Class AbstractMemberMailNotifierObserver
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.workspaces.project.notification.AbstractMemberMailNotifierObserver
-
- All Implemented Interfaces:
AsyncObserver
,Observer
,LogEnabled
,PluginAware
,Contextualizable
,Serviceable
- Direct Known Subclasses:
AbstractRemoveMemberMailNotifierObserver
,AddMemberMailNotifierObserver
public abstract class AbstractMemberMailNotifierObserver extends AbstractLogEnabled implements AsyncObserver, PluginAware, Serviceable, Contextualizable
Abstract observer for sending mail to members
-
-
Field Summary
Fields Modifier and Type Field Description protected Context
_context
The avalon contextprotected GroupManager
_groupManager
Group managerprotected I18nUtils
_i18nUtils
The i18n utilsprotected String
_pluginName
The name of current pluginprotected PopulationContextHelper
_populationContextHelper
Population context helperprotected ProjectManager
_projectManager
Project managerprotected ProjectMemberManager
_projectMemberManager
The project member managerprotected RenderingContextHandler
_renderingContextHandler
The rendering contextprotected AmetysObjectResolver
_resolver
The Ametys Object resolverprotected SiteManager
_siteManager
Site managerprotected SourceResolver
_srcResolver
Source Resolverprotected UserManager
_userManager
User manager-
Fields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description AbstractMemberMailNotifierObserver()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
contextualize(Context context)
protected abstract I18nizableText
getI18nSubject(Event event, Project project)
Get theI18nizableText
for mail subjectprotected String
getMailBodyURI(Event event, Project project)
Returns the URI for HTML mail bodyint
getPriority(Event event)
Retrieves the priority to observe this event.
This can be used to process a supported event before others observers.protected List<String>
getUsersEmail(List<User> users)
Get the list of emails from users, filtering out users with no emailsprotected abstract List<String>
getUserToNotify(Event event, Project project)
Get email's recipientsvoid
observe(Event event, Map<String,Object> transientVars)
Observes an event.void
service(ServiceManager manager)
void
setPluginInfo(String pluginName, String featureName, String id)
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.core.observation.AsyncObserver
parallelizable
-
-
-
-
Field Detail
-
_pluginName
protected String _pluginName
The name of current plugin
-
_resolver
protected AmetysObjectResolver _resolver
The Ametys Object resolver
-
_i18nUtils
protected I18nUtils _i18nUtils
The i18n utils
-
_projectMemberManager
protected ProjectMemberManager _projectMemberManager
The project member manager
-
_projectManager
protected ProjectManager _projectManager
Project manager
-
_siteManager
protected SiteManager _siteManager
Site manager
-
_populationContextHelper
protected PopulationContextHelper _populationContextHelper
Population context helper
-
_srcResolver
protected SourceResolver _srcResolver
Source Resolver
-
_userManager
protected UserManager _userManager
User manager
-
_groupManager
protected GroupManager _groupManager
Group manager
-
_renderingContextHandler
protected RenderingContextHandler _renderingContextHandler
The rendering context
-
-
Constructor Detail
-
AbstractMemberMailNotifierObserver
public AbstractMemberMailNotifierObserver()
-
-
Method Detail
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
public void service(ServiceManager manager) 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) throws Exception
Description copied from interface:Observer
Observes an event.- Specified by:
observe
in interfaceObserver
- Parameters:
event
- the event.transientVars
- transientVars passed from one Observer to another when processing a single Event. This may allow optimizations between observers.- Throws:
Exception
- if an error occurs. All exceptions will be logged but not propagated, as the observation mechanism should never fail.
-
getUserToNotify
protected abstract List<String> getUserToNotify(Event event, Project project)
Get email's recipients- Parameters:
event
- the eventproject
- the project- Returns:
- the recipients
-
getUsersEmail
protected List<String> getUsersEmail(List<User> users)
Get the list of emails from users, filtering out users with no emails- Parameters:
users
- The list of users- Returns:
- The list of emails
-
getMailBodyURI
protected String getMailBodyURI(Event event, Project project)
Returns the URI for HTML mail body- Parameters:
event
- the eventproject
- the project- Returns:
- The URI for HTML mail body
-
getI18nSubject
protected abstract I18nizableText getI18nSubject(Event event, Project project)
Get theI18nizableText
for mail subject- Parameters:
event
- the eventproject
- the project- Returns:
- the
I18nizableText
for subject
-
-