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
Modifier and TypeFieldDescriptionprotected String
The i18n key for mail bodyprotected ContentTypesHelper
The content type helperprotected I18nUtils
The i18n utilsprotected String
The i18n key for mail subjectFields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY
-
Constructor Summary
-
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) Get the mail bodyprotected String
getMailSubject
(Content ugcContent) Get the mail subjectint
getPriority
(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 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 -
_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:Observer
Retrieves the priority to observe this event.
This can be used to process a supported event before others observers.- Specified by:
getPriority
in 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
-