Package org.ametys.runtime.config
Class ConfigParameterDefinitionHelper
java.lang.Object
org.ametys.runtime.config.ConfigParameterDefinitionHelper
Helper for
ConfigParameterDefinitionWrapper-
Method Summary
Modifier and TypeMethodDescriptionstatic ViewbuildConfigParametersView(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 anIllegalArgumentExceptionwill be thrown if the hierarchy is incorrect.Categorize the ModlItems based on the informations in theCategorizedElementDefinitionWrappercollection Category and groups are not sorted, only definitions, based on the position.static Map<String, ElementDefinition> Get definitions of all elements parsed in thisCategorizedElementDefinitionWrapperCollection, as a flat map.
-
Method Details
-
getFlatDefinitions
public static Map<String,ElementDefinition> getFlatDefinitions(Collection<ConfigParameterDefinitionWrapper> elements) Get definitions of all elements parsed in thisCategorizedElementDefinitionWrapperCollection, as a flat map.- Parameters:
elements- aCollectionofCategorizedElementDefinitionWrapper- 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 theCategorizedElementDefinitionWrappercollection 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
ModelItemwith 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 anIllegalArgumentExceptionwill be thrown if the hierarchy is incorrect.- Parameters:
categories- list ofModelItemcategoriesComparator-Comparatorused for the categories (can be null to keep order)groupsComparator-Comparatorfor the groups (can be null to keep order)elementsComparator-Comparatorfor the elements (can be null to keep order)- Returns:
- A
Viewordered from theModelItemusing theComparator - Throws:
IllegalArgumentException- the hierarchy of the categories/groups/elements is incorrect
-