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 StringThe i18n key for mail bodyprotected ContentTypesHelperThe content type helperprotected I18nUtilsThe i18n utilsprotected StringThe i18n key for mail subjectprotected UserLanguagesManagerThe user languages managerprotected UserManagerThe user managerFields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(Configuration configuration) protected Map<String, I18nizableTextParameter> getBodyI18nParams(Content ugcContent, String comment) Get the i18n parameters for mail bodyprotected StringgetMailBody(Content ugcContent, String comment, String language) Get the mail bodyprotected StringgetMailLanguage(Content ugcContent) Get the mail languageprotected StringgetMailSubject(Content ugcContent, String language) Get the mail subjectintGet the priority for the component.protected Map<String, I18nizableTextParameter> getSubjectI18nParams(Content ugcContent) Get the i18n parameters for mail subjectprotected voidsendMailToUGCAuthor(Content ugcContent, String comment) Send mail to the UGC authorvoidservice(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 -
_userLanguagesManager
The user languages 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:
servicein interfaceServiceable- Throws:
ServiceException
-
configure
- Specified by:
configurein interfaceConfigurable- Throws:
ConfigurationException
-
getPriority
Description copied from interface:PrioritizableGet the priority for the component. On components usingPrioritizableinterface, each implementation define the order. In most cases, less is the number, more prior is the component.- Specified by:
getPriorityin 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
-