Attributes overview

Some useful (utility) classes for managing attributes for different EntityModule objects:

  • EntityAttributes contains a variation of common attribute constants and some static helper methods

  • EntityAttributeRegistrars contains helper registrar factory methods

  • EntityViewFactoryAttributes contains common attribute constants and helper methods, specific for entity views

EntityConfiguration attributes

The following table lists commonly present attributes on an EntityConfiguration.

Key Value

Repository.class

In case of an entity registered through a Spring Data repository.

RepositoryInvoker.class

In case of an entity registered through a Spring Data repository.

RepositoryFactoryInformation.class

In case of an entity registered through a Spring Data repository.

PersistentEntity.class

In case of an entity registered through a Spring Data repository that exposed PersistentEntity information.

EntityQueryExecutor.class

Holds the EntityQueryExecutor that can be used for custom EntityQuery execution and will be used by default for fetching entities. Available if the Repository was supported by one of the default EntityQueryExecutor implementations.

EntityQueryParser.class

Holds the EntityQueryParser that should be used for parsing EQL statements into a valid EntityQuery. Available if the EntityQueryExecutor.class attribute is present.

EntityAttributes.TRANSACTION_MANAGER_NAME

Optionally holds the name of the PlatformTransactionManager that the repository for this entity uses. EntityModule attempts to detect the transaction manager automatically for every Spring Data repository. When set, this will enable transaction management for the default create, update and delete views.

EntityViewLinkBuilder.class

Holds an EntityViewLinkBuilder for the type represented by the EntityConfiguration. Only available when AdminWebModule is present.

OptionGenerator.class

When set on an EntityConfiguration, this will be the default generator used to create the set of options that can be selected for a property that points to the entity configuration. If all you want to configure is the list of possible options, set the OptionIterableBuilder.class attribute instead.

OptionIterableBuilder.class

When set on an EntityConfiguration, this will be the default builder used to create the set of options that can be selected for a property that points to the entity configuration.

EntityAttributes.OPTIONS_ENTITY_QUERY

When set on an EntityConfiguration, contains the EQL statement or EntityQuery that should be used to fetch the selectable options for a property that points to the entity configuration. Will only be used if there is no OptionGenerator.class or OptionIterableBuilder.class attribute set.

EntityPropertyDescriptor attributes

The following table lists commonly present attributes on an EntityPropertyDescriptor.

Key Value

PersistentProperty.class

In case of a property of a PersistentEntity registered through a Spring Data repository.

Sort.Order.class

Contains the default Sort.Order if sorting is enabled on this property. By default strings have an order that ignores case.

EntityAttributes.CONTROL_NAME

Optional: required to be a String value. When present this value will be used as the form control name instead of the descriptor name.

EntityAttributes.NATIVE_PROPERTY_DESCRIPTOR

When present holds the Java beans property descriptor that was used to create the EntityPropertyDescriptor. The presence of this attribute indicates that the property is not artificial but corresponds to an actual Java class property.

OptionGenerator.class

When set on an EntityPropertyDescriptor, this will be the generator used to create the set of options that can be selected for that property. If all you want to configure is the list of possible options, set the OptionIterableBuilder.class attribute instead.

OptionIterableBuilder.class

When set on an EntityPropertyDescriptor, this will be the builder used to create the set of options that can be selected for that property.

EntityAttributes.OPTIONS_ENTITY_QUERY

When set on an EntityPropertyDescriptor, contains the EQL statement or EntityQuery thWill only be used if there is no OptionGenerator.class or OptionIterableBuilder.class attribute set.at should be used to fetch the selectable options for that property.

EntityAttributes.OPTIONS_ALLOWED_VALUES

Only applicable if the property is of an enum type. When set, the attribute holds the EnumSet of selectable values. If you want to customize selection of a non-enum type, see the other option related attributes. Will only be used if there is no OptionGenerator.class or OptionIterableBuilder.class attribute set.

SelectFormElementConfiguration.class

Can hold the configuration instance that should be used when generating a select control for this propery. Unless a specific ViewElement type has been specified, this will force the control type generated to be a select as well.

EntityAttributes.PROPERTY_REQUIRED

Should be a Boolean value that sets if a control for this property should be marked as required or not.

EntityAttributes.FORM_ENCTYPE

The enctype that should be used on a HTML form when a control for this property is present.

EntityPropertyRegistry.class

If set, holds the EntityPropertyRegistry that should be used for resolving nested properties. If not set, the property type will be used to resolve a target EntityPropertyRegistry.

EntityViewFactory attributes

The following table lists commonly present attributes on an EntityViewFactory.

Key Value

EntityViewRegistry.class

The registry the view belongs to, either the EntityConfiguration or EntityAssociation instance.

AllowableAction.class

If present, holds the AllowableAction that is required for accessing this view.

PersistentEntity.class

In case of an entity registered through a Spring Data repository that exposed PersistentEntity information.

EntityViewFactoryAttributes.VIEW_NAME

Name of the view under which it is registered in the EntityViewRegistry.

EntityViewFactoryAttributes.ADMIN_MENU

Optionally contains a Consumer<EntityAdminMenuEvent> for creating a menu item for that view. See EntityAttributeRegistrars.adminMenu() variations for helper factory methods.

EntityViewFactoryAttributes.ACCESS_VALIDATOR

Optionally contains a BiConsumer<EntityViewFactory, EntityViewContext> that should be used to verify access to the view. Usually the default EntityViewFactoryAttributes.defaultAccessValidator() is set, which inspects the AllowableAction.class attribute.

EntityAttributes.FORM_ENCTYPE

The enctype that should be used on the HTML form rendere by this view.