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
Abstract
Observer for observing events on a Program or Course.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ContextCocoon context.protected ContextThe context.protected ODFHelperThe ODF helperprotected AmetysObjectResolverAmetys object resolver.Fields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Content_getContentArgument(Event event) Retrieve the target of the observerprotected Course_getCourse(Event event) Get the target courseprotected AmetysObjectIterable<Page>Get the ODF root pages_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 StringThe workspace to use.voidcontextualize(Context context) voidObserves an event.voidservice(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLoggerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ametys.core.observation.Observer
getPriority, supports
-
Field Details
-
_context
The context. -
_cocoonContext
Cocoon context. -
_resolver
Ametys object resolver. -
_odfHelper
The ODF helper
-
-
Constructor Details
-
AbstractODFObserver
public AbstractODFObserver()
-
-
Method Details
-
contextualize
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
_workspaceToUse
The workspace to use. Default todefault, override this method to work on a different workspace- Returns:
- The workspace to use
-
observe
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 ExceptionDo 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
Get the ODF root pages- Returns:
- the ODF root pages
-
_getContentArgument
Retrieve the target of the observer- Parameters:
event- The event- Returns:
- The target
- Throws:
Exception- if failed to get content
-
_getSubProgram
Get the target abstract program- Parameters:
event- the event- Returns:
- the target abstract program or
null - Throws:
Exception- if failed to get content
-
_getCourse
Get the target course- Parameters:
event- the event- Returns:
- the target course or
null - Throws:
Exception- if failed to get content
-
_getPrograms
Get the target programs- Parameters:
event- the event- Returns:
- the target programs in a List
- Throws:
Exception- if failed to get content
-