Class ProgramContentGenerator
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.apache.cocoon.xml.AbstractXMLProducer
-
- org.apache.cocoon.generation.AbstractGenerator
-
- org.apache.cocoon.generation.ServiceableGenerator
-
- org.ametys.cms.content.ContentGenerator
-
- org.ametys.odf.program.generators.ODFContentGenerator
-
- org.ametys.odf.program.generators.ProgramContentGenerator
-
- All Implemented Interfaces:
Poolable
,Recyclable
,Disposable
,Initializable
,Component
,LogEnabled
,Serviceable
,Generator
,SitemapModelComponent
,XMLProducer
- Direct Known Subclasses:
CourseContentGenerator
,OrgUnitContentGenerator
,ProgramPdfContentGenerator
public class ProgramContentGenerator extends ODFContentGenerator implements Initializable
-
-
Field Summary
Fields Modifier and Type Field Description protected ODFHelper
_odfHelper
The ODF helperprotected SourceResolver
_srcResolver
The source resolver-
Fields inherited from class org.ametys.odf.program.generators.ODFContentGenerator
_resolver
-
Fields inherited from class org.ametys.cms.content.ContentGenerator
_contentSaxer, _contentTypeExtensionPoint, _cTypesHelper, _DC_DATE_FORMAT
-
Fields inherited from class org.apache.cocoon.generation.ServiceableGenerator
manager
-
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, resolver, source
-
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
-
-
Constructor Summary
Constructors Constructor Description ProgramContentGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_addAttrIfNotEmpty(AttributesImpl attrs, String attrName, String attrValue)
Add an attribute if its not null or empty.protected void
_saxOtherData(Content content, Locale defaultLocale)
SAX any other data needed by the view.protected Set<String>
getLinkedContents(Content content, String linkedContentType)
Get the linked contents of the defined content type.void
initialize()
void
recycle()
protected void
saxChildProgramPart(AbstractProgram program, Locale defaultLocale)
SAX the referencedProgramPart
sprotected void
saxContainer(Container container, String parentPath, Locale defaultLocale)
SAX a containerprotected void
saxContent(Content content, ContentHandler handler, String viewName)
SAX the HTML content of aContent
protected void
saxContent(Content content, ContentHandler handler, String viewName, String format, boolean withContentRoot, boolean ignoreChildren)
SAX aContent
to given formatprotected void
saxCourse(Course course, String parentPath, Locale defaultLocale)
SAX a courseprotected void
saxCourseList(CourseList courseList, String parentPath, Locale defaultLocale)
SAX a course listprotected void
saxCoursePart(CoursePart coursePart, Locale defaultLocale)
SAX a course partprotected void
saxLinkedContents(Content content, String tagName, String linkedContentType, String viewName)
SAX the referenced content types.protected void
saxOrgUnits(Content content)
SAX the referencedOrgUnit
sprotected void
saxPersons(Content content)
SAX the referencedPerson
sprotected void
saxSubProgram(SubProgram subProgram, String parentPath)
SAX a sub programprotected void
saxTranslation(Content content)
SAX the existing translationvoid
service(ServiceManager serviceManager)
void
setup(SourceResolver res, Map objModel, String src, Parameters par)
-
Methods inherited from class org.ametys.odf.program.generators.ODFContentGenerator
saxTranslations
-
Methods inherited from class org.ametys.cms.content.ContentGenerator
_generateContent, _getView, _saxAttributesComments, _saxContent, _saxOtherData, generate, getDefaultLocale
-
Methods inherited from class org.apache.cocoon.generation.ServiceableGenerator
dispose
-
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
-
-
-
-
Field Detail
-
_srcResolver
protected SourceResolver _srcResolver
The source resolver
-
_odfHelper
protected ODFHelper _odfHelper
The ODF helper
-
-
Constructor Detail
-
ProgramContentGenerator
public ProgramContentGenerator()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classODFContentGenerator
- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
setup
public void setup(SourceResolver res, Map objModel, String src, Parameters par) throws ProcessingException, SAXException, IOException
- Specified by:
setup
in interfaceSitemapModelComponent
- Overrides:
setup
in classAbstractGenerator
- Throws:
ProcessingException
SAXException
IOException
-
recycle
public void recycle()
- Specified by:
recycle
in interfaceRecyclable
- Overrides:
recycle
in classAbstractGenerator
-
_saxOtherData
protected void _saxOtherData(Content content, Locale defaultLocale) throws SAXException, ProcessingException, IOException
Description copied from class:ContentGenerator
SAX any other data needed by the view.Default implementation does nothing.
- Overrides:
_saxOtherData
in classContentGenerator
- Parameters:
content
- the content.defaultLocale
- The default locale- Throws:
SAXException
- if an error occurs while SAXing.ProcessingException
- if an error occurs.IOException
- if an error occurs.
-
saxPersons
protected void saxPersons(Content content) throws SAXException
SAX the referencedPerson
s- Parameters:
content
- The content to analyze- Throws:
SAXException
- if an error occurs while saxing
-
saxOrgUnits
protected void saxOrgUnits(Content content) throws SAXException
SAX the referencedOrgUnit
s- Parameters:
content
- The content to analyze- Throws:
SAXException
- if an error occurs while saxing
-
saxChildProgramPart
protected void saxChildProgramPart(AbstractProgram program, Locale defaultLocale) throws SAXException, ProcessingException, IOException
SAX the referencedProgramPart
s- Parameters:
program
- The program or subprogramdefaultLocale
- The default locale- Throws:
SAXException
- if an error occurs while saxingIOException
- if an error occursProcessingException
- if an error occurs
-
saxTranslation
protected void saxTranslation(Content content) throws SAXException
SAX the existing translation- Parameters:
content
- The content- Throws:
SAXException
- if an error occurs while saxing
-
saxLinkedContents
protected void saxLinkedContents(Content content, String tagName, String linkedContentType, String viewName) throws SAXException
SAX the referenced content types.- Parameters:
content
- The content to analyzetagName
- The root tagNamelinkedContentType
- The content type to searchviewName
- The view to parse the found contents- Throws:
SAXException
- if an error occurs while saxing
-
getLinkedContents
protected Set<String> getLinkedContents(Content content, String linkedContentType)
Get the linked contents of the defined content type.- Parameters:
content
- The content to analyzelinkedContentType
- The content type to search- Returns:
- A
Set
of content ids
-
saxContainer
protected void saxContainer(Container container, String parentPath, Locale defaultLocale) throws SAXException, ProcessingException, IOException
SAX a container- Parameters:
container
- the container to SAXparentPath
- the parent pathdefaultLocale
- The default locale- Throws:
SAXException
- if an error occursIOException
- if an error occursProcessingException
- if an error occurs
-
saxSubProgram
protected void saxSubProgram(SubProgram subProgram, String parentPath) throws SAXException
SAX a sub program- Parameters:
subProgram
- the sub program to SAXparentPath
- the parent path- Throws:
SAXException
- if an error occurs
-
saxCourseList
protected void saxCourseList(CourseList courseList, String parentPath, Locale defaultLocale) throws SAXException, ProcessingException
SAX a course list- Parameters:
courseList
- The course list to SAXparentPath
- the parent pathdefaultLocale
- The default locale- Throws:
SAXException
- if an error occursProcessingException
- if an error occurs
-
saxCourse
protected void saxCourse(Course course, String parentPath, Locale defaultLocale) throws SAXException, ProcessingException
SAX a course- Parameters:
course
- the course to SAXparentPath
- the parent pathdefaultLocale
- The default locale- Throws:
SAXException
- if an error occursProcessingException
- if an error occurs
-
saxContent
protected void saxContent(Content content, ContentHandler handler, String viewName) throws SAXException, IOException
SAX the HTML content of aContent
- Parameters:
content
- the contenthandler
- theContentHandler
to send SAX events to.viewName
- the view name- Throws:
SAXException
- If an error occurred saxing the contentIOException
- If an error occurred resolving the content
-
saxContent
protected void saxContent(Content content, ContentHandler handler, String viewName, String format, boolean withContentRoot, boolean ignoreChildren) throws SAXException, IOException
SAX aContent
to given format- Parameters:
content
- the contenthandler
- theContentHandler
to send SAX events to.viewName
- the view nameformat
- the output formatwithContentRoot
- true to wrap content stream into a root content tagignoreChildren
- true to not SAX sub contents- Throws:
SAXException
- If an error occurred saxing the contentIOException
- If an error occurred resolving the content
-
_addAttrIfNotEmpty
protected void _addAttrIfNotEmpty(AttributesImpl attrs, String attrName, String attrValue)
Add an attribute if its not null or empty.- Parameters:
attrs
- The attributesattrName
- The attribute nameattrValue
- The attribute value
-
saxCoursePart
protected void saxCoursePart(CoursePart coursePart, Locale defaultLocale) throws SAXException, ProcessingException
SAX a course part- Parameters:
coursePart
- The course part to SAXdefaultLocale
- The default locale- Throws:
SAXException
- if an error occursProcessingException
- if an error occurs
-
-