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 ContentHelper
The content helperprotected RightManager
The right managerFields 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
(Content ametysObject, User authorIdentity, UserIdentity mentionedUserIdentity) true
if 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 contentvoid
Observes an event.void
service
(ServiceManager manager) boolean
Check if an element is supportedMethods inherited from class org.ametys.cms.repository.comment.contributor.AbstractCommentNotifyMentionsObserver
_getComment, _getMailMessageType, _getMailSubject, _transformSyntaxTextToReadableTextWithColors
Methods 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
-
_contentHelper
The content helper -
_rightManager
The right manager
-
-
Constructor Details
-
NotifyContentMentionsObserver
public NotifyContentMentionsObserver()
-
-
Method Details
-
observe
Description copied from interface:Observer
Observes an event.- Specified by:
observe
in interfaceObserver
- Overrides:
observe
in 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:
service
in interfaceServiceable
- Overrides:
service
in classAbstractNotifyMentionsObserver<Content>
- Throws:
ServiceException
-
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
-
_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<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:AbstractCommentNotifyMentionsObserver
Get the title to display in the mail- Specified by:
_getAmetysObjectTitle
in classAbstractCommentNotifyMentionsObserver<Content>
- Parameters:
content
- 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<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:AbstractNotifyMentionsObserver
true
if we can send a mail to the mentioned user- Overrides:
_canSendMailToMentionedUser
in classAbstractNotifyMentionsObserver<Content>
- Parameters:
ametysObject
- the ametys objectauthorIdentity
- the authormentionedUserIdentity
- the mentioned user- Returns:
true
if 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:AbstractNotifyMentionsObserver
Get the title of the mail body- Specified by:
_getMailTitle
in classAbstractNotifyMentionsObserver<Content>
- Parameters:
mentionableObject
- the mentionable object- Returns:
- the mail title
-