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 ContextThe Avalon contextprotected ForumWorkspaceModuleThe forum moduleprotected ProjectManagerThe project managerprotected ProjectRightHelperThe project rights helperprotected RenderingContextHandlerThe rendering context handlerprotected RightManagerThe right managerprotected ThreadJSONHelperThe project tags DAOprotected 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(Thread thread, User authorIdentity, UserIdentity mentionedUserIdentity) trueif we can send a mail to the mentioned userprotected I18nizableText_getMailMessage(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Retrieves the notification mail's subjectprotected I18nizableTextGet 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 notvoidcontextualize(Context context) voidObserves an event.voidservice(ServiceManager manager) booleanCheck if an element is supportedMethods inherited from class org.ametys.cms.repository.mentions.AbstractNotifyMentionsObserver
_createBody, _sendMail, _sendMailToMentionedUsers, getPriority, getStandardMailBodyHelperMethods 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 -
_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:
servicein interfaceServiceable- Overrides:
servicein classAbstractNotifyMentionsObserver<Thread>- Throws:
ServiceException
-
contextualize
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
observe
Description copied from interface:ObserverObserves an event.- Specified by:
observein interfaceObserver- Overrides:
observein 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:SupporterCheck if an element is supported -
_getMailTitle
protected I18nizableText _getMailTitle(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Description copied from class:AbstractNotifyMentionsObserverGet the title of the mail body- Specified by:
_getMailTitlein classAbstractNotifyMentionsObserver<Thread>- Parameters:
mentionableObject- the mentionable object- Returns:
- the mail title
-
_getMailSubject
protected I18nizableText _getMailSubject(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Description copied from class:AbstractNotifyMentionsObserverRetrieves the notification mail's subject- Specified by:
_getMailSubjectin 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:AbstractNotifyMentionsObserverGet all information of the mentionable object from the arguments- Specified by:
_getMentionableObjectFromArgumentsin 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:AbstractNotifyMentionsObserverTransform syntax text to readable text with colors according to whether the recipient is the one being tagged or not- Specified by:
_transformSyntaxTextToReadableTextWithColorsin classAbstractNotifyMentionsObserver<Thread>- Parameters:
content- the syntax textrecipient- the recipient- Returns:
- the readable text
-
_getMailMessageType
Description copied from class:AbstractNotifyMentionsObserverGet the type of message to display before the message- Specified by:
_getMailMessageTypein classAbstractNotifyMentionsObserver<Thread>- Returns:
- the message type
-
_getMailMessage
protected I18nizableText _getMailMessage(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Description copied from class:AbstractNotifyMentionsObserverRetrieves the notification mail's subject- Specified by:
_getMailMessagein 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:AbstractNotifyMentionsObservertrueif we can send a mail to the mentioned user- Overrides:
_canSendMailToMentionedUserin classAbstractNotifyMentionsObserver<Thread>- Parameters:
thread- the ametys objectauthorIdentity- the authormentionedUserIdentity- the mentioned user- Returns:
trueif we can send a mail to the mentioned user
-