Class ViewHelper
java.lang.Object
org.ametys.plugins.repository.model.ViewHelper
Helper for manipulating views in the context of the repository plugin (aware of repeaters, composites, ...).
-
Method Summary
Modifier and TypeMethodDescriptionstatic ValidationResultsvalidateValues(ViewItemAccessor viewItemAccessor, Optional<Map<String, Object>> values) Validates the given values according to the view item accessorstatic voidvisitView(ViewItemAccessor viewItemAccessor, BiConsumer<ViewElement, ElementDefinition> elementConsumer, BiConsumer<ModelViewItemGroup, CompositeDefinition> compositeConsumer, BiConsumer<ModelViewItemGroup, RepeaterDefinition> repeaterConsumer, Consumer<ViewItemGroup> groupConsumer) Visit a view, allowing to perform specific actions for view elements.
-
Method Details
-
visitView
public static void visitView(ViewItemAccessor viewItemAccessor, BiConsumer<ViewElement, ElementDefinition> elementConsumer, BiConsumer<ModelViewItemGroup, CompositeDefinition> compositeConsumer, BiConsumer<ModelViewItemGroup, RepeaterDefinition> repeaterConsumer, Consumer<ViewItemGroup> groupConsumer) Visit a view, allowing to perform specific actions for view elements.- Parameters:
viewItemAccessor- theViewItemAccessorto visit.elementConsumer- the consumer called on eachViewElement.compositeConsumer- the consumer called on each item refering to aCompositeDefinition.repeaterConsumer- the consumer called on each item refering to aRepeaterDefinition.groupConsumer- the consumer called on each otherViewItemGroup.
-
validateValues
public static ValidationResults validateValues(ViewItemAccessor viewItemAccessor, Optional<Map<String, Object>> values) Validates the given values according to the view item accessor- Parameters:
viewItemAccessor- the view item accessor to visitvalues- the values to validate- Returns:
- the errors information if the validation fails.
-