Package io.jmix.dynmodelflowui.impl
Class DynamicViewValidatorImpl
java.lang.Object
io.jmix.dynmodelflowui.impl.DynamicViewValidatorImpl
- All Implemented Interfaces:
DynamicViewValidator
@Component("dynmod_DynamicViewValidator")
public class DynamicViewValidatorImpl
extends Object
implements DynamicViewValidator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BaseViewXmlProviderprotected org.springframework.beans.factory.ObjectProvider<DynamicModelManager> protected DynamicModelToolsprotected final org.springframework.expression.spel.standard.SpelExpressionParserprotected static final Stringprotected Metadataprotected DynamicModelOperationRegistryprotected static final Patternprotected static final Patternprotected DynamicTemplateViewSupportprotected ViewRegistry -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddResult(List<DynamicViewValidationResult> results, String entityName, DynamicViewDefinition definition, @Nullable String viewId, List<String> errors) collectCreatedDynamicEntities(DynamicModelDefinition modelDefinition) collectDescriptorComponentIds(DynamicViewDefinition viewDefinition) protected voidcollectElementIds(org.dom4j.Element element, Set<String> ids) protected voidcollectExtendedBaseViewComponentIds(org.dom4j.Element root, DynamicViewDefinition viewDefinition, Set<String> ids) A static entity extension'sdescriptor.sourceis a<view extends="…">fragment holding only its own new elements; the base view's ids are just as valid a handler target at runtime (the behavior manager resolves components against the merged view), so they are unioned in here too.protected StringcreateRouteSlug(String value) protected voidinspectNode(org.springframework.expression.spel.SpelNode node, List<String> followUpReferences, List<String> errors) protected StringresolveRoute(DynamicViewDefinition definition, String viewId, DynamicViewType type) protected StringresolveViewId(String entityName, DynamicViewDefinition definition, @Nullable DynamicViewType type) validate(DynamicModelDefinition modelDefinition) Validates the views declared in the given model definition.protected @Nullable DynamicViewTypevalidateAndResolveType(DynamicEntityDefinition entityDefinition, boolean dynamicEntity, DynamicViewDefinition viewDefinition, List<String> errors) protected voidvalidateDescriptor(boolean dynamicEntity, DynamicViewDefinition viewDefinition, @Nullable DynamicViewType type, List<String> errors) protected voidvalidateHandlerComponentId(DynamicViewHandlerDefinition handler, @Nullable Set<String> descriptorComponentIds, List<String> errors) protected voidvalidateHandlerExpression(DynamicViewHandlerDefinition handler, List<String> followUpReferences, List<String> errors) protected voidvalidateHandlers(DynamicViewDefinition viewDefinition, List<String> errors) protected voidvalidateMenuItem(@Nullable DynamicViewType type, DynamicViewDefinition viewDefinition, List<String> errors) A read view's route carries the entity id, so a menu item pointing at one needs a value for that route parameter.protected voidvalidateStaticAndDynamicRules(boolean dynamicEntity, DynamicViewDefinition viewDefinition, List<String> errors) protected voidvalidateXmlDescriptor(@Nullable String source, List<String> errors)
-
Field Details
-
FLOWUI_VIEW_NS
- See Also:
-
ROUTE_NON_ALNUM
-
ROUTE_EDGE
-
metadata
-
dynamicModelTools
-
viewRegistry
-
dynamicModelManagerProvider
@Autowired protected org.springframework.beans.factory.ObjectProvider<DynamicModelManager> dynamicModelManagerProvider -
templateViewSupport
-
operationRegistry
-
baseViewXmlProvider
-
expressionParser
protected final org.springframework.expression.spel.standard.SpelExpressionParser expressionParser
-
-
Constructor Details
-
DynamicViewValidatorImpl
public DynamicViewValidatorImpl()
-
-
Method Details
-
validate
Description copied from interface:DynamicViewValidatorValidates the views declared in the given model definition.- Specified by:
validatein interfaceDynamicViewValidator- Parameters:
modelDefinition- dynamic model definition to validate- Returns:
- a result for each view that has errors; empty if all views are valid
-
validateAndResolveType
protected @Nullable DynamicViewType validateAndResolveType(DynamicEntityDefinition entityDefinition, boolean dynamicEntity, DynamicViewDefinition viewDefinition, List<String> errors) -
validateMenuItem
protected void validateMenuItem(@Nullable DynamicViewType type, DynamicViewDefinition viewDefinition, List<String> errors) A read view's route carries the entity id, so a menu item pointing at one needs a value for that route parameter.MenuItemDefinitionhas no place to declare one, so the item would be built without it and its url could not be resolved — which takes the whole main menu down, not just the item. Hence the flat rejection rather than a "value is required" check. A hand-written menu can do this, through<routeParameters>. -
validateStaticAndDynamicRules
protected void validateStaticAndDynamicRules(boolean dynamicEntity, DynamicViewDefinition viewDefinition, List<String> errors) -
validateDescriptor
protected void validateDescriptor(boolean dynamicEntity, DynamicViewDefinition viewDefinition, @Nullable DynamicViewType type, List<String> errors) -
validateXmlDescriptor
-
resolveViewId
protected String resolveViewId(String entityName, DynamicViewDefinition definition, @Nullable DynamicViewType type) -
resolveRoute
protected String resolveRoute(DynamicViewDefinition definition, String viewId, DynamicViewType type) -
createRouteSlug
-
collectCreatedDynamicEntities
-
validateHandlers
-
validateHandlerComponentId
protected void validateHandlerComponentId(DynamicViewHandlerDefinition handler, @Nullable Set<String> descriptorComponentIds, List<String> errors) -
collectDescriptorComponentIds
-
collectExtendedBaseViewComponentIds
protected void collectExtendedBaseViewComponentIds(org.dom4j.Element root, DynamicViewDefinition viewDefinition, Set<String> ids) A static entity extension'sdescriptor.sourceis a<view extends="…">fragment holding only its own new elements; the base view's ids are just as valid a handler target at runtime (the behavior manager resolves components against the merged view), so they are unioned in here too.viewDefinition.viewId()is already the id of the very static view being extended (it is validated as such invalidateAndResolveType(io.jmix.dynmodel.meta.DynamicEntityDefinition, boolean, io.jmix.dynmodel.meta.DynamicViewDefinition, java.util.List<java.lang.String>)), so it is used directly to resolve the base view rather than reparsing theextendspath, which is a descriptor path, not a view id. A base view that fails to resolve leavesidsas collected from the source alone, no stricter than before this method existed. -
collectElementIds
-
validateHandlerExpression
protected void validateHandlerExpression(DynamicViewHandlerDefinition handler, List<String> followUpReferences, List<String> errors) -
inspectNode
-
addResult
protected void addResult(List<DynamicViewValidationResult> results, String entityName, DynamicViewDefinition definition, @Nullable String viewId, List<String> errors)
-