Class AbstractNotifyWorkspacesCommentMentionsObserver<T extends CommentableAmetysObject>
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.cms.repository.mentions.AbstractNotifyMentionsObserver<T>
org.ametys.cms.repository.comment.contributor.AbstractCommentNotifyMentionsObserver<T>
org.ametys.plugins.workspaces.comments.AbstractNotifyWorkspacesCommentMentionsObserver<T>
- Type Parameters:
T- type of theCommentableAmetysObject
- All Implemented Interfaces:
AsyncObserver,Observer,LogEnabled,Prioritizable,Supporter<Event>,Component,Contextualizable,Serviceable
- Direct Known Subclasses:
NotifyFileCommentMentionsObserver,NotifyTaskCommentMentionsObserver,NotifyThreadCommentMentionsObserver
public abstract class AbstractNotifyWorkspacesCommentMentionsObserver<T extends CommentableAmetysObject>
extends AbstractCommentNotifyMentionsObserver<T>
implements Contextualizable
Observer to send mails to mentioned users in contributor comments of workspaces objects
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ametys.cms.repository.mentions.AbstractNotifyMentionsObserver
AbstractNotifyMentionsObserver.LinkToAmetysObject, AbstractNotifyMentionsObserver.MentionableObject -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ContextThe contextprotected DocumentWorkspaceModuleThe document moduleprotected ProjectManagerThe project managerprotected ProjectRightHelperThe project rights helperprotected RenderingContextHandlerThe rendering context handlerprotected RightManagerThe right managerprotected TasksWorkspaceModuleThe task moduleprotected WorkspacesHelperThe Workspaces helperFields inherited from class org.ametys.cms.repository.mentions.AbstractNotifyMentionsObserver
_currentUserProvider, _i18nUtils, _mentionUtils, _resolvedUsers, _resolver, _userLanguagesManager, _userManagerFields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean_canSendMailToMentionedUser(T ametysObject, User authorIdentity, UserIdentity mentionedUserIdentity) trueif we can send a mail to the mentioned userprotected String_getAbsoluteUrl(T ametysObject, Project project) Get the absolute URL of the given Ametys object in the context of the given projectprotected T_getAmetysObjectFromArguments(Map<String, Object> arguments) Get the Ametys object from the event argumentsprotected String_getLanguage(Project project) Get the language of the project containing the given objectprotected I18nizableText_getMailSubject(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Retrieves the notification mail's subjectprotected I18nizableText_getMailTitle(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Get the title of the mail bodyprotected abstract StringGet the module id to check read accessvoidcontextualize(Context context) protected StandardMailBodyHelper.MailBodyBuilderGet a standard mail body helperprotected abstract StringGet the URL of the given Ametys object in the context of the given projectvoidObserves an event.voidservice(ServiceManager manager) Methods inherited from class org.ametys.cms.repository.comment.contributor.AbstractCommentNotifyMentionsObserver
_getAmetysObjectTitle, _getComment, _getMailMessageType, _transformSyntaxTextToReadableTextWithColorsMethods inherited from class org.ametys.cms.repository.mentions.AbstractNotifyMentionsObserver
_createBody, _getMailMessage, _getMentionableObjectFromArguments, _sendMail, _sendMailToMentionedUsers, getPriorityMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLoggerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ametys.core.observation.AsyncObserver
parallelizable
-
Field Details
-
_rightManager
The right manager -
_projectManager
The project manager -
_taskModule
The task module -
_documentModule
The document module -
_workspaceHelper
The Workspaces helper -
_context
The context -
_projectRightsHelper
The project rights helper -
_renderingContextHandler
The rendering context handler
-
-
Constructor Details
-
AbstractNotifyWorkspacesCommentMentionsObserver
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractNotifyMentionsObserver<T extends CommentableAmetysObject>- Throws:
ServiceException
-
contextualize
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
observe
Description copied from interface:ObserverObserves an event.- Specified by:
observein interfaceObserver- Overrides:
observein classAbstractNotifyMentionsObserver<T extends CommentableAmetysObject>- 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.
-
_getLanguage
Get the language of the project containing the given object- Parameters:
project- the project- Returns:
- the language code
-
_getAmetysObjectFromArguments
Get the Ametys object from the event arguments- Parameters:
arguments- the event arguments- Returns:
- the Ametys object
-
getStandardMailBodyHelper
Description copied from class:AbstractNotifyMentionsObserverGet a standard mail body helper- Overrides:
getStandardMailBodyHelperin classAbstractNotifyMentionsObserver<T extends CommentableAmetysObject>- Returns:
- the standard mail body helper
-
_getMailSubject
protected I18nizableText _getMailSubject(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Description copied from class:AbstractNotifyMentionsObserverRetrieves the notification mail's subject- Overrides:
_getMailSubjectin classAbstractCommentNotifyMentionsObserver<T extends CommentableAmetysObject>- Parameters:
mentionableObject- the mentionable object- Returns:
- the notification mail's subject
-
_getMailTitle
protected I18nizableText _getMailTitle(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Description copied from class:AbstractNotifyMentionsObserverGet the title of the mail body- Specified by:
_getMailTitlein classAbstractNotifyMentionsObserver<T extends CommentableAmetysObject>- Parameters:
mentionableObject- the mentionable object- Returns:
- the mail title
-
_canSendMailToMentionedUser
protected boolean _canSendMailToMentionedUser(T ametysObject, User authorIdentity, UserIdentity mentionedUserIdentity) Description copied from class:AbstractNotifyMentionsObservertrueif we can send a mail to the mentioned user- Overrides:
_canSendMailToMentionedUserin classAbstractNotifyMentionsObserver<T extends CommentableAmetysObject>- Parameters:
ametysObject- the ametys objectauthorIdentity- the authormentionedUserIdentity- the mentioned user- Returns:
trueif we can send a mail to the mentioned user
-
_getModuleId
Get the module id to check read access- Returns:
- the module id
-
_getAbsoluteUrl
Get the absolute URL of the given Ametys object in the context of the given project- Parameters:
ametysObject- the Ametys objectproject- the project containing the Ametys object- Returns:
- the absolute URL
-
getUrl
Get the URL of the given Ametys object in the context of the given project- Parameters:
ametysObject- the Ametys objectproject- the project containing the Ametys object- Returns:
- the URL (may be relative or absolute depending on the implementation)
-