Class AbstractNotifyWorkspacesCommentMentionsObserver<T extends CommentableAmetysObject>
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.cms.repository.mentions.AbstractNotifyMentionsObserver<T>
org.ametys.cms.repository.comment.contributor.AbstractCommentNotifyMentionsObserver<T>
org.ametys.plugins.workspaces.comments.AbstractNotifyWorkspacesCommentMentionsObserver<T>
- Type Parameters:
T
- type of theCommentableAmetysObject
- All Implemented Interfaces:
AsyncObserver
,Observer
,LogEnabled
,Prioritizable
,Supporter<Event>
,Component
,Contextualizable
,Serviceable
- Direct Known Subclasses:
NotifyFileCommentMentionsObserver
,NotifyTaskCommentMentionsObserver
,NotifyThreadCommentMentionsObserver
public abstract class AbstractNotifyWorkspacesCommentMentionsObserver<T extends CommentableAmetysObject>
extends AbstractCommentNotifyMentionsObserver<T>
implements Contextualizable
Observer to send mails to mentioned users in contributor comments of workspaces objects
-
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 contextprotected DocumentWorkspaceModule
The document moduleprotected ProjectManager
The project managerprotected ProjectRightHelper
The project rights helperprotected RenderingContextHandler
The rendering context handlerprotected RightManager
The right managerprotected TasksWorkspaceModule
The task moduleprotected 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
(T ametysObject, User authorIdentity, UserIdentity mentionedUserIdentity) true
if we can send a mail to the mentioned userprotected String
_getAbsoluteUrl
(T ametysObject, Project project) Get the absolute URL of the given Ametys object in the context of the given projectprotected T
_getAmetysObjectFromArguments
(Map<String, Object> arguments) Get the Ametys object from the event argumentsprotected String
_getLanguage
(Project project) Get the language of the project containing the given objectprotected I18nizableText
_getMailSubject
(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Retrieves the notification mail's subjectprotected I18nizableText
_getMailTitle
(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Get the title of the mail bodyprotected abstract String
Get the module id to check read accessvoid
contextualize
(Context context) protected StandardMailBodyHelper.MailBodyBuilder
Get a standard mail body helperprotected abstract String
Get the URL of the given Ametys object in the context of the given projectvoid
Observes an event.void
service
(ServiceManager manager) Methods inherited from class org.ametys.cms.repository.comment.contributor.AbstractCommentNotifyMentionsObserver
_getAmetysObjectTitle, _getComment, _getMailMessageType, _transformSyntaxTextToReadableTextWithColors
Methods inherited from class org.ametys.cms.repository.mentions.AbstractNotifyMentionsObserver
_createBody, _getMailMessage, _getMentionableObjectFromArguments, _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
-
_rightManager
The right manager -
_projectManager
The project manager -
_taskModule
The task module -
_documentModule
The document module -
_workspaceHelper
The Workspaces helper -
_context
The context -
_projectRightsHelper
The project rights helper -
_renderingContextHandler
The rendering context handler
-
-
Constructor Details
-
AbstractNotifyWorkspacesCommentMentionsObserver
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractNotifyMentionsObserver<T extends CommentableAmetysObject>
- 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<T extends CommentableAmetysObject>
- 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.
-
_getLanguage
Get the language of the project containing the given object- Parameters:
project
- the project- Returns:
- the language code
-
_getAmetysObjectFromArguments
Get the Ametys object from the event arguments- Parameters:
arguments
- the event arguments- Returns:
- the Ametys object
-
getStandardMailBodyHelper
Description copied from class:AbstractNotifyMentionsObserver
Get a standard mail body helper- Overrides:
getStandardMailBodyHelper
in classAbstractNotifyMentionsObserver<T extends CommentableAmetysObject>
- Returns:
- the standard mail body helper
-
_getMailSubject
protected I18nizableText _getMailSubject(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Description copied from class:AbstractNotifyMentionsObserver
Retrieves the notification mail's subject- Overrides:
_getMailSubject
in classAbstractCommentNotifyMentionsObserver<T extends CommentableAmetysObject>
- Parameters:
mentionableObject
- the mentionable object- Returns:
- the notification mail's subject
-
_getMailTitle
protected I18nizableText _getMailTitle(AbstractNotifyMentionsObserver.MentionableObject mentionableObject) Description copied from class:AbstractNotifyMentionsObserver
Get the title of the mail body- Specified by:
_getMailTitle
in classAbstractNotifyMentionsObserver<T extends CommentableAmetysObject>
- Parameters:
mentionableObject
- the mentionable object- Returns:
- the mail title
-
_canSendMailToMentionedUser
protected boolean _canSendMailToMentionedUser(T 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<T extends CommentableAmetysObject>
- Parameters:
ametysObject
- the ametys objectauthorIdentity
- the authormentionedUserIdentity
- the mentioned user- Returns:
true
if we can send a mail to the mentioned user
-
_getModuleId
Get the module id to check read access- Returns:
- the module id
-
_getAbsoluteUrl
Get the absolute URL of the given Ametys object in the context of the given project- Parameters:
ametysObject
- the Ametys objectproject
- the project containing the Ametys object- Returns:
- the absolute URL
-
getUrl
Get the URL of the given Ametys object in the context of the given project- Parameters:
ametysObject
- the Ametys objectproject
- the project containing the Ametys object- Returns:
- the URL (may be relative or absolute depending on the implementation)
-