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,Serviceable
Manager to handle parameters
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DisableConditionsEvaluator<ModelAwareDataHolder>The disable conditions evaluatorprotected static final StringPrefix for HTML form elements.protected static final StringConstant for untouched binary metadata.static final StringAvalon Role -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void_addParameterValues(ModelItem item, ModelAwareDataHolder dataHolder, String prefix, Map<String, Object> values) Add the parameter values to all valuesprotected boolean_hasParameterValueOrDefaultValue(String parameterPath, ModelAwareDataHolder dataHolder, Object defaultValue) True if the parameter has a value or a default value_parseValues(Collection<? extends ModelItem> modelItems, Map<String, Object> rawValues, String prefix) Parses the given raw valuesprotected Map<String,List<I18nizableText>> _setParameterValues(Collection<? extends ModelItem> modelItems, Map<String, Object> currentValues, Map<String, Object> allValues, ModifiableModelAwareDataHolder dataHolder, String prefix) Set parameters values of the model itemsaddPrefixToParameters(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 valuesvoidservice(ServiceManager manager) setParameterValues(ModifiableModelAwareDataHolder dataHolder, Collection<? extends ModelItem> modelItems, Map<String, Object> rawValues) 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:
-
_PARAM_METADATA_PREFIX
Prefix for HTML form elements.- See Also:
-
_disableConditionsEvaluator
The disable conditions evaluator
-
-
Constructor Details
-
ParametersManager
public ParametersManager()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
setParameterValues
public Map<String,List<I18nizableText>> setParameterValues(ModifiableModelAwareDataHolder dataHolder, Collection<? extends ModelItem> modelItems, Map<String, Object> rawValues) Set parameters values to the data holder for each model items- Parameters:
dataHolder- the data holdermodelItems- the list of model itemsrawValues- the values- Returns:
- the map of possible errors
-
_parseValues
protected Map<String,Object> _parseValues(Collection<? extends ModelItem> modelItems, Map<String, Object> rawValues, String prefix) Parses the given raw values- Parameters:
modelItems- the model items corresponding to the given valuesrawValues- the raw valuesprefix- the current prefix for data to parse- Returns:
- the parsed values
-
_setParameterValues
protected Map<String,List<I18nizableText>> _setParameterValues(Collection<? extends ModelItem> modelItems, Map<String, Object> currentValues, Map<String, Object> allValues, ModifiableModelAwareDataHolder dataHolder, String prefix) Set parameters values of the model items- Parameters:
modelItems- the model itemscurrentValues- the values to set for the current model itemsallValues- the value all values to setdataHolder- the data holderprefix- the prefix to get the parameter values- Returns:
- the map of possible errors
-
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
-