public abstract class AbstractODFObserver extends AbstractLogEnabled implements Observer, Serviceable, Contextualizable
Observer for observing events on a Program or Course.| Modifier and Type | Field and Description |
|---|---|
protected Context |
_cocoonContext
Cocoon context.
|
protected Context |
_context
The context.
|
protected ODFHelper |
_odfHelper
The ODF helper
|
protected AmetysObjectResolver |
_resolver
Ametys object resolver.
|
MAX_PRIORITY, MIN_PRIORITY| Constructor and Description |
|---|
AbstractODFObserver() |
| Modifier and Type | Method and Description |
|---|---|
protected Content |
_getContentArgument(Event event)
Retrieve the target of the observer
|
protected Course |
_getCourse(Event event)
Get the target course
|
protected AmetysObjectIterable<Page> |
_getODFRootPages()
Get the ODF root pages
|
protected Set<Program> |
_getPrograms(Event event)
Get the target programs
|
protected SubProgram |
_getSubProgram(Event event)
Get the target abstract program
|
protected 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.
|
void |
contextualize(Context context) |
void |
observe(Event event,
Map<String,Object> transientVars)
Observes an event.
|
void |
service(ServiceManager manager) |
getLogger, setLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetPriority, supportsprotected Context _cocoonContext
protected AmetysObjectResolver _resolver
protected ODFHelper _odfHelper
public AbstractODFObserver()
public void contextualize(Context context) throws ContextException
contextualize in interface ContextualizableContextExceptionpublic void service(ServiceManager manager) throws ServiceException
service in interface ServiceableServiceExceptionprotected String _workspaceToUse()
default,
override this method to work on a different workspacepublic void observe(Event event, Map<String,Object> transientVars) throws Exception
Observerobserve in interface Observerevent - the event.transientVars - transientVars passed from one Observer to another when processing a single Event.
This may allow optimizations between observers.Exception - if an error occurs.
All exceptions will be logged but not propagated, as the observation mechanism should never fail.protected abstract void _internalObserve(Event event, Map<String,Object> transientVars, Page odfRootPage, Set<Program> rootPrograms, SubProgram subProgram, Course course) throws Exception
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.Exception - if an error occuredprotected AmetysObjectIterable<Page> _getODFRootPages()
protected Content _getContentArgument(Event event) throws Exception
event - The eventException - if failed to get contentprotected SubProgram _getSubProgram(Event event) throws Exception
event - the eventnullException - if failed to get contentprotected Course _getCourse(Event event) throws Exception
event - the eventnullException - if failed to get content