Package org.ametys.cms.content
Class MetadataSetDefGenerator
- 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.MetadataSetDefGenerator
-
- All Implemented Interfaces:
Poolable
,Recyclable
,Disposable
,Component
,LogEnabled
,Serviceable
,Generator
,SitemapModelComponent
,XMLProducer
- Direct Known Subclasses:
MetadataSetDefByContentTypeGenerator
public class MetadataSetDefGenerator extends ServiceableGenerator
Generator
for rendering the structure of a metadata set
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentHelper
_contentHelper
The content helperprotected ContentTypeExtensionPoint
_contentTypeExtensionPoint
Content type extension point.protected ContentTypesHelper
_contentTypesHelper
Helper for content typesprotected CurrentUserProvider
_currentUserProvider
The current user providerprotected MetadataManager
_metadataManager
Metadata manager.protected RightManager
_rightManager
Rights manager-
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 MetadataSetDefGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MetadataDefinition
_getMetadataDefinition(String[] contentTypes, String[] mixinTypes, MetadataDefinition parentMetadataDefinition, String metadataName)
Retrieves a sub metadata definition from a content type or a parent metadata definition.private void
_saxAnnotableDefinition(Content content, AbstractMetadataSetElement metadataSetElement, RichTextMetadataDefinition metaDef)
SAX the annotations of a definitionprivate void
_saxCompositeDefinition(Content content, AbstractMetadataSetElement metadataSetElement, MetadataDefinition metaDef)
Sax a composite definitionprivate void
_saxEnumeration(Enumerator enumerator)
protected void
_saxMetadataDefinition(Content content, AbstractMetadataSetElement metadataSetElement, MetadataDefinition metaDef)
Sax the metadata definitionprotected void
_saxMetadataSet(Content content, String metadataSetName, String fallbackMetadataSetName, boolean isEditionMetadataSet)
SAX metadata set structureprotected void
_saxMetadataSetElement(Content content, String[] contentTypes, String[] mixinTypes, MetadataDefinition metadataDefinition, AbstractMetadataSetElement metadataSetElement)
SAX metadata set element.void
generate()
void
service(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
-
_contentTypeExtensionPoint
protected ContentTypeExtensionPoint _contentTypeExtensionPoint
Content type extension point.
-
_metadataManager
protected MetadataManager _metadataManager
Metadata manager.
-
_contentTypesHelper
protected ContentTypesHelper _contentTypesHelper
Helper for content types
-
_rightManager
protected RightManager _rightManager
Rights manager
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
_contentHelper
protected ContentHelper _contentHelper
The content helper
-
-
Constructor Detail
-
MetadataSetDefGenerator
public MetadataSetDefGenerator()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableGenerator
- Throws:
ServiceException
-
generate
public void generate() throws IOException, SAXException, ProcessingException
-
_saxMetadataSet
protected void _saxMetadataSet(Content content, String metadataSetName, String fallbackMetadataSetName, boolean isEditionMetadataSet) throws SAXException, ProcessingException, IOException
SAX metadata set structure- Parameters:
content
- the content.metadataSetName
- The name of the metadata set to saxfallbackMetadataSetName
- The fallback metadata set to use if the initial was not found.isEditionMetadataSet
- True to use the edit metadata set- Throws:
SAXException
- if an error occurs while SAXing.IOException
- if an error occurs.ProcessingException
- if an error occurs.
-
_saxMetadataSetElement
protected void _saxMetadataSetElement(Content content, String[] contentTypes, String[] mixinTypes, MetadataDefinition metadataDefinition, AbstractMetadataSetElement metadataSetElement) throws SAXException
SAX metadata set element.- Parameters:
content
- the content. Can be null then set content types and mixinscontentTypes
- Can be null then set contentmixinTypes
- Can be null then set contentmetadataDefinition
- the metadata definition.metadataSetElement
- the metadata set element.- Throws:
SAXException
- if an error occurs while SAXing.
-
_getMetadataDefinition
protected MetadataDefinition _getMetadataDefinition(String[] contentTypes, String[] mixinTypes, MetadataDefinition parentMetadataDefinition, String metadataName)
Retrieves a sub metadata definition from a content type or a parent metadata definition.- Parameters:
contentTypes
- the content typesmixinTypes
- the mixin typesparentMetadataDefinition
- the parent metadata definition.metadataName
- the metadata name.- Returns:
- the metadata definition found or
null
otherwise.
-
_saxMetadataDefinition
protected void _saxMetadataDefinition(Content content, AbstractMetadataSetElement metadataSetElement, MetadataDefinition metaDef) throws SAXException
Sax the metadata definition- Parameters:
content
- The contentmetadataSetElement
- The metadata set elementmetaDef
- The metadata definition- Throws:
SAXException
- if an error occurs while SAXing.
-
_saxEnumeration
private void _saxEnumeration(Enumerator enumerator) throws SAXException
- Throws:
SAXException
-
_saxAnnotableDefinition
private void _saxAnnotableDefinition(Content content, AbstractMetadataSetElement metadataSetElement, RichTextMetadataDefinition metaDef) throws SAXException
SAX the annotations of a definition- Parameters:
content
- the content.metadataSetElement
- the metadata set element.metaDef
- the metadata definition.- Throws:
SAXException
- if an error occurs while SAXing.
-
_saxCompositeDefinition
private void _saxCompositeDefinition(Content content, AbstractMetadataSetElement metadataSetElement, MetadataDefinition metaDef) throws SAXException
Sax a composite definition- Parameters:
content
- the content.metadataSetElement
- the metadata set element.metaDef
- the metadata definition.- Throws:
SAXException
- if an error occurs while SAXing.
-
-