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
Modifier and TypeFieldDescriptionprotected Context
Cocoon context.protected Context
The context.protected ODFHelper
The ODF helperprotected AmetysObjectResolver
Ametys object resolver.Fields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY
-
Constructor Summary
-
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 String
The workspace to use.void
contextualize
(Context context) void
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 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:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
- Specified by:
service
in 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:Observer
Observes an event.- Specified by:
observe
in 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
-