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
,Component
,LogEnabled
,Serviceable
,Generator
,SitemapModelComponent
,XMLProducer
- Direct Known Subclasses:
CourseContentGenerator
,OrgUnitContentGenerator
,ProgramPdfContentGenerator
public class ProgramContentGenerator extends ODFContentGenerator
-
-
Field Summary
Fields Modifier and Type Field Description protected 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
_contentHelper, _contentTypeExtensionPoint, _cTypesHelper, _DC_DATE_FORMAT, _languageManager, _metadataManager, _userHelper, _userProvider, _workflowProvider, _worklflowHelper
-
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.private Set<String>
_getContentIds(ModelAwareDataHolder dataHolder, ModelItemContainer modelItemContainer, String contentType)
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.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, String metadataSetName)
SAX the HTML content of aContent
protected void
saxContent(Content content, String metadataSetName, 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 metadataSet)
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)
-
Methods inherited from class org.ametys.odf.program.generators.ODFContentGenerator
saxTranslations
-
Methods inherited from class org.ametys.cms.content.ContentGenerator
_addAttributeIfNotNull, _generateContent, _getCurrentStep, _getMetadataSet, _saxComment, _saxComments, _saxContent, _saxContentComments, _saxContentReactions, _saxDublinCoreMetadata, _saxIfNotNull, _saxIfNotNull, _saxIfNotNull, _saxLanguage, _saxMetadata, _saxMetadataComments, _saxOtherData, _saxWorkflowStep, generate, getDefaultLocale
-
Methods inherited from class org.apache.cocoon.generation.ServiceableGenerator
dispose
-
Methods inherited from class org.apache.cocoon.generation.AbstractGenerator
recycle, setup
-
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
-
-
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
-
_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 metadataSet) throws SAXException
SAX the referenced content types.- Parameters:
content
- The content to analyzetagName
- The root tagNamelinkedContentType
- The content type to searchmetadataSet
- The metadata set 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
-
_getContentIds
private Set<String> _getContentIds(ModelAwareDataHolder dataHolder, ModelItemContainer modelItemContainer, String contentType)
-
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, IOException
SAX a course list- Parameters:
courseList
- The course list to SAXparentPath
- the parent pathdefaultLocale
- The default locale- Throws:
SAXException
- if an error occursIOException
- if an error occursProcessingException
- if an error occurs
-
saxCourse
protected void saxCourse(Course course, String parentPath, Locale defaultLocale) throws SAXException, ProcessingException, IOException
SAX a course- Parameters:
course
- the course to SAXparentPath
- the parent pathdefaultLocale
- The default locale- Throws:
SAXException
- if an error occursIOException
- if an error occursProcessingException
- if an error occurs
-
saxContent
protected void saxContent(Content content, String metadataSetName) throws SAXException, IOException
SAX the HTML content of aContent
- Parameters:
content
- the contentmetadataSetName
- the metadata set name- Throws:
SAXException
- If an error occurred saxing the contentIOException
- If an error occurred resolving the content
-
saxContent
protected void saxContent(Content content, String metadataSetName, String format, boolean withContentRoot, boolean ignoreChildren) throws SAXException, IOException
SAX aContent
to given format- Parameters:
content
- the contentmetadataSetName
- the metadata set 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, IOException
SAX a course part- Parameters:
coursePart
- The course part to SAXdefaultLocale
- The default locale- Throws:
SAXException
- if an error occursIOException
- if an error occursProcessingException
- if an error occurs
-
-