Class ContentTypesGraphGenerator
- 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.plugins.contenttypeseditor.ContentTypesGraphGenerator
-
- All Implemented Interfaces:
Poolable
,Recyclable
,Disposable
,Component
,LogEnabled
,Serviceable
,Generator
,SitemapModelComponent
,XMLProducer
public class ContentTypesGraphGenerator extends ServiceableGenerator
Content types export for generate a graph
-
-
Field Summary
Fields Modifier and Type Field Description private ContentTypeExtensionPoint
_contentTypeEP
private I18nUtils
_i18nUtils
static String
PARAMETER_CONTENTTYPE_ALL
The request parameter name for export all content typesstatic String
PARAMETER_CONTENTTYPE_IDS
The request parameter name for content idsstatic String
PARAMETER_CONTENTTYPE_ISHIERARCHICALVIEW
The request parameter name for tree view-
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 ContentTypesGraphGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
_addParents(Set<ContentType> parentsContentTypes)
private void
_associationsToSAX(ContentHandler handler, ContentType contentType, Set<String> contentTypesIds)
private void
_exportContentTypes(ContentHandler handler, Set<String> contentTypesIds, boolean saxAssociations, boolean saxParents)
Generates SAX events for content types exportprivate Attributes
_getContentAttributeDefinitionXMLAttributes(ContentAttributeDefinition definition)
private String
_getContentTypeName(I18nizableText labelContentType)
private Attributes
_getContentTypeXMLAttributes(ContentType contentType)
private String
_getIdForGraph(String text)
private Map<String,String>
_getLinkedContentTypes(ModelItem modelItem, Set<String> contentTypesIds)
private boolean
_isMandatoryMetadata(ElementDefinition definition)
private void
_modelItemsToSAX(ContentHandler handler, ContentType contentType)
private void
_modelItemToSAX(ContentHandler handler, ModelItem modelItem, ContentType contentType)
private void
_retrieveChildrenContentTypesIds(String contentTypeId, Set<String> childrenContentTypesIds)
Retrieve content types ids for all children of content type with contentTypeId idvoid
generate()
private String
getCardinality(ElementDefinition definition)
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
-
PARAMETER_CONTENTTYPE_IDS
public static final String PARAMETER_CONTENTTYPE_IDS
The request parameter name for content ids- See Also:
- Constant Field Values
-
PARAMETER_CONTENTTYPE_ISHIERARCHICALVIEW
public static final String PARAMETER_CONTENTTYPE_ISHIERARCHICALVIEW
The request parameter name for tree view- See Also:
- Constant Field Values
-
PARAMETER_CONTENTTYPE_ALL
public static final String PARAMETER_CONTENTTYPE_ALL
The request parameter name for export all content types- See Also:
- Constant Field Values
-
_contentTypeEP
private ContentTypeExtensionPoint _contentTypeEP
-
_i18nUtils
private I18nUtils _i18nUtils
-
-
Constructor Detail
-
ContentTypesGraphGenerator
public ContentTypesGraphGenerator()
-
-
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
-
_retrieveChildrenContentTypesIds
private void _retrieveChildrenContentTypesIds(String contentTypeId, Set<String> childrenContentTypesIds)
Retrieve content types ids for all children of content type with contentTypeId id- Parameters:
contentTypeId
- The content type id of content type that we want to retrieves all children content types idschildrenContentTypesIds
- All children content types ids retrieved
-
_exportContentTypes
private void _exportContentTypes(ContentHandler handler, Set<String> contentTypesIds, boolean saxAssociations, boolean saxParents) throws SAXException
Generates SAX events for content types export- Parameters:
handler
- theContentHandler
that will receive the SAX eventscontentTypesIds
- The identifiers of the content types to exportsaxAssociations
- Allow to create a link association when a content type contains an attribute of type contentsaxParents
- Allow to add all parents of content type even if the parent content type wasn't selected- Throws:
SAXException
- If an error occurs while generating SAX events
-
_getContentTypeXMLAttributes
private Attributes _getContentTypeXMLAttributes(ContentType contentType)
-
_modelItemsToSAX
private void _modelItemsToSAX(ContentHandler handler, ContentType contentType) throws SAXException
- Throws:
SAXException
-
_modelItemToSAX
private void _modelItemToSAX(ContentHandler handler, ModelItem modelItem, ContentType contentType) throws SAXException
- Throws:
SAXException
-
_getContentAttributeDefinitionXMLAttributes
private Attributes _getContentAttributeDefinitionXMLAttributes(ContentAttributeDefinition definition)
-
_addParents
private void _addParents(Set<ContentType> parentsContentTypes) throws SAXException
- Throws:
SAXException
-
_associationsToSAX
private void _associationsToSAX(ContentHandler handler, ContentType contentType, Set<String> contentTypesIds) throws SAXException
- Throws:
SAXException
-
_getLinkedContentTypes
private Map<String,String> _getLinkedContentTypes(ModelItem modelItem, Set<String> contentTypesIds)
-
getCardinality
private String getCardinality(ElementDefinition definition)
-
_getContentTypeName
private String _getContentTypeName(I18nizableText labelContentType)
-
_getIdForGraph
private String _getIdForGraph(String text)
-
_isMandatoryMetadata
private boolean _isMandatoryMetadata(ElementDefinition definition)
-
-