Package io.jmix.dynmodel.meta
Class DynamicModelDefinitions
java.lang.Object
io.jmix.dynmodel.meta.DynamicModelDefinitions
Static utility methods for creating dynamic model definitions.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final class -
Method Summary
Modifier and TypeMethodDescriptionattributeConstraint(String annotation) Creates an attribute constraint definition without parameters or groups.attributeValidation(DynamicAttributeConstraintDefinition... constraints) Creates an attribute validation definition.static DynamicAttributeDefinitionstatic DynamicAttributeDefinitioncalculatedAttr(String name, Class<?> javaClass, String expression, String... dependsOn) static DynamicAttributeDefinitioncollectionAttr(String name, String entityName) descriptor(@Nullable String template, @Nullable String source) static DynamicEntityDefinitionentity(String entityName, DynamicAttributeDefinition... attributes) static DynamicEntityDefinitionentity(String entityName, List<DynamicAttributeDefinition> attributes) static DynamicEntityDefinitionentity(String entityName, List<DynamicAttributeDefinition> attributes, @Nullable Map<String, String> messages) static DynamicEntityDefinitionentity(String entityName, List<DynamicAttributeDefinition> attributes, List<DynamicUniqueConstraintDefinition> uniqueConstraints, List<DynamicViewDefinition> views, @Nullable DynamicValidationDefinition<DynamicEntityConstraintDefinition> validation, @Nullable Map<String, String> messages) Creates a dynamic entity definition with unique and validation metadata.static DynamicEntityDefinitionentity(String entityName, List<DynamicAttributeDefinition> attributes, List<DynamicUniqueConstraintDefinition> uniqueConstraints, List<DynamicViewDefinition> views, @Nullable Map<String, String> messages) Creates a dynamic entity definition with unique constraints.static DynamicEntityDefinitionentity(String entityName, List<DynamicAttributeDefinition> attributes, List<DynamicViewDefinition> views) static DynamicEntityDefinitionentity(String entityName, List<DynamicAttributeDefinition> attributes, List<DynamicViewDefinition> views, @Nullable DynamicValidationDefinition<DynamicEntityConstraintDefinition> validation, @Nullable Map<String, String> messages) Creates a dynamic entity definition with validation metadata.static DynamicEntityDefinitionentity(String entityName, List<DynamicAttributeDefinition> attributes, List<DynamicViewDefinition> views, @Nullable Map<String, String> messages) static DynamicEntityDefinitionentityInStore(String entityName, String store, DynamicAttributeDefinition... attributes) entityValidation(DynamicEntityConstraintDefinition... constraints) Creates an entity validation definition.static DynamicEntityDefinitionentityWithViews(String entityName, DynamicViewDefinition... views) static DynamicAttributeDefinitionexpressionConstraint(String name, String expression, String... attributes) Creates an entity expression constraint definition.listView()static LocalizedValuestatic LocalizedValuestatic MenuItemDefinitionstatic MenuItemDefinitionmenu(String parentMenu, LocalizedValue title) static MenuItemDefinitionmenu(String parentMenu, LocalizedValue title, @Nullable DynamicMenuAccessDefinition resourceRoles) Creates a dynamic menu item definition with resource-role grants.static DynamicMenuAccessDefinitionmenuResourceRoles(List<String> roleCodes) Creates dynamic menu resource-role grants.static DynamicModelDefinitionmodel(String basePackage, DynamicEntityDefinition... entities) static DynamicModelDefinitionmodel(String basePackage, List<DynamicEntityDefinition> entities) static DynamicModelDefinitionmodel(String basePackage, List<DynamicEnumerationDefinition> enumerations, List<DynamicEntityDefinition> entities) static DynamicAttributeDefinitionstatic DynamicViewAccessDefinitionresourceRoles(List<String> roleCodes) Creates dynamic view resource-role grants.resourceRoles(List<String> view, List<String> modify) Creates dynamic attribute resource-role grants.Creates dynamic entity resource-role grants.static DynamicAttributeDefinitionstringAttr(String name, int length) static DynamicAttributeDefinitionstringLobAttr(String name) uniqueConstraint(String name, LocalizedValue message, String... attributes) Creates a unique constraint definition.uniqueConstraint(String name, String... attributes) Creates a unique constraint definition without a custom message.view(@Nullable DynamicViewType type)
-
Method Details
-
model
-
model
public static DynamicModelDefinition model(String basePackage, List<DynamicEntityDefinition> entities) -
model
public static DynamicModelDefinition model(String basePackage, List<DynamicEnumerationDefinition> enumerations, List<DynamicEntityDefinition> entities) -
entity
public static DynamicEntityDefinition entity(String entityName, DynamicAttributeDefinition... attributes) -
entity
public static DynamicEntityDefinition entity(String entityName, List<DynamicAttributeDefinition> attributes) -
entity
public static DynamicEntityDefinition entity(String entityName, List<DynamicAttributeDefinition> attributes, List<DynamicViewDefinition> views) -
entity
public static DynamicEntityDefinition entity(String entityName, List<DynamicAttributeDefinition> attributes, List<DynamicViewDefinition> views, @Nullable Map<String, String> messages) -
entity
public static DynamicEntityDefinition entity(String entityName, List<DynamicAttributeDefinition> attributes, List<DynamicUniqueConstraintDefinition> uniqueConstraints, List<DynamicViewDefinition> views, @Nullable Map<String, String> messages) Creates a dynamic entity definition with unique constraints.- Parameters:
entityName- entity nameattributes- entity attributesuniqueConstraints- entity unique constraintsviews- entity-owned dynamic viewsmessages- localized entity captions- Returns:
- dynamic entity definition
-
entity
public static DynamicEntityDefinition entity(String entityName, List<DynamicAttributeDefinition> attributes, List<DynamicViewDefinition> views, @Nullable DynamicValidationDefinition<DynamicEntityConstraintDefinition> validation, @Nullable Map<String, String> messages) Creates a dynamic entity definition with validation metadata.- Parameters:
entityName- entity nameattributes- entity attributesviews- entity-owned dynamic viewsvalidation- entity validation definitionmessages- localized entity captions- Returns:
- dynamic entity definition
-
entity
public static DynamicEntityDefinition entity(String entityName, List<DynamicAttributeDefinition> attributes, List<DynamicUniqueConstraintDefinition> uniqueConstraints, List<DynamicViewDefinition> views, @Nullable DynamicValidationDefinition<DynamicEntityConstraintDefinition> validation, @Nullable Map<String, String> messages) Creates a dynamic entity definition with unique and validation metadata.- Parameters:
entityName- entity nameattributes- entity attributesuniqueConstraints- entity unique constraintsviews- entity-owned dynamic viewsvalidation- entity validation definitionmessages- localized entity captions- Returns:
- dynamic entity definition
-
entity
public static DynamicEntityDefinition entity(String entityName, List<DynamicAttributeDefinition> attributes, @Nullable Map<String, String> messages) -
entityWithViews
public static DynamicEntityDefinition entityWithViews(String entityName, DynamicViewDefinition... views) -
entityInStore
public static DynamicEntityDefinition entityInStore(String entityName, String store, DynamicAttributeDefinition... attributes) -
localized
-
localized
-
descriptor
public static DynamicViewDescriptorDefinition descriptor(@Nullable String template, @Nullable String source) -
basicAttr
-
stringAttr
-
stringLobAttr
-
refAttr
-
collectionAttr
-
enumAttr
-
calculatedAttr
public static DynamicAttributeDefinition calculatedAttr(String name, Class<?> javaClass, String expression, String... dependsOn) -
resourceRoles
public static DynamicEntityAccessDefinition resourceRoles(List<String> read, List<String> create, List<String> update, List<String> delete) Creates dynamic entity resource-role grants.- Parameters:
read- role codes that can read the entitycreate- role codes that can create the entityupdate- role codes that can update the entitydelete- role codes that can delete the entity- Returns:
- entity access definition
-
resourceRoles
public static DynamicAttributeAccessDefinition resourceRoles(List<String> view, List<String> modify) Creates dynamic attribute resource-role grants.- Parameters:
view- role codes that can view the attributemodify- role codes that can modify the attribute- Returns:
- attribute access definition
-
resourceRoles
Creates dynamic view resource-role grants.- Parameters:
roleCodes- role codes that can open the view- Returns:
- view access definition
-
attribute
-
attributeValidation
@SafeVarargs public static DynamicValidationDefinition<DynamicAttributeConstraintDefinition> attributeValidation(DynamicAttributeConstraintDefinition... constraints) Creates an attribute validation definition.- Parameters:
constraints- attribute constraints- Returns:
- validation definition
-
entityValidation
@SafeVarargs public static DynamicValidationDefinition<DynamicEntityConstraintDefinition> entityValidation(DynamicEntityConstraintDefinition... constraints) Creates an entity validation definition.- Parameters:
constraints- entity constraints- Returns:
- validation definition
-
attributeConstraint
Creates an attribute constraint definition without parameters or groups.- Parameters:
annotation- constraint annotation alias- Returns:
- attribute constraint definition
-
expressionConstraint
public static DynamicEntityConstraintDefinition expressionConstraint(String name, String expression, String... attributes) Creates an entity expression constraint definition.- Parameters:
name- constraint nameexpression- validation expressionattributes- attributes participating in validation- Returns:
- entity constraint definition
-
uniqueConstraint
Creates a unique constraint definition without a custom message.- Parameters:
name- constraint nameattributes- participating attribute names- Returns:
- unique constraint definition
-
uniqueConstraint
public static DynamicUniqueConstraintDefinition uniqueConstraint(String name, LocalizedValue message, String... attributes) Creates a unique constraint definition.- Parameters:
name- constraint namemessage- violation messageattributes- participating attribute names- Returns:
- unique constraint definition
-
view
-
listView
-
detailView
-