Package org.ametys.cms.content
Class ContentGenerator
-
- All Implemented Interfaces:
Poolable,Recyclable,Disposable,Component,LogEnabled,Serviceable,Generator,SitemapModelComponent,XMLProducer
- Direct Known Subclasses:
CommentsGenerator,ContentGenerator,ODFContentGenerator
public class ContentGenerator extends ServiceableGenerator
Generatorfor rendering raw content data.
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentHelper_contentHelperThe content helperprotected ContentTypeExtensionPoint_contentTypeExtensionPointContent type extension point.protected ContentTypesHelper_cTypesHelperHelper for content typesprotected static DateFormat_DC_DATE_FORMATThe display date format.protected LanguagesManager_languageManagerThe language managerprotected MetadataManager_metadataManagerMetadata manager.protected UserHelper_userHelperThe user helperprotected CurrentUserProvider_userProviderThe current user providerprotected WorkflowProvider_workflowProviderThe workflow providerprotected WorkflowHelper_worklflowHelperThe workflow helper-
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 ContentGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void_addAttributeIfNotNull(AttributesImpl attrs, String name, String value)Add attribute if value is not nullprotected void_generateContent()Generate the content (with the start/end document)protected com.opensymphony.workflow.spi.Step_getCurrentStep(WorkflowAwareContent content, WorkflowProvider.AmetysObjectWorkflow workflow)Get a content's step, wherever it works on the base version or not.protected MetadataSet_getMetadataSet(Content content)Retrieves the metadata set to be used when SAX'ing metadata and metadata comments.protected void_saxComment(Comment comment, int level)Sax the commentprotected void_saxComments(List<Comment> comments, String elementName, int level)Sax the commentsprotected void_saxContent(Content content, Locale defaultLocale)SAX the contentprotected void_saxContentComments(Content content)SAX the comments of the contentprotected void_saxContentReactions(Content content)SAX the comments of the contentprotected void_saxDublinCoreMetadata(DublinCoreAwareAmetysObject dcObject)SAX content Dublin Core metadata.protected void_saxIfNotNull(String name, String value)SAX string Dublin Core metadata.protected void_saxIfNotNull(String name, String[] values)SAX string Dublin Core metadata.protected void_saxIfNotNull(String name, Date value)SAX date Dublin Core metadata.protected void_saxLanguage(Content content)SAX the content languageprotected void_saxMetadata(Content content, MetadataSet metadataSet, Locale defaultLocale)SAX content metadata.protected void_saxMetadataComments(Content content, MetadataSet metadataSet, Locale defaultLocale)SAX metadata comments.protected void_saxOtherData(Content content)Deprecated.Use and/or override_saxOtherData(Content, Locale)insteadprotected void_saxOtherData(Content content, Locale defaultLocale)SAX any other data needed by the view.protected void_saxWorkflowStep(Content content)SAX the workflow step if the content is aWorkflowAwareContentvoidgenerate()protected LocalegetDefaultLocale(Request request)Get the default locale to use to sax localized valuesvoidservice(ServiceManager serviceManager)-
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
-
_DC_DATE_FORMAT
protected static final DateFormat _DC_DATE_FORMAT
The display date format.
-
_contentTypeExtensionPoint
protected ContentTypeExtensionPoint _contentTypeExtensionPoint
Content type extension point.
-
_metadataManager
protected MetadataManager _metadataManager
Metadata manager.
-
_languageManager
protected LanguagesManager _languageManager
The language manager
-
_workflowProvider
protected WorkflowProvider _workflowProvider
The workflow provider
-
_worklflowHelper
protected WorkflowHelper _worklflowHelper
The workflow helper
-
_cTypesHelper
protected ContentTypesHelper _cTypesHelper
Helper for content types
-
_contentHelper
protected ContentHelper _contentHelper
The content helper
-
_userProvider
protected CurrentUserProvider _userProvider
The current user provider
-
_userHelper
protected UserHelper _userHelper
The user helper
-
-
Constructor Detail
-
ContentGenerator
public ContentGenerator()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classServiceableGenerator- Throws:
ServiceException
-
generate
public void generate() throws IOException, SAXException, ProcessingException
-
_generateContent
protected void _generateContent() throws SAXException, IOException, ProcessingException
Generate the content (with the start/end document)- Throws:
SAXException- if an error occurs while SAXingIOException- if an error occursProcessingException- if an error occurs
-
getDefaultLocale
protected Locale getDefaultLocale(Request request)
Get the default locale to use to sax localized values- Parameters:
request- the request- Returns:
- the default locale
-
_saxContent
protected void _saxContent(Content content, Locale defaultLocale) throws SAXException, IOException, ProcessingException
SAX the content- Parameters:
content- The content to SAXdefaultLocale- The default locale to use to sax localized values if the content's language is null.- Throws:
SAXException- if an error occurs while SAXingIOException- if an error occursProcessingException- if an error occurs
-
_addAttributeIfNotNull
protected void _addAttributeIfNotNull(AttributesImpl attrs, String name, String value)
Add attribute if value is not null- Parameters:
attrs- The attributesname- The name of attributevalue- The value
-
_saxContentReactions
protected void _saxContentReactions(Content content) throws SAXException
SAX the comments of the content- Parameters:
content- The content to consider. Cannot be null.- Throws:
SAXException- if an error occurs while SAXing.
-
_saxContentComments
protected void _saxContentComments(Content content) throws SAXException
SAX the comments of the content- Parameters:
content- The content to consider. Cannot be null.- Throws:
SAXException- if an error occurs while SAXing.
-
_saxComments
protected void _saxComments(List<Comment> comments, String elementName, int level) throws SAXException
Sax the comments- Parameters:
comments- the list of comments to saxelementName- the name of the xml elementlevel- the level of comment (0 for parent comment, 1 for sub-comment, etc ....)- Throws:
SAXException- if an error occurs saxing
-
_saxComment
protected void _saxComment(Comment comment, int level) throws SAXException
Sax the comment- Parameters:
comment- the commentlevel- the level of comment (0 for parent comment, 1 for sub-comment, etc ....)- Throws:
SAXException- if an error occurs saxing
-
_saxLanguage
protected void _saxLanguage(Content content) throws SAXException
SAX the content language- Parameters:
content- The content- Throws:
SAXException- if an error occurs while SAXing.
-
_saxWorkflowStep
protected void _saxWorkflowStep(Content content) throws SAXException
SAX the workflow step if the content is aWorkflowAwareContent- Parameters:
content- The content- Throws:
SAXException- if an error occurs while SAXing.
-
_saxMetadata
protected void _saxMetadata(Content content, MetadataSet metadataSet, Locale defaultLocale) throws SAXException, ProcessingException, IOException
SAX content metadata.- Parameters:
content- the content.metadataSet- the metadata set.defaultLocale- The default locale to use to sax localized values if the content's language is null.- Throws:
SAXException- if an error occurs while SAXing.IOException- if an error occurs.ProcessingException- if an error occurs.
-
_saxMetadataComments
protected void _saxMetadataComments(Content content, MetadataSet metadataSet, Locale defaultLocale) throws SAXException, ProcessingException, IOException
SAX metadata comments.- Parameters:
content- the content.metadataSet- the metadata set.defaultLocale- The default locale to use to sax localized values if the content's language is null.- Throws:
SAXException- if an error occurs while SAXing.IOException- if an error occurs.ProcessingException- if an error occurs.
-
_saxDublinCoreMetadata
protected void _saxDublinCoreMetadata(DublinCoreAwareAmetysObject dcObject) throws SAXException
SAX content Dublin Core metadata.- Parameters:
dcObject- the Dublin Core object.- Throws:
SAXException- if an error occurs while SAXing.
-
_saxIfNotNull
protected void _saxIfNotNull(String name, String value) throws SAXException
SAX string Dublin Core metadata.- Parameters:
name- the metadata name.value- the metadata value.- Throws:
SAXException- if an error occurs while SAXing.
-
_saxIfNotNull
protected void _saxIfNotNull(String name, String[] values) throws SAXException
SAX string Dublin Core metadata.- Parameters:
name- the metadata name.values- the metadata values.- Throws:
SAXException- if an error occurs while SAXing.
-
_saxIfNotNull
protected void _saxIfNotNull(String name, Date value) throws SAXException
SAX date Dublin Core metadata.- Parameters:
name- the metadata name.value- the metadata value.- Throws:
SAXException- if an error occurs while SAXing.
-
_saxOtherData
@Deprecated protected void _saxOtherData(Content content) throws SAXException, ProcessingException
Deprecated.Use and/or override_saxOtherData(Content, Locale)insteadSAX any other data needed by the view.Default implementation does nothing.
- Parameters:
content- the content.- Throws:
SAXException- if an error occurs while SAXing.ProcessingException- if an error occurs.
-
_saxOtherData
protected void _saxOtherData(Content content, Locale defaultLocale) throws SAXException, ProcessingException, IOException
SAX any other data needed by the view.Default implementation does nothing.
- 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.
-
_getMetadataSet
protected MetadataSet _getMetadataSet(Content content) throws ProcessingException
Retrieves the metadata set to be used when SAX'ing metadata and metadata comments.- Parameters:
content- The content to consider. Cannot be null.- Returns:
- The retrieved metadata set
- Throws:
ProcessingException- If the metadata set could not be retrieved
-
_getCurrentStep
protected com.opensymphony.workflow.spi.Step _getCurrentStep(WorkflowAwareContent content, WorkflowProvider.AmetysObjectWorkflow workflow) throws com.opensymphony.workflow.WorkflowException
Get a content's step, wherever it works on the base version or not.- Parameters:
content- the content.workflow- The workflow impl to use- Returns:
- the content's workflow step.
- Throws:
com.opensymphony.workflow.WorkflowException- if an error occurs.
-
-