Package org.ametys.cms.contenttype
Class ContentAttributeDefinitionParser
- java.lang.Object
-
- org.ametys.runtime.model.AbstractModelItemParser
-
- org.ametys.runtime.model.ElementDefinitionParser
-
- org.ametys.cms.contenttype.ContentAttributeDefinitionParser
-
- Direct Known Subclasses:
DublinCoreAttributeDefinitionParser
public class ContentAttributeDefinitionParser extends ElementDefinitionParser
This class parses the content attributes definition
-
-
Field Summary
Fields Modifier and Type Field Description protected static Pattern
__annotationNamePattern
Pattern for annotation namesprotected ContentTypeExtensionPoint
_contentTypeExtensionPoint
the content type extension pointprotected ContentTypesHelper
_contentTypesHelper
the content types helper-
Fields inherited from class org.ametys.runtime.model.AbstractModelItemParser
_modelItemTypeExtensionPoint
-
-
Constructor Summary
Constructors Constructor Description ContentAttributeDefinitionParser(ContentAttributeTypeExtensionPoint contentAttributeTypeExtensionPoint, ThreadSafeComponentManager<Enumerator> enumeratorManager, ThreadSafeComponentManager<Validator> validatorManager)
Creates a content attribute definition parser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AttributeDefinition
_createModelItem(Configuration definitionConfig)
Create the model item to populate it.protected Pattern
_getAnnotationNamePattern()
Get the annotation name pattern to test validity.protected String
_parseContentTypeId(Configuration itemConfig)
Parses the content type identifier attribute.protected Object
_parseDefaultValue(Configuration defaultValueConfig, ElementDefinition definition, String defaultValueType)
Parses the default value.protected List<SemanticAnnotation>
_parseDefinitionWithAnnotations(String catalog, Configuration itemConfig)
Parses the semantic annotations of the model itemprotected boolean
_parseForceInvert(Configuration itemConfig)
Parses the force invert attribute.protected String
_parseInvertRelationPath(Configuration itemConfig)
Parses the invert relation path attribute.protected String
_parseName(Configuration itemConfig)
Parses the name of the model item.<T extends ModelItem>
Tparse(ServiceManager serviceManager, String pluginName, String catalog, Configuration definitionConfig, Model model, ModelItemGroup parent)
Parses an element definition from a XML configuration.-
Methods inherited from class org.ametys.runtime.model.ElementDefinitionParser
_parseAndSetEnumerator, _parseAndSetValidator, _parseDefaultValues, _parseDisableConditions, _parseMultiple, _parseWidget, _parseWidgetParameters, lookupComponents
-
Methods inherited from class org.ametys.runtime.model.AbstractModelItemParser
_getNameConfigurationAttribute, _parseI18nizableText, _parseI18nizableText, _parseType, parse
-
-
-
-
Field Detail
-
__annotationNamePattern
protected static Pattern __annotationNamePattern
Pattern for annotation names
-
_contentTypeExtensionPoint
protected ContentTypeExtensionPoint _contentTypeExtensionPoint
the content type extension point
-
_contentTypesHelper
protected ContentTypesHelper _contentTypesHelper
the content types helper
-
-
Constructor Detail
-
ContentAttributeDefinitionParser
public ContentAttributeDefinitionParser(ContentAttributeTypeExtensionPoint contentAttributeTypeExtensionPoint, ThreadSafeComponentManager<Enumerator> enumeratorManager, ThreadSafeComponentManager<Validator> validatorManager)
Creates a content attribute definition parser.- Parameters:
contentAttributeTypeExtensionPoint
- the extension point to use to get available element typesenumeratorManager
- the enumerator component manager.validatorManager
- the validator component manager.
-
-
Method Detail
-
parse
public <T extends ModelItem> T parse(ServiceManager serviceManager, String pluginName, String catalog, Configuration definitionConfig, Model model, ModelItemGroup parent) throws ConfigurationException
Description copied from class:AbstractModelItemParser
Parses an element definition from a XML configuration.- Overrides:
parse
in classElementDefinitionParser
- Type Parameters:
T
- type of the parsed item- Parameters:
serviceManager
- the service managerpluginName
- the plugin name declaring this item.catalog
- the catalogdefinitionConfig
- the XML configuration of the model item.model
- the model which defines the model itemparent
- the parent of the model item to create. Can be null if the model item to parse has no parent- Returns:
- the parsed model item.
- Throws:
ConfigurationException
- if the configuration is not valid.
-
_createModelItem
protected AttributeDefinition _createModelItem(Configuration definitionConfig) throws ConfigurationException
Description copied from class:AbstractModelItemParser
Create the model item to populate it.- Overrides:
_createModelItem
in classElementDefinitionParser
- Parameters:
definitionConfig
- the model item configuration to use.- Returns:
- the item instantiated.
- Throws:
ConfigurationException
- if the configuration is not valid.
-
_parseName
protected String _parseName(Configuration itemConfig) throws ConfigurationException
Description copied from class:AbstractModelItemParser
Parses the name of the model item.- Overrides:
_parseName
in classAbstractModelItemParser
- Parameters:
itemConfig
- the model item configuration to use.- Returns:
- the name of the model item.
- Throws:
ConfigurationException
- if the configuration is not valid.
-
_parseDefaultValue
protected Object _parseDefaultValue(Configuration defaultValueConfig, ElementDefinition definition, String defaultValueType) throws ConfigurationException
Description copied from class:ElementDefinitionParser
Parses the default value.- Overrides:
_parseDefaultValue
in classElementDefinitionParser
- Parameters:
defaultValueConfig
- the default value configuration.definition
- the element definition.defaultValueType
- the type of the default value- Returns:
- the default value or
null
if none default value is defined. - Throws:
ConfigurationException
- if the configuration is not valid.
-
_parseDefinitionWithAnnotations
protected List<SemanticAnnotation> _parseDefinitionWithAnnotations(String catalog, Configuration itemConfig) throws ConfigurationException
Parses the semantic annotations of the model item- Parameters:
catalog
- the catalog.itemConfig
- the model item configuration to use.- Returns:
- the list of the declared annotations.
- Throws:
ConfigurationException
- if the configuration is not valid.
-
_getAnnotationNamePattern
protected Pattern _getAnnotationNamePattern()
Get the annotation name pattern to test validity.- Returns:
- The annotation name pattern.
-
_parseContentTypeId
protected String _parseContentTypeId(Configuration itemConfig) throws ConfigurationException
Parses the content type identifier attribute.- Parameters:
itemConfig
- the item configuration to use.- Returns:
- the identifier of the content type or
null
if none defined. - Throws:
ConfigurationException
- if the defined content type des not exist
-
_parseInvertRelationPath
protected String _parseInvertRelationPath(Configuration itemConfig)
Parses the invert relation path attribute.- Parameters:
itemConfig
- the item configuration to use.- Returns:
- the invert relation path or
null
if none defined.
-
_parseForceInvert
protected boolean _parseForceInvert(Configuration itemConfig)
Parses the force invert attribute.- Parameters:
itemConfig
- the item configuration to use.- Returns:
true
if mutual relationship of the item should be set regardless of user's rights,false
otherwise.
-
-