Class NotifyThreadCommentMentionsObserver
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.cms.repository.mentions.AbstractNotifyMentionsObserver<Thread>
org.ametys.cms.repository.comment.contributor.AbstractCommentNotifyMentionsObserver<Thread>
org.ametys.plugins.workspaces.comments.AbstractNotifyWorkspacesCommentMentionsObserver<Thread>
org.ametys.plugins.workspaces.comments.NotifyThreadCommentMentionsObserver
- All Implemented Interfaces:
AsyncObserver
,Observer
,LogEnabled
,Prioritizable
,Supporter<Event>
,Component
,Contextualizable
,Serviceable
public class NotifyThreadCommentMentionsObserver
extends AbstractNotifyWorkspacesCommentMentionsObserver<Thread>
Observer to send mails to mentioned users in contributor comments of
Thread
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ametys.cms.repository.mentions.AbstractNotifyMentionsObserver
AbstractNotifyMentionsObserver.LinkToAmetysObject, AbstractNotifyMentionsObserver.MentionableObject
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ForumWorkspaceModule
The forum moduleprotected ThreadJSONHelper
The project tags DAOFields inherited from class org.ametys.plugins.workspaces.comments.AbstractNotifyWorkspacesCommentMentionsObserver
_context, _documentModule, _projectManager, _projectRightsHelper, _renderingContextHandler, _rightManager, _taskModule, _workspaceHelper
Fields inherited from class org.ametys.cms.repository.mentions.AbstractNotifyMentionsObserver
_currentUserProvider, _i18nUtils, _mentionUtils, _resolvedUsers, _resolver, _userManager
Fields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
_getAmetysObjectTitle
(Thread thread) Get the title to display in the mailprotected I18nizableText
_getMailMessage
(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Retrieves the notification mail's subjectprotected I18nizableText
Get the type of message to display before the message_getMentionableObjectFromArguments
(Map<String, Object> arguments) Get all information of the mentionable object from the argumentsprotected String
Get the module id to check read accessprotected String
_transformSyntaxTextToReadableTextWithColors
(String content, UserIdentity recipient) Transform syntax text to readable text with colors according to whether the recipient is the one being tagged or notvoid
contextualize
(Context context) protected String
Get the URL of the given Ametys object in the context of the given projectvoid
service
(ServiceManager manager) boolean
Check if an element is supportedMethods inherited from class org.ametys.plugins.workspaces.comments.AbstractNotifyWorkspacesCommentMentionsObserver
_canSendMailToMentionedUser, _getAbsoluteUrl, _getAmetysObjectFromArguments, _getLanguage, _getMailSubject, _getMailTitle, getStandardMailBodyHelper, observe
Methods inherited from class org.ametys.cms.repository.comment.contributor.AbstractCommentNotifyMentionsObserver
_getComment
Methods inherited from class org.ametys.cms.repository.mentions.AbstractNotifyMentionsObserver
_createBody, _sendMail, _sendMailToMentionedUsers, getPriority
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 Details
-
_forumModule
The forum module -
_threadJSONHelper
The project tags DAO
-
-
Constructor Details
-
NotifyThreadCommentMentionsObserver
public NotifyThreadCommentMentionsObserver()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractNotifyWorkspacesCommentMentionsObserver<Thread>
- Throws:
ServiceException
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Overrides:
contextualize
in classAbstractNotifyWorkspacesCommentMentionsObserver<Thread>
- Throws:
ContextException
-
supports
Description copied from interface:Supporter
Check if an element is supported- Parameters:
event
- The element- Returns:
true
if the element is supported,false
otherwise
-
_getAmetysObjectTitle
Description copied from class:AbstractCommentNotifyMentionsObserver
Get the title to display in the mail- Specified by:
_getAmetysObjectTitle
in classAbstractCommentNotifyMentionsObserver<Thread>
- Parameters:
thread
- the ametys object- Returns:
- the ametys object title
-
_getMailMessage
protected I18nizableText _getMailMessage(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Description copied from class:AbstractNotifyMentionsObserver
Retrieves the notification mail's subject- Specified by:
_getMailMessage
in classAbstractNotifyMentionsObserver<Thread>
- Parameters:
mentionableObject
- the mentionable object- Returns:
- the notification mail's subject
-
_transformSyntaxTextToReadableTextWithColors
protected String _transformSyntaxTextToReadableTextWithColors(String content, UserIdentity recipient) Description copied from class:AbstractNotifyMentionsObserver
Transform syntax text to readable text with colors according to whether the recipient is the one being tagged or not- Overrides:
_transformSyntaxTextToReadableTextWithColors
in classAbstractCommentNotifyMentionsObserver<Thread>
- Parameters:
content
- the syntax textrecipient
- the recipient- Returns:
- the readable text
-
_getMentionableObjectFromArguments
protected AbstractNotifyMentionsObserver.MentionableObject _getMentionableObjectFromArguments(Map<String, Object> arguments) throws ExceptionDescription copied from class:AbstractNotifyMentionsObserver
Get all information of the mentionable object from the arguments- Specified by:
_getMentionableObjectFromArguments
in classAbstractNotifyMentionsObserver<Thread>
- Parameters:
arguments
- the arguments map- Returns:
- the mentionable object
- Throws:
Exception
- if an error occurs.
-
_getMailMessageType
Description copied from class:AbstractNotifyMentionsObserver
Get the type of message to display before the message- Overrides:
_getMailMessageType
in classAbstractCommentNotifyMentionsObserver<Thread>
- Returns:
- the message type
-
_getModuleId
Description copied from class:AbstractNotifyWorkspacesCommentMentionsObserver
Get the module id to check read access- Specified by:
_getModuleId
in classAbstractNotifyWorkspacesCommentMentionsObserver<Thread>
- Returns:
- the module id
-
getUrl
Description copied from class:AbstractNotifyWorkspacesCommentMentionsObserver
Get the URL of the given Ametys object in the context of the given project- Specified by:
getUrl
in classAbstractNotifyWorkspacesCommentMentionsObserver<Thread>
- Parameters:
thread
- the Ametys objectproject
- the project containing the Ametys object- Returns:
- the URL (may be relative or absolute depending on the implementation)
-