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 ValidationResults
validateValues
(ViewItemAccessor viewItemAccessor, Optional<Map<String, Object>> values) Validates the given values according to the view item accessorstatic 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.
-
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
- theViewItemAccessor
to 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:
values
- the values to validateviewItemAccessor
- the view item accessor to visit- Returns:
- the errors information if the validation fails.
-