Package org.ametys.runtime.config
Class ConfigParameterDefinitionHelper
java.lang.Object
org.ametys.runtime.config.ConfigParameterDefinitionHelper
Helper for
ConfigParameterDefinitionWrapper
-
Method Summary
Modifier and TypeMethodDescriptionstatic View
buildConfigParametersView
(Collection<? extends ModelItem> categories, Comparator<? super ModelItem> categoriesComparator, Comparator<? super ModelItem> groupsComparator, Comparator<? super ModelItem> elementsComparator) Generate the view for a list ofModelItem
, using comparators to sort the categories and the groups This works only on the very specific categories/group/fieldset hierarchy and anIllegalArgumentException
will be thrown if the hierarchy is incorrect.Categorize the ModlItems based on the informations in theCategorizedElementDefinitionWrapper
collection Category and groups are not sorted, only definitions, based on the position.static Map<String,
ElementDefinition> Get definitions of all elements parsed in thisCategorizedElementDefinitionWrapper
Collection
, as a flat map.
-
Method Details
-
getFlatDefinitions
public static Map<String,ElementDefinition> getFlatDefinitions(Collection<ConfigParameterDefinitionWrapper> elements) Get definitions of all elements parsed in thisCategorizedElementDefinitionWrapper
Collection
, as a flat map.- Parameters:
elements
- aCollection
ofCategorizedElementDefinitionWrapper
- Returns:
- a map with the definition name as key, containing all definitions
-
categorizeConfigParameters
public static List<ModelItem> categorizeConfigParameters(Collection<ConfigParameterDefinitionWrapper> elements) Categorize the ModlItems based on the informations in theCategorizedElementDefinitionWrapper
collection Category and groups are not sorted, only definitions, based on the position. Sorting of category and groups have to be done when the view is created (each usage can be different)- Parameters:
elements
- collection of categorized elements- Returns:
- a list of
ModelItem
with the correct tree (category/group/definitions)
-
buildConfigParametersView
public static View buildConfigParametersView(Collection<? extends ModelItem> categories, Comparator<? super ModelItem> categoriesComparator, Comparator<? super ModelItem> groupsComparator, Comparator<? super ModelItem> elementsComparator) throws IllegalArgumentException Generate the view for a list ofModelItem
, using comparators to sort the categories and the groups This works only on the very specific categories/group/fieldset hierarchy and anIllegalArgumentException
will be thrown if the hierarchy is incorrect.- Parameters:
categories
- list ofModelItem
categoriesComparator
-Comparator
used for the categories (can be null to keep order)groupsComparator
-Comparator
for the groups (can be null to keep order)elementsComparator
-Comparator
for the elements (can be null to keep order)- Returns:
- A
View
ordered from theModelItem
using theComparator
- Throws:
IllegalArgumentException
- the hierarchy of the categories/groups/elements is incorrect
-