Class NotifyThreadMentionsObserver
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.cms.repository.mentions.AbstractNotifyMentionsObserver<Thread>
org.ametys.plugins.workspaces.comments.NotifyThreadMentionsObserver
- All Implemented Interfaces:
AsyncObserver
,Observer
,LogEnabled
,Prioritizable
,Supporter<Event>
,Component
,Contextualizable
,Serviceable
public class NotifyThreadMentionsObserver
extends AbstractNotifyMentionsObserver<Thread>
implements Contextualizable
Observer to send mails to mentioned users in content 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 Context
The Avalon contextprotected ForumWorkspaceModule
The forum moduleprotected ProjectManager
The project managerprotected ProjectRightHelper
The project rights helperprotected RenderingContextHandler
The rendering context handlerprotected RightManager
The right managerprotected ThreadJSONHelper
The project tags DAOprotected WorkspacesHelper
The Workspaces helperFields 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 boolean
_canSendMailToMentionedUser
(Thread thread, User authorIdentity, UserIdentity mentionedUserIdentity) true
if we can send a mail to the mentioned userprotected I18nizableText
_getMailMessage
(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Retrieves the notification mail's subjectprotected I18nizableText
Get the type of message to display before the messageprotected I18nizableText
_getMailSubject
(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Retrieves the notification mail's subjectprotected I18nizableText
_getMailTitle
(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Get the title of the mail body_getMentionableObjectFromArguments
(Map<String, Object> arguments) Get all information of the mentionable object from the argumentsprotected 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) void
Observes an event.void
service
(ServiceManager manager) boolean
Check if an element is supportedMethods inherited from class org.ametys.cms.repository.mentions.AbstractNotifyMentionsObserver
_createBody, _sendMail, _sendMailToMentionedUsers, getPriority, getStandardMailBodyHelper
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
-
_rightManager
The right manager -
_forumModule
The forum module -
_projectManager
The project manager -
_threadJSONHelper
The project tags DAO -
_context
The Avalon context -
_workspaceHelper
The Workspaces helper -
_projectRightsHelper
The project rights helper -
_renderingContextHandler
The rendering context handler
-
-
Constructor Details
-
NotifyThreadMentionsObserver
public NotifyThreadMentionsObserver()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractNotifyMentionsObserver<Thread>
- Throws:
ServiceException
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
observe
Description copied from interface:Observer
Observes an event.- Specified by:
observe
in interfaceObserver
- Overrides:
observe
in classAbstractNotifyMentionsObserver<Thread>
- 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.
-
supports
Description copied from interface:Supporter
Check if an element is supported -
_getMailTitle
protected I18nizableText _getMailTitle(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Description copied from class:AbstractNotifyMentionsObserver
Get the title of the mail body- Specified by:
_getMailTitle
in classAbstractNotifyMentionsObserver<Thread>
- Parameters:
mentionableObject
- the mentionable object- Returns:
- the mail title
-
_getMailSubject
protected I18nizableText _getMailSubject(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Description copied from class:AbstractNotifyMentionsObserver
Retrieves the notification mail's subject- Specified by:
_getMailSubject
in classAbstractNotifyMentionsObserver<Thread>
- Parameters:
mentionableObject
- the mentionable object- Returns:
- the notification mail's subject
-
_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.
-
_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- Specified by:
_transformSyntaxTextToReadableTextWithColors
in classAbstractNotifyMentionsObserver<Thread>
- Parameters:
content
- the syntax textrecipient
- the recipient- Returns:
- the readable text
-
_getMailMessageType
Description copied from class:AbstractNotifyMentionsObserver
Get the type of message to display before the message- Specified by:
_getMailMessageType
in classAbstractNotifyMentionsObserver<Thread>
- Returns:
- the message type
-
_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
-
_canSendMailToMentionedUser
protected boolean _canSendMailToMentionedUser(Thread thread, User authorIdentity, UserIdentity mentionedUserIdentity) Description copied from class:AbstractNotifyMentionsObserver
true
if we can send a mail to the mentioned user- Overrides:
_canSendMailToMentionedUser
in classAbstractNotifyMentionsObserver<Thread>
- Parameters:
thread
- the ametys objectauthorIdentity
- the authormentionedUserIdentity
- the mentioned user- Returns:
true
if we can send a mail to the mentioned user
-