Package org.ametys.cms.contenttype
Class ContentTypeViewParser
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.cms.contenttype.ContentTypeViewParser
- All Implemented Interfaces:
ViewParser
,Component
,LogEnabled
,Serviceable
public class ContentTypeViewParser
extends AbstractLogEnabled
implements ViewParser, Component, Serviceable
Component that parses the configuration of a content type's view
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
The tag name for attribute referencesprotected ContentType
The content type containing viewprotected ContentTypeExtensionPoint
The content type extension pointprotected ContentTypesHelper
The content types helperprotected ContentTypesParserHelper
The content types parser helperprotected String
The tag name for simple groupsprotected SourceResolver
The source resolverprotected boolean
Determine if this parser supports attribute nested in an attribute of type contentstatic final String
Default tag name for references to attributesFields inherited from interface org.ametys.runtime.model.ViewParser
ALL_ITEMS_REFERENCE, DEFAULT_GROUP_TAG_NAME, DEFAULT_ITEM_REF_TAG_NAME
-
Constructor Summary
ConstructorDescriptionContentTypeViewParser
(ContentType contentType) Creates a view parser for content typesContentTypeViewParser
(ContentType contentType, Optional<String> groupTagName, Optional<String> attributeRefTagName, boolean supportsNestedAttributes) Creates a view parser for content types -
Method Summary
Modifier and TypeMethodDescriptionprotected void
_fillViewItems
(Configuration viewConfiguration, View view) Fill the items of the given viewprotected View
_getViewToInclude
(Configuration itemConfiguration, String viewName) Retrieves the view included by the given configurationprotected ViewElement
_parseContentAttributeViewItem
(Configuration itemConfiguration, ContentAttributeDefinition definition, String path, View referenceView) Parses the view item referencing an attribute of type contentprotected ModelViewItemGroup
Parses the DublinCore view items.protected ModelViewItem
_parseModelViewItem
(Configuration itemConfiguration, String parentPath, View referenceView) Parses a model view itemprotected SimpleViewItemGroup
_parseSimpleViewItemGroup
(Configuration itemConfiguration, String parentPath, String role, View referenceView) Parses a simple view item groupprotected void
_parseViewItemAccessorChildren
(Configuration itemConfiguration, ViewItemAccessor viewItemAccessor, String modelItemPath, View referenceView) Parses the items of the givenViewItemAccessor
protected boolean
_shouldInsertAllAccessorItems
(Configuration accessorConfiguration) Checks if all the items of the current accessor should be inserted in the viewparseView
(Configuration viewConfiguration) Parses a view configuration to create aView
object.void
service
(ServiceManager manager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
DEFAULT_ATTRIBUTE_REF_TAG_NAME
Default tag name for references to attributes- See Also:
-
_contentTypeExtensionPoint
The content type extension point -
_contentTypesHelper
The content types helper -
_contentTypesParserHelper
The content types parser helper -
_srcResolver
The source resolver -
_contentType
The content type containing view -
_groupTagName
The tag name for simple groups -
_attributeRefTagName
The tag name for attribute references -
_supportsNestedAttributes
Determine if this parser supports attribute nested in an attribute of type content
-
-
Constructor Details
-
ContentTypeViewParser
Creates a view parser for content types- Parameters:
contentType
- the content type containing the view
-
ContentTypeViewParser
public ContentTypeViewParser(ContentType contentType, Optional<String> groupTagName, Optional<String> attributeRefTagName, boolean supportsNestedAttributes) Creates a view parser for content types- Parameters:
contentType
- the content type containing the viewgroupTagName
- the tag name for simple groupsattributeRefTagName
- the tag name for attribute referencessupportsNestedAttributes
-false
to avoid this parser to support nested attributes
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
parseView
Description copied from interface:ViewParser
Parses a view configuration to create aView
object.- Specified by:
parseView
in interfaceViewParser
- Parameters:
viewConfiguration
- the configuration of the view to parse- Returns:
- the view
- Throws:
ConfigurationException
- if the configuration is not valid.
-
_fillViewItems
protected void _fillViewItems(Configuration viewConfiguration, View view) throws ConfigurationException Fill the items of the given view- Parameters:
viewConfiguration
- the configuration of the view to fillview
- the view to fill- Throws:
ConfigurationException
- if the configuration is not valid.
-
_parseModelViewItem
protected ModelViewItem _parseModelViewItem(Configuration itemConfiguration, String parentPath, View referenceView) throws ConfigurationException Parses a model view item- Parameters:
itemConfiguration
- configuration of the model view itemparentPath
- path of the parent of the model view itemreferenceView
- view that references the item- Returns:
- the model view item
- Throws:
ConfigurationException
- if the configuration is not valid.
-
_parseContentAttributeViewItem
protected ViewElement _parseContentAttributeViewItem(Configuration itemConfiguration, ContentAttributeDefinition definition, String path, View referenceView) throws ConfigurationException Parses the view item referencing an attribute of type content- Parameters:
itemConfiguration
- configuration of the view itemdefinition
- definition of the attributepath
- path of the item in the viewreferenceView
- view that references the item- Returns:
- the view item
- Throws:
ConfigurationException
- if the configuration is not valid
-
_shouldInsertAllAccessorItems
protected boolean _shouldInsertAllAccessorItems(Configuration accessorConfiguration) throws ConfigurationException Checks if all the items of the current accessor should be inserted in the view- Parameters:
accessorConfiguration
- configuration of the current accessor- Returns:
true
if all items of the current accessor should be inserted in the view,false
otherwise- Throws:
ConfigurationException
- if the configuration is not valid
-
_parseViewItemAccessorChildren
protected void _parseViewItemAccessorChildren(Configuration itemConfiguration, ViewItemAccessor viewItemAccessor, String modelItemPath, View referenceView) throws ConfigurationException Parses the items of the givenViewItemAccessor
- Parameters:
itemConfiguration
- configuration of the model view itemviewItemAccessor
- theViewItemAccessor
that will access to the parsed itemsmodelItemPath
- path of the model view item.referenceView
- The view that references the item- Throws:
ConfigurationException
- if the configuration is not valid
-
_parseSimpleViewItemGroup
protected SimpleViewItemGroup _parseSimpleViewItemGroup(Configuration itemConfiguration, String parentPath, String role, View referenceView) throws ConfigurationException Parses a simple view item group- Parameters:
itemConfiguration
- configuration of the simple view item groupparentPath
- path of the model item parent of the group.role
- role of the view groupreferenceView
- the reference view for includes- Returns:
- the simple view item group
- Throws:
ConfigurationException
- if the configuration is not valid.
-
_getViewToInclude
protected View _getViewToInclude(Configuration itemConfiguration, String viewName) throws ConfigurationException Retrieves the view included by the given configuration- Parameters:
itemConfiguration
- configuration of the item that includes the viewviewName
- name of the view containing the item. (the item can be the view itself or a simple view item group inside the view)- Returns:
- the view included by the given configuration
- Throws:
ConfigurationException
- if the configuration is not valid
-
_parseDublinCoreViewItems
Parses the DublinCore view items.- Returns:
- the group containing the dublin core view items
- Throws:
ConfigurationException
- if the configuration is not valid.
-