Class AbstractUGCContentObserver
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.plugins.ugc.observation.AbstractUGCContentObserver
- All Implemented Interfaces:
Observer,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 subjectFields 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) Get the mail bodyprotected StringgetMailSubject(Content ugcContent) Get the mail subjectintgetPriority(Event event) Retrieves the priority to observe this event.
This can be used to process a supported event before others observers.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 -
_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:ObserverRetrieves the priority to observe this event.
This can be used to process a supported event before others observers.- Specified by:
getPriorityin interfaceObserver- Parameters:
event- the event.- Returns:
- the priority where 0 the max priority and Integer.MAX_VALUE the min priority.
-
sendMailToUGCAuthor
Send mail to the UGC author- Parameters:
ugcContent- The UGC contentcomment- The comment. Can be null.
-
getMailSubject
Get the mail subject- Parameters:
ugcContent- The UGC content- Returns:
- the mail text subject
-
getMailBody
Get the mail body- Parameters:
ugcContent- The UGC contentcomment- The comment. Can be null.- 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
-