Package org.ametys.web.parameters
Class ParametersManager
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.web.parameters.ParametersManager
- All Implemented Interfaces:
LogEnabled
,Component
Manager to handle parameters
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_addParameterValues
(ModelItem item, ModelAwareDataHolder dataHolder, String prefix, Map<String, Object> values) Add the parameter values to all valuesprotected Map<String,
DefinitionAndValue> _getBrothersDefinitionAndValues
(String prefix, Map<String, Object> values, ElementDefinition definition) Get the definition and value pairs of the given definition brothers.protected boolean
_hasParameterValueOrDefaultValue
(String parameterPath, ModelAwareDataHolder dataHolder, Object defaultValue) True if the parameter has a value or a default valueprotected void
_moveRepeaterEntries
(ModifiableModelAwareRepeater repeater, Map<String, Object> values, String repeaterPath) Moves the repeater entries according to the given values.protected void
_setParameterValues
(ModelItem def, Map<String, Object> values, ModifiableModelAwareDataHolder dataHolder, String prefix, Map<String, List<I18nizableText>> allErrors) Set parameters values of the model itemaddPrefixToParameters
(Map<String, Object> parameterValues, String prefix) Add prefix to all parametersgetParametersStartWithPrefix
(Map<String, Object> parameterValues, String prefix) Get all parameters which start with prefix and change the name of the attribute removing this prefixgetParametersValues
(Collection<? extends ModelItem> items, ModelAwareDataHolder dataHolder, String prefix) Get the parameters valuesgetRepeatersValues
(Collection<ModelItem> items, ModelAwareDataHolder dataHolder, String prefix) Get the repeaters valuessetParameterValues
(ModifiableModelAwareDataHolder dataHolder, Collection<? extends ModelItem> modelItems, Map<String, Object> values) Set parameters values to the data holder for each model itemsMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon Role -
_PARAM_UNTOUCHED_BINARY
Constant for untouched binary metadata.- See Also:
-
-
Constructor Details
-
ParametersManager
public ParametersManager()
-
-
Method Details
-
setParameterValues
public Map<String,List<I18nizableText>> setParameterValues(ModifiableModelAwareDataHolder dataHolder, Collection<? extends ModelItem> modelItems, Map<String, Object> values) Set parameters values to the data holder for each model items- Parameters:
dataHolder
- the data holdermodelItems
- the list of model itemsvalues
- the values- Returns:
- the map of possible errors
-
_setParameterValues
protected void _setParameterValues(ModelItem def, Map<String, Object> values, ModifiableModelAwareDataHolder dataHolder, String prefix, Map<String, List<I18nizableText>> allErrors) Set parameters values of the model item- Parameters:
def
- the model item definitionvalues
- the valuedataHolder
- the data holderprefix
- the prefix to get the parameter valuesallErrors
- the map of possible errors
-
_getBrothersDefinitionAndValues
protected Map<String,DefinitionAndValue> _getBrothersDefinitionAndValues(String prefix, Map<String, Object> values, ElementDefinition definition) Get the definition and value pairs of the given definition brothers. The definition and value pairs are indexed by the parameter name- Parameters:
prefix
- prefix to get the parameter valuesvalues
- all the parameter valuesdefinition
- the definition- Returns:
- the definition and value pairs of the given definition brother
-
_moveRepeaterEntries
protected void _moveRepeaterEntries(ModifiableModelAwareRepeater repeater, Map<String, Object> values, String repeaterPath) Moves the repeater entries according to the given values. Removes or add entries if needed. After the call of this method, the given repeater will contain the right entries- Parameters:
repeater
- the repeatervalues
- the valuesrepeaterPath
- the repeater path
-
getParametersValues
public Map<String,Object> getParametersValues(Collection<? extends ModelItem> items, ModelAwareDataHolder dataHolder, String prefix) Get the parameters values- Parameters:
items
- the list of model itemdataHolder
- the data holderprefix
- prefix to get the parameter values- Returns:
- the parameters values
-
_addParameterValues
protected void _addParameterValues(ModelItem item, ModelAwareDataHolder dataHolder, String prefix, Map<String, Object> values) Add the parameter values to all values- Parameters:
item
- the model itemdataHolder
- the data holderprefix
- prefix to get the parameter valuesvalues
- all the values
-
getRepeatersValues
public List<Map<String,Object>> getRepeatersValues(Collection<ModelItem> items, ModelAwareDataHolder dataHolder, String prefix) Get the repeaters values- Parameters:
items
- the list of model itemdataHolder
- the data holderprefix
- prefix to get the parameter values- Returns:
- the repeaters values
-
_hasParameterValueOrDefaultValue
protected boolean _hasParameterValueOrDefaultValue(String parameterPath, ModelAwareDataHolder dataHolder, Object defaultValue) True if the parameter has a value or a default value- Parameters:
parameterPath
- the parameter pathdataHolder
- the data holderdefaultValue
- the default value- Returns:
- true if the parameter has a value or a default value
-
getParametersStartWithPrefix
public Map<String,Object> getParametersStartWithPrefix(Map<String, Object> parameterValues, String prefix) Get all parameters which start with prefix and change the name of the attribute removing this prefix- Parameters:
parameterValues
- the parameter valuesprefix
- the prefix- Returns:
- the map of filtered parameters
-
addPrefixToParameters
Add prefix to all parameters- Parameters:
parameterValues
- the parameters valuesprefix
- the prefix- Returns:
- the map of parameters with its prefix
-