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,ContentAttributeDefinitionParser,CredentialProviderFactory.CredentialProviderModelParameterParser,GroupDirectoryFactory.GroupDirectoryModelParameterParser,ServiceParameterDefinitionParser,SiteParameterParser,SkinParameterParser,SynchronizableContentsCollectionModelParameterParser,UserDirectoryFactory.UserDirectoryModelParameterParser,ViewParameterDefinitionParser
public class ElementDefinitionParser extends AbstractModelItemParser
ElementDefinitionparser from an XML configuration.
-
-
Field Summary
-
Fields inherited from class org.ametys.runtime.model.AbstractModelItemParser
_modelItemTypeExtensionPoint
-
-
Constructor Summary
Constructors Constructor Description ElementDefinitionParser(AbstractThreadSafeComponentExtensionPoint<? extends ModelItemType> modelItemTypeExtensionPoint, ThreadSafeComponentManager<Enumerator> enumeratorManager, ThreadSafeComponentManager<Validator> validatorManager)Creates an element definition parser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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.protected List<Pair<String,Object>>_parseDefaultValues(Configuration definitionConfig, ElementDefinition definition)Parses the default values.protected Boolean_parseMultiple(Configuration definitionConfig)Parses the multiple attribute.voidlookupComponents()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, _parseDisableConditions, _parseI18nizableText, _parseI18nizableText, _parseName, _parseType, _parseWidget, _parseWidgetParameters, parse
-
-
-
-
Constructor Detail
-
ElementDefinitionParser
public ElementDefinitionParser(AbstractThreadSafeComponentExtensionPoint<? extends ModelItemType> 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 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:AbstractModelItemParserParses an element definition from a XML configuration.- Overrides:
parsein 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:AbstractModelItemParserCreate the model item to populate it.- Specified by:
_createModelItemin 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
nullif 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
nullif none default value is defined. - Throws:
ConfigurationException- if the configuration is not valid.
-
_parseMultiple
protected Boolean _parseMultiple(Configuration definitionConfig) throws ConfigurationException
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
public void lookupComponents() throws Exception
Retrieves local validators and enumerators components and set them into previous parsed element definition.- Throws:
Exception- if an error occurs.
-
-