public abstract class AbstractSendNotificationObserver extends AbstractLogEnabled implements Observer, Serviceable, Contextualizable, PluginAware
Observer
for observing events on resources projectModifier and Type | Field and Description |
---|---|
protected Context |
_context
The avalon context
|
protected I18nUtils |
_i18nUtils
The i18n utils
|
protected WorkspaceModuleExtensionPoint |
_moduleManagerEP
The workspace module managers EP
|
protected String |
_pluginName
The name of current plugin
|
protected ProjectManager |
_projectManager
The project manager
|
protected RenderingContextHandler |
_renderingContextHandler
The rendering context handler
|
protected AmetysObjectResolver |
_resolver
The Ametys Object Resolver
|
protected RightManager |
_rightManager
The rights manager
|
protected UserManager |
_userManager
The users manager
|
MAX_PRIORITY, MIN_PRIORITY
Constructor and Description |
---|
AbstractSendNotificationObserver() |
Modifier and Type | Method and Description |
---|---|
protected String |
_getPath(String rootPath,
String path)
format the path without the root path
|
void |
contextualize(Context context) |
protected String |
getDefaultLanguage()
Get the default language to resolve module's page
|
protected List<String> |
getMailCommonParams(Project project,
User issuer,
String explorerNodeId)
Get the common mail parameters
|
protected Page |
getModulePage(Project project,
String moduleId)
Get the module's page
|
protected String |
getModuleUrl(Project project,
String moduleId,
String objectId)
Get the absolute full url of module'page
|
int |
getPriority(Event event)
Retrieves the priority to observe this event.
This can be used to process a supported event before others observers. |
protected Project |
getProject(Event event)
Get the project from event
|
protected String |
getProjectUrl(Project project)
Get the absolute url of project
|
protected abstract String |
getRightIdForNotify()
Get the right to check allowed users to notify by mail
|
protected abstract String |
getUrl(Project project,
String objectId)
Get the URL of project to insert in email body
|
protected List<UserIdentity> |
getUsersToNotify(String eventId,
AmetysObject object)
Get the users allowed to be notified
|
protected abstract void |
notifyEvent(Project project,
String eventId,
Map<String,Object> eventParams,
User issuer)
Notify email by mail
|
void |
observe(Event event,
Map<String,Object> transientVars)
Observes an event.
|
protected void |
sendMail(String eventId,
List<UserIdentity> recipients,
String mailBodyi18nKey,
String mailSubjecti18nKey,
List<String> mailBodyParams,
List<String> mailSubjectParams)
Sent an email
|
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. |
getLogger, setLogger
protected AmetysObjectResolver _resolver
protected UserManager _userManager
protected RightManager _rightManager
protected I18nUtils _i18nUtils
protected ProjectManager _projectManager
protected RenderingContextHandler _renderingContextHandler
protected String _pluginName
protected WorkspaceModuleExtensionPoint _moduleManagerEP
public AbstractSendNotificationObserver()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void setPluginInfo(String pluginName, String featureName, String id)
PluginAware
setPluginInfo
in interface PluginAware
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this componentpublic int getPriority(Event event)
Observer
getPriority
in interface Observer
event
- the event.public void observe(Event event, Map<String,Object> transientVars)
Observer
protected abstract void notifyEvent(Project project, String eventId, Map<String,Object> eventParams, User issuer)
project
- The projecteventId
- The id of eventeventParams
- The event's argumentsissuer
- The issuerprotected Project getProject(Event event)
event
- The eventprotected List<String> getMailCommonParams(Project project, User issuer, String explorerNodeId)
project
- The parent projectissuer
- The user responsible of the actionexplorerNodeId
- the id of the explorer node. Can be null.protected String getDefaultLanguage()
protected Page getModulePage(Project project, String moduleId)
project
- The projectmoduleId
- The modulenull
if not foundprotected String getModuleUrl(Project project, String moduleId, String objectId)
project
- The projectmoduleId
- The module. Can not be nullobjectId
- The id of concerned object. Can be null.protected String getProjectUrl(Project project)
project
- The projectprotected abstract String getUrl(Project project, String objectId)
project
- The projectobjectId
- The id of concerned objectprotected void sendMail(String eventId, List<UserIdentity> recipients, String mailBodyi18nKey, String mailSubjecti18nKey, List<String> mailBodyParams, List<String> mailSubjectParams)
eventId
- The id of eventrecipients
- The recipients of the mailmailBodyi18nKey
- i18n key for the bodymailSubjecti18nKey
- i18n key for the subjectmailBodyParams
- parameters for the bodymailSubjectParams
- parameters for the subjectprotected List<UserIdentity> getUsersToNotify(String eventId, AmetysObject object)
eventId
- The id of eventobject
- The object on which to test rightsprotected abstract String getRightIdForNotify()