Class AbstractUGCContentObserver
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.plugins.ugc.observation.AbstractUGCContentObserver
- All Implemented Interfaces:
Observer
,Prioritizable
,Supporter<Event>
,Configurable
,LogEnabled
,Serviceable
- Direct Known Subclasses:
UGCContentRefusedObserver
,UGCContentValidatedObserver
public abstract class AbstractUGCContentObserver
extends AbstractLogEnabled
implements Observer, Serviceable, Configurable
Abstract observer to send mail to UGC author on UGC content event
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
The i18n key for mail bodyprotected ContentTypesHelper
The content type helperprotected I18nUtils
The i18n utilsprotected String
The i18n key for mail subjectprotected UserManager
The user managerFields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(Configuration configuration) protected Map
<String, I18nizableTextParameter> getBodyI18nParams
(Content ugcContent, String comment) Get the i18n parameters for mail bodyprotected String
getMailBody
(Content ugcContent, String comment, String language) Get the mail bodyprotected String
getMailLanguage
(Content ugcContent) Get the mail languageprotected String
getMailSubject
(Content ugcContent, String language) Get the mail subjectint
Get the priority for the component.protected Map
<String, I18nizableTextParameter> getSubjectI18nParams
(Content ugcContent) Get the i18n parameters for mail subjectprotected void
sendMailToUGCAuthor
(Content ugcContent, String comment) Send mail to the UGC authorvoid
service
(ServiceManager smanager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
_cTypeHelper
The content type helper -
_i18nUtils
The i18n utils -
_userManager
The user manager -
_subjectI18nKey
The i18n key for mail subject -
_bodyI18nKey
The i18n key for mail body
-
-
Constructor Details
-
AbstractUGCContentObserver
public AbstractUGCContentObserver()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
configure
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
getPriority
Description copied from interface:Prioritizable
Get the priority for the component. On components usingPrioritizable
interface, each implementation define the order. In most cases, less is the number, more prior is the component.- Specified by:
getPriority
in interfacePrioritizable
- Returns:
- the priority
-
sendMailToUGCAuthor
Send mail to the UGC author- Parameters:
ugcContent
- The UGC contentcomment
- The comment. Can be null.
-
getMailLanguage
Get the mail language- Parameters:
ugcContent
- The UGC content- Returns:
- the language to use in the mail or null if none was found
-
getMailSubject
Get the mail subject- Parameters:
ugcContent
- The UGC contentlanguage
- The language to use- Returns:
- the mail text subject
-
getMailBody
Get the mail body- Parameters:
ugcContent
- The UGC contentcomment
- The comment. Can be null.language
- The language to use- Returns:
- the mail text body
-
getSubjectI18nParams
Get the i18n parameters for mail subject- Parameters:
ugcContent
- The UGC content- Returns:
- the i18n parameters for mail subject
-
getBodyI18nParams
Get the i18n parameters for mail body- Parameters:
ugcContent
- The UGC contentcomment
- The comment. Can be null.- Returns:
- the i18n parameters for mail body
-