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_odfHelperThe ODF helperprotected SourceResolver_srcResolverThe 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.voidinitialize()voidrecycle()protected voidsaxChildProgramPart(AbstractProgram program, Locale defaultLocale)SAX the referencedProgramPartsprotected voidsaxContainer(Container container, String parentPath, Locale defaultLocale)SAX a containerprotected voidsaxContent(Content content, ContentHandler handler, String viewName)SAX the HTML content of aContentprotected voidsaxContent(Content content, ContentHandler handler, String viewName, String format, boolean withContentRoot, boolean ignoreChildren)SAX aContentto given formatprotected voidsaxCourse(Course course, String parentPath, Locale defaultLocale)SAX a courseprotected voidsaxCourseList(CourseList courseList, String parentPath, Locale defaultLocale)SAX a course listprotected voidsaxCoursePart(CoursePart coursePart, Locale defaultLocale)SAX a course partprotected voidsaxLinkedContents(Content content, String tagName, String linkedContentType, String viewName)SAX the referenced content types.protected voidsaxOrgUnits(Content content)SAX the referencedOrgUnitsprotected voidsaxPersons(Content content)SAX the referencedPersonsprotected voidsaxSubProgram(SubProgram subProgram, String parentPath)SAX a sub programprotected voidsaxTranslation(Content content)SAX the existing translationvoidservice(ServiceManager serviceManager)voidsetup(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:
servicein interfaceServiceable- Overrides:
servicein classODFContentGenerator- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
- Specified by:
initializein interfaceInitializable- Throws:
Exception
-
setup
public void setup(SourceResolver res, Map objModel, String src, Parameters par) throws ProcessingException, SAXException, IOException
- Specified by:
setupin interfaceSitemapModelComponent- Overrides:
setupin classAbstractGenerator- Throws:
ProcessingExceptionSAXExceptionIOException
-
recycle
public void recycle()
- Specified by:
recyclein interfaceRecyclable- Overrides:
recyclein classAbstractGenerator
-
_saxOtherData
protected void _saxOtherData(Content content, Locale defaultLocale) throws SAXException, ProcessingException, IOException
Description copied from class:ContentGeneratorSAX any other data needed by the view.Default implementation does nothing.
- Overrides:
_saxOtherDatain 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 referencedPersons- Parameters:
content- The content to analyze- Throws:
SAXException- if an error occurs while saxing
-
saxOrgUnits
protected void saxOrgUnits(Content content) throws SAXException
SAX the referencedOrgUnits- 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 referencedProgramParts- 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
Setof 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- theContentHandlerto 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 aContentto given format- Parameters:
content- the contenthandler- theContentHandlerto 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
-
-