Package io.jmix.dynmodelflowui.impl
Class DynamicModelDefinitionModelConverter
java.lang.Object
io.jmix.dynmodelflowui.impl.DynamicModelDefinitionModelConverter
@Component("dynmod_DynamicModelDefinitionModelConverter")
public class DynamicModelDefinitionModelConverter
extends Object
Converts dynamic model definitions between YAML content, immutable metadata definition records and mutable model
entities used by the Admin UI graphical editor.
The converter delegates YAML root parsing and writing to DynamicModelDefinitionSerializer so generated
content stays compatible with the existing dynamic model YAML serializer. Nested arbitrary object maps, such as
validation parameters and view template parameters, are represented in DTOs as YAML fragments to preserve their
original value types.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ClassManagerprotected Metadataprotected DynamicModelDefinitionSerializerprotected final com.fasterxml.jackson.databind.ObjectMapper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected @Nullable StringblankToNull(@Nullable String value) protected <T> Tdeserialize(String content) Deserializes YAML content into a mutable model graph.protected StringemptyIfNull(@Nullable String value) protected @Nullable DynamicAttributeResourceRolesModelfromAttributeAccessDefinition(@Nullable DynamicAttributeAccessDefinition definition) protected DynamicAttributeConstraintModelprotected DynamicAttributeModelfromAttributeDefinition(DynamicAttributeDefinition definition) protected List<DynamicAttributeConstraintModel> fromAttributeValidation(@Nullable DynamicValidationDefinition<DynamicAttributeConstraintDefinition> validation) protected @Nullable DynamicCalculatedAttributeModelfromCalculatedAttributeDefinition(@Nullable DynamicCalculatedAttributeDefinition definition) fromDefinition(DynamicModelDefinition definition) Converts an immutable dynamic model definition into a mutable model graph.protected @Nullable DynamicEntityResourceRolesModelfromEntityAccessDefinition(@Nullable DynamicEntityAccessDefinition definition) protected DynamicEntityConstraintModelprotected DynamicEntityModelfromEntityDefinition(DynamicEntityDefinition definition) protected List<DynamicEntityConstraintModel> fromEntityValidation(@Nullable DynamicValidationDefinition<DynamicEntityConstraintDefinition> validation) protected DynamicEnumerationModelprotected DynamicEnumerationValueModelprotected @Nullable DynamicLocalizedValueModelfromLocalizedValue(@Nullable LocalizedValue value) protected List<DynamicStringValueModel> fromMenuAccessDefinition(@Nullable DynamicMenuAccessDefinition definition) protected @Nullable DynamicMenuItemModelfromMenuItemDefinition(@Nullable MenuItemDefinition definition) protected List<DynamicLocalizedMessageModel> fromMessageMap(@Nullable Map<String, String> messages) protected List<DynamicKeyValueModel> fromObjectMap(@Nullable Map<String, Object> values) protected List<DynamicStringValueModel> fromStringList(List<String> values) protected DynamicUniqueConstraintModelprotected List<DynamicStringValueModel> fromViewAccessDefinition(@Nullable DynamicViewAccessDefinition definition) protected DynamicViewModelfromViewDefinition(DynamicViewDefinition definition) protected @Nullable DynamicViewDescriptorModelfromViewDescriptorDefinition(@Nullable DynamicViewDescriptorDefinition definition) protected booleanprotected booleanprotected @Nullable Class<?> loadClassOrNull(@Nullable String className) protected @Nullable ObjectreadYamlFragment(@Nullable String valueYaml) Serializes a mutable model graph into YAML content.serialize(DynamicModelDefinitionModel model, @Nullable String existingContent) Serializes a mutable model graph into YAML content and replaces themodelsection in existing content.protected Stringprotected @Nullable DynamicAttributeAccessDefinitiontoAttributeAccessDefinition(@Nullable DynamicAttributeResourceRolesModel model) protected DynamicAttributeConstraintDefinitionprotected DynamicAttributeDefinitionprotected @Nullable DynamicValidationDefinition<DynamicAttributeConstraintDefinition> toAttributeValidation(List<DynamicAttributeConstraintModel> constraints) protected @Nullable DynamicCalculatedAttributeDefinitiontoCalculatedAttributeDefinition(@Nullable DynamicCalculatedAttributeModel model) Converts a mutable model graph into an immutable dynamic model definition.protected @Nullable DynamicEntityAccessDefinitiontoEntityAccessDefinition(@Nullable DynamicEntityResourceRolesModel model) protected DynamicEntityConstraintDefinitionprotected DynamicEntityDefinitionprotected @Nullable DynamicValidationDefinition<DynamicEntityConstraintDefinition> toEntityValidation(List<DynamicEntityConstraintModel> constraints) protected DynamicEnumerationDefinitionprotected DynamicEnumerationValueDefinitionprotected @Nullable LocalizedValuetoLocalizedValue(@Nullable DynamicLocalizedValueModel model) protected @Nullable DynamicMenuAccessDefinitiontoMenuAccessDefinition(List<DynamicStringValueModel> roleCodes) protected @Nullable MenuItemDefinitiontoMenuItemDefinition(@Nullable DynamicMenuItemModel model) toMessageMap(List<DynamicLocalizedMessageModel> messages) toNullableObjectMap(List<DynamicKeyValueModel> values) toObjectMap(List<DynamicKeyValueModel> values) toStringList(List<DynamicStringValueModel> values) protected DynamicUniqueConstraintDefinitionprotected @Nullable DynamicViewAccessDefinitiontoViewAccessDefinition(List<DynamicStringValueModel> roleCodes) protected DynamicViewDefinitiontoViewDefinition(DynamicViewModel model) protected @Nullable DynamicViewDescriptorDefinitiontoViewDescriptorDefinition(@Nullable DynamicViewDescriptorModel model) protected StringwriteYamlFragment(@Nullable Object value)
-
Field Details
-
yamlMapper
protected final com.fasterxml.jackson.databind.ObjectMapper yamlMapper -
metadata
-
classManager
-
serializer
-
-
Constructor Details
-
DynamicModelDefinitionModelConverter
public DynamicModelDefinitionModelConverter()
-
-
Method Details
-
deserialize
Deserializes YAML content into a mutable model graph.- Parameters:
content- YAML content compatible withDynamicModelDefinitionSerializer- Returns:
- root Model entity for UI editing
-
serialize
Serializes a mutable model graph into YAML content.- Parameters:
model- root Model entity- Returns:
- YAML content compatible with
DynamicModelDefinitionSerializer
-
serialize
Serializes a mutable model graph into YAML content and replaces themodelsection in existing content.- Parameters:
model- root Model entityexistingContent- existing YAML content, ornull- Returns:
- YAML content compatible with
DynamicModelDefinitionSerializer
-
fromDefinition
Converts an immutable dynamic model definition into a mutable model graph.- Parameters:
definition- dynamic model definition- Returns:
- root Model entity for UI editing
-
toDefinition
Converts a mutable model graph into an immutable dynamic model definition.- Parameters:
model- root Model entity- Returns:
- dynamic model definition
-
fromEnumerationDefinition
protected DynamicEnumerationModel fromEnumerationDefinition(DynamicEnumerationDefinition definition) -
toEnumerationDefinition
-
fromEnumerationValueDefinition
protected DynamicEnumerationValueModel fromEnumerationValueDefinition(DynamicEnumerationValueDefinition definition) -
toEnumerationValueDefinition
protected DynamicEnumerationValueDefinition toEnumerationValueDefinition(DynamicEnumerationValueModel model) -
fromEntityDefinition
-
toEntityDefinition
-
fromAttributeDefinition
-
toAttributeDefinition
-
fromCalculatedAttributeDefinition
protected @Nullable DynamicCalculatedAttributeModel fromCalculatedAttributeDefinition(@Nullable DynamicCalculatedAttributeDefinition definition) -
toCalculatedAttributeDefinition
protected @Nullable DynamicCalculatedAttributeDefinition toCalculatedAttributeDefinition(@Nullable DynamicCalculatedAttributeModel model) -
fromUniqueConstraintDefinition
protected DynamicUniqueConstraintModel fromUniqueConstraintDefinition(DynamicUniqueConstraintDefinition definition) -
toUniqueConstraintDefinition
protected DynamicUniqueConstraintDefinition toUniqueConstraintDefinition(DynamicUniqueConstraintModel model) -
fromViewDefinition
-
toViewDefinition
-
fromMenuItemDefinition
protected @Nullable DynamicMenuItemModel fromMenuItemDefinition(@Nullable MenuItemDefinition definition) -
toMenuItemDefinition
-
fromViewDescriptorDefinition
protected @Nullable DynamicViewDescriptorModel fromViewDescriptorDefinition(@Nullable DynamicViewDescriptorDefinition definition) -
toViewDescriptorDefinition
protected @Nullable DynamicViewDescriptorDefinition toViewDescriptorDefinition(@Nullable DynamicViewDescriptorModel model) -
stripTrailingWhitespacePerLine
-
fromEntityAccessDefinition
protected @Nullable DynamicEntityResourceRolesModel fromEntityAccessDefinition(@Nullable DynamicEntityAccessDefinition definition) -
toEntityAccessDefinition
protected @Nullable DynamicEntityAccessDefinition toEntityAccessDefinition(@Nullable DynamicEntityResourceRolesModel model) -
fromAttributeAccessDefinition
protected @Nullable DynamicAttributeResourceRolesModel fromAttributeAccessDefinition(@Nullable DynamicAttributeAccessDefinition definition) -
toAttributeAccessDefinition
protected @Nullable DynamicAttributeAccessDefinition toAttributeAccessDefinition(@Nullable DynamicAttributeResourceRolesModel model) -
fromViewAccessDefinition
protected List<DynamicStringValueModel> fromViewAccessDefinition(@Nullable DynamicViewAccessDefinition definition) -
toViewAccessDefinition
protected @Nullable DynamicViewAccessDefinition toViewAccessDefinition(List<DynamicStringValueModel> roleCodes) -
fromMenuAccessDefinition
protected List<DynamicStringValueModel> fromMenuAccessDefinition(@Nullable DynamicMenuAccessDefinition definition) -
toMenuAccessDefinition
protected @Nullable DynamicMenuAccessDefinition toMenuAccessDefinition(List<DynamicStringValueModel> roleCodes) -
fromAttributeValidation
protected List<DynamicAttributeConstraintModel> fromAttributeValidation(@Nullable DynamicValidationDefinition<DynamicAttributeConstraintDefinition> validation) -
toAttributeValidation
protected @Nullable DynamicValidationDefinition<DynamicAttributeConstraintDefinition> toAttributeValidation(List<DynamicAttributeConstraintModel> constraints) -
fromAttributeConstraintDefinition
protected DynamicAttributeConstraintModel fromAttributeConstraintDefinition(DynamicAttributeConstraintDefinition definition) -
toAttributeConstraintDefinition
protected DynamicAttributeConstraintDefinition toAttributeConstraintDefinition(DynamicAttributeConstraintModel model) -
fromEntityValidation
protected List<DynamicEntityConstraintModel> fromEntityValidation(@Nullable DynamicValidationDefinition<DynamicEntityConstraintDefinition> validation) -
toEntityValidation
protected @Nullable DynamicValidationDefinition<DynamicEntityConstraintDefinition> toEntityValidation(List<DynamicEntityConstraintModel> constraints) -
fromEntityConstraintDefinition
protected DynamicEntityConstraintModel fromEntityConstraintDefinition(DynamicEntityConstraintDefinition definition) -
toEntityConstraintDefinition
protected DynamicEntityConstraintDefinition toEntityConstraintDefinition(DynamicEntityConstraintModel model) -
fromLocalizedValue
-
toLocalizedValue
-
fromMessageMap
-
toMessageMap
-
fromObjectMap
-
toObjectMap
-
toNullableObjectMap
-
fromStringList
-
toStringList
-
loadClassOrNull
-
writeYamlFragment
-
readYamlFragment
-
create
-
emptyIfNull
-
blankToNull
-
isBlank
-
isTrue
-