Class AbstractContentObserver
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.ugc.observation.AbstractContentObserver
-
- All Implemented Interfaces:
Observer
,LogEnabled
,Contextualizable
,Serviceable
- Direct Known Subclasses:
AbstractSolrContentObserver
,InvalidateCacheOnContentValidationObserver
,InvalidateZoneItemCacheOnContentModificationObserver
,InvalidateZoneItemCacheOnContentValidationObserver
public abstract class AbstractContentObserver extends AbstractLogEnabled implements Observer, Serviceable, Contextualizable
AbstractObserver
for observing validation of UGC content.
-
-
Field Summary
Fields Modifier and Type Field Description protected Context
_cocoonContext
Cocoon context.protected ContentTypesHelper
_contentTypeHelper
The content type helperprotected Context
_context
The context.protected AmetysObjectResolver
_resolver
Ametys object resolver.protected UGCPageHandler
_ugcPageHandler
The UGC page handlerprotected PageElementCache
_zoneItemCache
The page element cache-
Fields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description AbstractContentObserver()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Content
_getTarget(Event event)
Retrieve the target of the observerprotected AmetysObjectIterable<Page>
_getUGCRootPages()
Get the UGC root pagesprotected abstract void
_internalObserve(Event event, Page rootPage, Content content)
Do the actual work.protected boolean
_isUGCContent(Content content, Page rootPage)
Return true if the content is a UGC contentprotected void
_removeZoneItemCache(Page rootPage, Content content, String workspace)
Remove zone item cachevoid
contextualize(Context context)
void
observe(Event event, Map<String,Object> transientVars)
Observes an event.void
service(ServiceManager manager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.core.observation.Observer
getPriority, supports
-
-
-
-
Field Detail
-
_cocoonContext
protected Context _cocoonContext
Cocoon context.
-
_resolver
protected AmetysObjectResolver _resolver
Ametys object resolver.
-
_contentTypeHelper
protected ContentTypesHelper _contentTypeHelper
The content type helper
-
_zoneItemCache
protected PageElementCache _zoneItemCache
The page element cache
-
_ugcPageHandler
protected UGCPageHandler _ugcPageHandler
The UGC page handler
-
-
Constructor Detail
-
AbstractContentObserver
public AbstractContentObserver()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
observe
public void observe(Event event, Map<String,Object> transientVars)
Description copied from interface:Observer
Observes an event.
-
_internalObserve
protected abstract void _internalObserve(Event event, Page rootPage, Content content)
Do the actual work.- Parameters:
event
- the observation event.rootPage
- the page holding the UGC content pagescontent
- the UGC content.
-
_getUGCRootPages
protected AmetysObjectIterable<Page> _getUGCRootPages()
Get the UGC root pages- Returns:
- the UGC root pages
-
_getTarget
protected Content _getTarget(Event event) throws Exception
Retrieve the target of the observer- Parameters:
event
- The event- Returns:
- The target
- Throws:
Exception
- if failed to get content
-
_isUGCContent
protected boolean _isUGCContent(Content content, Page rootPage)
Return true if the content is a UGC content- Parameters:
content
- the contentrootPage
- the root page- Returns:
- true if the content is a UGC content
-
_removeZoneItemCache
protected void _removeZoneItemCache(Page rootPage, Content content, String workspace)
Remove zone item cache- Parameters:
rootPage
- the root pagecontent
- the contentworkspace
- the workspace
-
-