Class NotifyContentMentionsObserver
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.cms.repository.mentions.AbstractNotifyMentionsObserver<Content>
org.ametys.cms.repository.comment.contributor.AbstractCommentNotifyMentionsObserver<Content>
org.ametys.cms.repository.comment.contributor.NotifyContentMentionsObserver
- All Implemented Interfaces:
AsyncObserver,Observer,LogEnabled,Prioritizable,Supporter<Event>,Component,Serviceable
- Direct Known Subclasses:
NotifyContentMentionsObserver
Observer to send mails to mentioned users in contributor comments of
Content-
Nested Class Summary
Nested classes/interfaces inherited from class org.ametys.cms.repository.mentions.AbstractNotifyMentionsObserver
AbstractNotifyMentionsObserver.LinkToAmetysObject, AbstractNotifyMentionsObserver.MentionableObject -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ContentHelperThe content helperprotected RightManagerThe right managerFields 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(Content ametysObject, User authorIdentity, UserIdentity mentionedUserIdentity) trueif we can send a mail to the mentioned userprotected I18nizableText_getAdminMailMessage(Content content, User author) Retrieves the admin notification mail's messageprotected I18nizableText_getAdminMailSubject(Content content, User author) Retrieves the admin notification mail's subjectprotected String_getAmetysObjectTitle(Content content) Get the title to display in the mailprotected I18nizableText_getMailMessage(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 Set<UserIdentity> getAdminUsers(Content content) Get all admin users for a given contentvoidObserves an event.voidservice(ServiceManager manager) booleanCheck if an element is supportedMethods inherited from class org.ametys.cms.repository.comment.contributor.AbstractCommentNotifyMentionsObserver
_getComment, _getMailMessageType, _getMailSubject, _transformSyntaxTextToReadableTextWithColorsMethods 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
-
_contentHelper
The content helper -
_rightManager
The right manager
-
-
Constructor Details
-
NotifyContentMentionsObserver
public NotifyContentMentionsObserver()
-
-
Method Details
-
observe
Description copied from interface:ObserverObserves an event.- Specified by:
observein interfaceObserver- Overrides:
observein classAbstractNotifyMentionsObserver<Content>- 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.
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractNotifyMentionsObserver<Content>- Throws:
ServiceException
-
supports
Description copied from interface:SupporterCheck if an element is supported- Parameters:
event- The element- Returns:
trueif the element is supported,falseotherwise
-
_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<Content>- Parameters:
arguments- the arguments map- Returns:
- the mentionable object
- Throws:
Exception- if an error occurs.
-
getAdminUsers
Get all admin users for a given content- Parameters:
content- the content- Returns:
- the set of admin users
-
_getAmetysObjectTitle
Description copied from class:AbstractCommentNotifyMentionsObserverGet the title to display in the mail- Specified by:
_getAmetysObjectTitlein classAbstractCommentNotifyMentionsObserver<Content>- Parameters:
content- the ametys object- Returns:
- the ametys object title
-
_getMailMessage
protected I18nizableText _getMailMessage(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Description copied from class:AbstractNotifyMentionsObserverRetrieves the notification mail's subject- Specified by:
_getMailMessagein classAbstractNotifyMentionsObserver<Content>- Parameters:
mentionableObject- the mentionable object- Returns:
- the notification mail's subject
-
_canSendMailToMentionedUser
protected boolean _canSendMailToMentionedUser(Content ametysObject, User authorIdentity, UserIdentity mentionedUserIdentity) Description copied from class:AbstractNotifyMentionsObservertrueif we can send a mail to the mentioned user- Overrides:
_canSendMailToMentionedUserin classAbstractNotifyMentionsObserver<Content>- Parameters:
ametysObject- the ametys objectauthorIdentity- the authormentionedUserIdentity- the mentioned user- Returns:
trueif we can send a mail to the mentioned user
-
_getAdminMailSubject
Retrieves the admin notification mail's subject- Parameters:
content- the contentauthor- the author of the comment- Returns:
- the admin notification mail's subject
-
_getAdminMailMessage
Retrieves the admin notification mail's message- Parameters:
content- the contentauthor- the author of the comment- Returns:
- the admin notification mail's message
-
_getMailTitle
protected I18nizableText _getMailTitle(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Description copied from class:AbstractNotifyMentionsObserverGet the title of the mail body- Specified by:
_getMailTitlein classAbstractNotifyMentionsObserver<Content>- Parameters:
mentionableObject- the mentionable object- Returns:
- the mail title
-