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
Fields Modifier and Type Field Description protected String
_bodyI18nKey
The i18n key for mail bodyprotected ContentTypesHelper
_cTypeHelper
The content type helperprotected I18nUtils
_i18nUtils
The i18n utilsprotected String
_subjectI18nKey
The i18n key for mail subject-
Fields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description AbstractUGCContentObserver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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 Detail
-
_cTypeHelper
protected ContentTypesHelper _cTypeHelper
The content type helper
-
_i18nUtils
protected I18nUtils _i18nUtils
The i18n utils
-
_subjectI18nKey
protected String _subjectI18nKey
The i18n key for mail subject
-
_bodyI18nKey
protected String _bodyI18nKey
The i18n key for mail body
-
-
Constructor Detail
-
AbstractUGCContentObserver
public AbstractUGCContentObserver()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
getPriority
public int getPriority(Event event)
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
protected void sendMailToUGCAuthor(Content ugcContent, String comment)
Send mail to the UGC author- Parameters:
ugcContent
- The UGC contentcomment
- The comment. Can be null.
-
getMailSubject
protected String getMailSubject(Content ugcContent)
Get the mail subject- Parameters:
ugcContent
- The UGC content- Returns:
- the mail text subject
-
getMailBody
protected String getMailBody(Content ugcContent, String comment)
Get the mail body- Parameters:
ugcContent
- The UGC contentcomment
- The comment. Can be null.- Returns:
- the mail text body
-
getSubjectI18nParams
protected Map<String,I18nizableTextParameter> getSubjectI18nParams(Content ugcContent)
Get the i18n parameters for mail subject- Parameters:
ugcContent
- The UGC content- Returns:
- the i18n parameters for mail subject
-
getBodyI18nParams
protected Map<String,I18nizableTextParameter> getBodyI18nParams(Content ugcContent, String comment)
Get the i18n parameters for mail body- Parameters:
ugcContent
- The UGC contentcomment
- The comment. Can be null.- Returns:
- the i18n parameters for mail body
-
-