Package org.ametys.runtime.model
Class ElementDefinitionParser
java.lang.Object
org.ametys.runtime.model.AbstractModelItemParser
org.ametys.runtime.model.ElementDefinitionParser
- Direct Known Subclasses:
AbstractStaticSchedulable.SchedulableParameterParser
,ConfigParameterDefinitionParser
,CredentialProviderFactory.CredentialProviderModelParameterParser
,ElementDefinitionParser
,GroupDirectoryFactory.GroupDirectoryModelParameterParser
,UserDirectoryFactory.UserDirectoryModelParameterParser
ElementDefinition
parser from an XML configuration.-
Field Summary
Fields inherited from class org.ametys.runtime.model.AbstractModelItemParser
_modelItemTypeExtensionPoint
-
Constructor Summary
ConstructorDescriptionElementDefinitionParser
(ModelItemTypeExtensionPoint modelItemTypeExtensionPoint, ThreadSafeComponentManager<Enumerator> enumeratorManager, ThreadSafeComponentManager<Validator> validatorManager) Creates an element definition parser. -
Method Summary
Modifier and TypeMethodDescriptionprotected ElementDefinition
_createModelItem
(Configuration definitionConfig) Create the model item to populate it.protected void
_parseAndSetEnumerator
(String pluginName, String catalog, ElementDefinition definition, Configuration definitionConfig) Parses the enumerator.protected void
_parseAndSetValidator
(String pluginName, ElementDefinition definition, Configuration definitionConfig) Parses the validator.protected Object
_parseDefaultValue
(Configuration defaultValueConfig, ElementDefinition definition, String defaultValueType) Parses the default value._parseDefaultValues
(Configuration definitionConfig, ElementDefinition definition) Parses the default values.protected Boolean
_parseMultiple
(Configuration definitionConfig) Parses the multiple attribute.void
Retrieves local validators and enumerators components and set them into previous parsed element definition.<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.AbstractModelItemParser
_getNameConfigurationAttribute, _parseConditions, _parseDisableConditions, _parseI18nizableText, _parseI18nizableText, _parseName, _parseType, _parseWidget, _parseWidgetParameters, parse
-
Constructor Details
-
ElementDefinitionParser
public ElementDefinitionParser(ModelItemTypeExtensionPoint modelItemTypeExtensionPoint, ThreadSafeComponentManager<Enumerator> enumeratorManager, ThreadSafeComponentManager<Validator> validatorManager) Creates an element definition parser.- Parameters:
modelItemTypeExtensionPoint
- the extension point to use to get available element typesenumeratorManager
- the enumerator component manager.validatorManager
- the validator component manager.
-
-
Method Details
-
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 classAbstractModelItemParser
- 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 ElementDefinition _createModelItem(Configuration definitionConfig) throws ConfigurationException Description copied from class:AbstractModelItemParser
Create the model item to populate it.- Specified by:
_createModelItem
in classAbstractModelItemParser
- Parameters:
definitionConfig
- the model item configuration to use.- Returns:
- the item instantiated.
- Throws:
ConfigurationException
- if the configuration is not valid.
-
_parseDefaultValues
protected List<Pair<String,Object>> _parseDefaultValues(Configuration definitionConfig, ElementDefinition definition) throws ConfigurationException Parses the default values.- Parameters:
definitionConfig
- the element definition configuration.definition
- the element definition.- Returns:
- the default values and their types or
null
if none default value is defined. - Throws:
ConfigurationException
- if the configuration is not valid.
-
_parseDefaultValue
protected Object _parseDefaultValue(Configuration defaultValueConfig, ElementDefinition definition, String defaultValueType) throws ConfigurationException Parses the default value.- 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.
-
_parseMultiple
Parses the multiple attribute.- Parameters:
definitionConfig
- the element definition configuration to use.- Returns:
- the true if the element is multiple, false otherwise.
- Throws:
ConfigurationException
- if the configuration is not valid.
-
_parseAndSetEnumerator
protected void _parseAndSetEnumerator(String pluginName, String catalog, ElementDefinition definition, Configuration definitionConfig) throws ConfigurationException Parses the enumerator.- Parameters:
pluginName
- the plugin name.catalog
- the catalogdefinition
- the element definition.definitionConfig
- the element definition configuration.- Throws:
ConfigurationException
- if the configuration is not valid.
-
_parseAndSetValidator
protected void _parseAndSetValidator(String pluginName, ElementDefinition definition, Configuration definitionConfig) throws ConfigurationException Parses the validator.- Parameters:
pluginName
- the plugin name.definition
- the element definition.definitionConfig
- the element definition configuration.- Throws:
ConfigurationException
- if the configuration is not valid.
-
lookupComponents
Retrieves local validators and enumerators components and set them into previous parsed element definition.- Throws:
Exception
- if an error occurs.
-