Class AbstractODFObserver
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.odfweb.observation.AbstractODFObserver
-
- All Implemented Interfaces:
Observer,LogEnabled,Contextualizable,Serviceable
- Direct Known Subclasses:
AbstractSolrODFObserver,InvalidateCacheOnContentValidationOrUnpublishingObserver
public abstract class AbstractODFObserver extends AbstractLogEnabled implements Observer, Serviceable, Contextualizable
AbstractObserverfor observing events on a Program or Course.
-
-
Field Summary
Fields Modifier and Type Field Description protected Context_cocoonContextCocoon context.protected Context_contextThe context.protected ODFHelper_odfHelperThe ODF helperprotected AmetysObjectResolver_resolverAmetys object resolver.-
Fields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description AbstractODFObserver()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Content_getContentArgument(Event event)Retrieve the target of the observerprotected Course_getCourse(Event event)Get the target courseprotected AmetysObjectIterable<Page>_getODFRootPages()Get the ODF root pagesprotected Set<Program>_getPrograms(Event event)Get the target programsprotected SubProgram_getSubProgram(Event event)Get the target abstract programprotected abstract void_internalObserve(Event event, Map<String,Object> transientVars, Page odfRootPage, Set<Program> rootPrograms, SubProgram subProgram, Course course)Do the actual work.protected String_workspaceToUse()The workspace to use.voidcontextualize(Context context)voidobserve(Event event, Map<String,Object> transientVars)Observes an event.voidservice(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.
-
_odfHelper
protected ODFHelper _odfHelper
The ODF helper
-
-
Constructor Detail
-
AbstractODFObserver
public AbstractODFObserver()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
_workspaceToUse
protected String _workspaceToUse()
The workspace to use. Default todefault, override this method to work on a different workspace- Returns:
- The workspace to use
-
observe
public void observe(Event event, Map<String,Object> transientVars) throws Exception
Description copied from interface:ObserverObserves an event.- Specified by:
observein interfaceObserver- Parameters:
event- the event.transientVars- transientVars passed from one Observer to another when processing a single Event. This may allow optimizations between observers.- Throws:
Exception- if an error occurs. All exceptions will be logged but not propagated, as the observation mechanism should never fail.
-
_internalObserve
protected abstract void _internalObserve(Event event, Map<String,Object> transientVars, Page odfRootPage, Set<Program> rootPrograms, SubProgram subProgram, Course course) throws Exception
Do the actual work.- Parameters:
event- the event.transientVars- transientVars passed from one Observer to another when processing a single Event. This may allow optimizations between observers.odfRootPage- the Page holding the virtual factory.rootPrograms- the root programs.subProgram- The subprogram. Can be nullcourse- The course. Can be null.- Throws:
Exception- if an error occured
-
_getODFRootPages
protected AmetysObjectIterable<Page> _getODFRootPages()
Get the ODF root pages- Returns:
- the ODF root pages
-
_getContentArgument
protected Content _getContentArgument(Event event) throws Exception
Retrieve the target of the observer- Parameters:
event- The event- Returns:
- The target
- Throws:
Exception- if failed to get content
-
_getSubProgram
protected SubProgram _getSubProgram(Event event) throws Exception
Get the target abstract program- Parameters:
event- the event- Returns:
- the target abstract program or
null - Throws:
Exception- if failed to get content
-
_getCourse
protected Course _getCourse(Event event) throws Exception
Get the target course- Parameters:
event- the event- Returns:
- the target course or
null - Throws:
Exception- if failed to get content
-
-