Class EntityAssociationBuilder
java.lang.Object
com.foreach.across.modules.entity.config.builders.AbstractWritableAttributesBuilder<T>
com.foreach.across.modules.entity.config.builders.AbstractWritableAttributesAndViewsBuilder<EntityAssociation>
com.foreach.across.modules.entity.config.builders.EntityAssociationBuilder
@Component
@Scope("prototype")
public class EntityAssociationBuilder
extends AbstractWritableAttributesAndViewsBuilder<EntityAssociation>
Builder for managing a specific
EntityAssociation
on a EntityConfiguration
.- Since:
- 1.1.1
- Author:
- Arne Vandamme
-
Constructor Summary
ConstructorDescriptionEntityAssociationBuilder
(org.springframework.beans.factory.config.AutowireCapableBeanFactory beanFactory) -
Method Summary
Modifier and TypeMethodDescriptionall()
Target all associations for the current entity.and
(@NonNull Consumer<EntityAssociationBuilder> consumer) Apply an additional consumer to this builder.assignableTo
(@NonNull Class<?> assignableType) Target all associations for this type.associationType
(EntityAssociation.Type associationType) Specify the type of association.attribute
(AttributeRegistrar<EntityAssociation> attributeRegistrar) Add an attribute registrar for one or more attributes that should be added.Add a custom attribute this builder should add to the entity.Add a custom attribute this builder should add to the entity.autoHide()
Ensures the configuration will be labeled as hidden for UI implementations if any of its participating configurations is hidden.Configure a default create form view builder for the entity being configured.createFormView
(Consumer<EntityViewFactoryBuilder> consumer) Configure the create form view builder for the entity being configured.Configure the form view builder for the default create and update forms of the entity being configured.protected <U extends EntityViewFactoryBuilder>
UcreateViewFactoryBuilder
(Class<U> builderType) Configure a default delete view builder for the entity being configured.deleteFormView
(Consumer<EntityViewFactoryBuilder> consumer) Configure the default delete form view builder for the entity being configured.Configure a default detail view builder for the entity being configured.detailView
(Consumer<EntityViewFactoryBuilder> consumer) Configure the default detail view builder for the entity being configured.formView
(String viewName, Consumer<EntityViewFactoryBuilder> consumer) Configure the named form view builder for the entity being configured.Should theEntityAssociation
be hidden from UI implementations.hide()
Ensures the association will be labeled as hidden for UI implementations.protected <U extends EntityViewFactoryBuilder>
voidinitializeViewFactoryBuilder
(String viewName, String templateName, U builder) listView()
Configure a default list view builder for the entity being configured.listView
(String viewName, Consumer<EntityListViewFactoryBuilder> consumer) Returns the named list view builder for the entity being configured.listView
(Consumer<EntityListViewFactoryBuilder> consumer) Configure the default list view builder for the entity being configured.Specify the name of the association that this builder is responsible for.parentDeleteMode
(EntityAssociation.ParentDeleteMode parentDeleteMode) Set the UI behaviour in case the parent entity is being deleted but there are associations.static void
Remove the property on the source end.Remove the property on the target end.show()
Ensures the association will not be labeled as hidden for UI implementations.sourceProperty
(@NonNull String sourceProperty) Set the name of the property on the source end.targetEntity
(@NonNull String entityName) Set the name of the target entity for this association.targetEntityType
(@NonNull Class<?> targetEntityType) Set the target entity type for this association.targetProperty
(@NonNull String targetProperty) Set the name of the property on the target end.Configure a default update form view builder for the entity being configured.updateFormView
(Consumer<EntityViewFactoryBuilder> consumer) Configure the default update form view builder for the entity being configured.view
(String viewName, Consumer<EntityViewFactoryBuilder> consumer) Configure the named simple view builder for the entity being configured.Target all associations for this type.Methods inherited from class com.foreach.across.modules.entity.config.builders.AbstractWritableAttributesAndViewsBuilder
applyViews
Methods inherited from class com.foreach.across.modules.entity.config.builders.AbstractWritableAttributesBuilder
applyAttributes, getAttributes
-
Constructor Details
-
EntityAssociationBuilder
@Autowired public EntityAssociationBuilder(org.springframework.beans.factory.config.AutowireCapableBeanFactory beanFactory)
-
-
Method Details
-
name
Specify the name of the association that this builder is responsible for.- Parameters:
name
- of the association- Returns:
- current builder
-
all
Target all associations for the current entity.This is equivalent to using
name("*")
. -
withType
Target all associations for this type.This is equivalent to using
name("*")
. -
assignableTo
Target all associations for this type.This is equivalent to using
name("*")
. -
associationType
Specify the type of association. This will determine how the associated entities can be managed.- Parameters:
associationType
- of the association- Returns:
- current builder
-
targetEntityType
Set the target entity type for this association. This type must be registered in theEntityRegistry
.- Parameters:
targetEntityType
- type of the target entity- Returns:
- current builder
-
targetEntity
Set the name of the target entity for this association. The entity must be registered in theEntityRegistry
present in theBeanFactory
provided. This property takes precedence overtargetEntityType(Class)
.- Parameters:
entityName
- name of the target entity- Returns:
- current builder
-
sourceProperty
Set the name of the property on the source end. The property should be found in the correspondingEntityPropertyRegistry
of the sourceEntityConfiguration
. Should not be null. If you want to remove the source property explicitly, useremoveSourceProperty()
.- Parameters:
sourceProperty
- name, not null- Returns:
- current builder
-
removeSourceProperty
Remove the property on the source end. This implies that the association is entirely determined by the target entity linking back to the source entity.- Returns:
- current builder
-
targetProperty
Set the name of the property on the target end. The property should be found in the correspondingEntityPropertyRegistry
of the targetEntityConfiguration
. Should not be null. If you want to remove the target property explicitly, useremoveTargetProperty()
.- Parameters:
targetProperty
- name, not null- Returns:
- current builder
-
removeTargetProperty
Remove the property on the target end. This implies that the association is entirely determined by the source entity linking to the target entity, without a back link.- Returns:
- current builder
-
show
Ensures the association will not be labeled as hidden for UI implementations.- Returns:
- current builder
-
hide
Ensures the association will be labeled as hidden for UI implementations.- Returns:
- current builder
-
autoHide
Ensures the configuration will be labeled as hidden for UI implementations if any of its participating configurations is hidden. This is the default behavior if the property is not specified explicitly on the association.- Returns:
- current builder
-
parentDeleteMode
public EntityAssociationBuilder parentDeleteMode(EntityAssociation.ParentDeleteMode parentDeleteMode) Set the UI behaviour in case the parent entity is being deleted but there are associations.- Parameters:
parentDeleteMode
- to use- Returns:
- current builder
- See Also:
-
listView
Description copied from class:AbstractWritableAttributesAndViewsBuilder
Configure the default list view builder for the entity being configured. A default list view is usually available.- Overrides:
listView
in classAbstractWritableAttributesAndViewsBuilder<EntityAssociation>
- Parameters:
consumer
- for configuring the view builder- Returns:
- current builder
-
listView
public EntityAssociationBuilder listView(String viewName, Consumer<EntityListViewFactoryBuilder> consumer) Description copied from class:AbstractWritableAttributesAndViewsBuilder
Returns the named list view builder for the entity being configured. If the view is not available, it will be created.- Overrides:
listView
in classAbstractWritableAttributesAndViewsBuilder<EntityAssociation>
- Parameters:
viewName
- name of the viewconsumer
- for configuring the view builder- Returns:
- builder instance
-
createOrUpdateFormView
Description copied from class:AbstractWritableAttributesAndViewsBuilder
Configure the form view builder for the default create and update forms of the entity being configured. Create and update forms are usually available.- Overrides:
createOrUpdateFormView
in classAbstractWritableAttributesAndViewsBuilder<EntityAssociation>
- Parameters:
consumer
- for configuring the view builder- Returns:
- current builder
-
createFormView
Description copied from class:AbstractWritableAttributesAndViewsBuilder
Configure the create form view builder for the entity being configured. A default create form view is usually available.- Overrides:
createFormView
in classAbstractWritableAttributesAndViewsBuilder<EntityAssociation>
- Parameters:
consumer
- for configuring the view builder- Returns:
- current builder
-
updateFormView
Description copied from class:AbstractWritableAttributesAndViewsBuilder
Configure the default update form view builder for the entity being configured. A default update form view is usually available.- Overrides:
updateFormView
in classAbstractWritableAttributesAndViewsBuilder<EntityAssociation>
- Parameters:
consumer
- for configuring the view builder- Returns:
- current builder
-
deleteFormView
Description copied from class:AbstractWritableAttributesAndViewsBuilder
Configure the default delete form view builder for the entity being configured. A default delete form view is usually available.- Overrides:
deleteFormView
in classAbstractWritableAttributesAndViewsBuilder<EntityAssociation>
- Parameters:
consumer
- for configuring the view builder- Returns:
- current builder
-
detailView
Description copied from class:AbstractWritableAttributesAndViewsBuilder
Configure the default detail view builder for the entity being configured. A default detail view is usually available.- Overrides:
detailView
in classAbstractWritableAttributesAndViewsBuilder<EntityAssociation>
- Parameters:
consumer
- for configuring the view builder- Returns:
- current builder
-
formView
public EntityAssociationBuilder formView(String viewName, Consumer<EntityViewFactoryBuilder> consumer) Description copied from class:AbstractWritableAttributesAndViewsBuilder
Configure the named form view builder for the entity being configured. If the view is not available, it will be created.- Overrides:
formView
in classAbstractWritableAttributesAndViewsBuilder<EntityAssociation>
- Parameters:
viewName
- name of the viewconsumer
- for configuring the view builder- Returns:
- current builder
-
view
Description copied from class:AbstractWritableAttributesAndViewsBuilder
Configure the named simple view builder for the entity being configured. If the view is not available, it will be created.- Overrides:
view
in classAbstractWritableAttributesAndViewsBuilder<EntityAssociation>
- Parameters:
viewName
- name of the viewconsumer
- for configuring the view builder- Returns:
- current builder
-
listView
Description copied from class:AbstractWritableAttributesAndViewsBuilder
Configure a default list view builder for the entity being configured. Does not customize the builder but ensures the view gets created using the default builder.- Overrides:
listView
in classAbstractWritableAttributesAndViewsBuilder<EntityAssociation>
- Returns:
- current builder
-
createFormView
Description copied from class:AbstractWritableAttributesAndViewsBuilder
Configure a default create form view builder for the entity being configured. Does not customize the builder but ensures the view gets created using the default builder.- Overrides:
createFormView
in classAbstractWritableAttributesAndViewsBuilder<EntityAssociation>
- Returns:
- current builder
-
updateFormView
Description copied from class:AbstractWritableAttributesAndViewsBuilder
Configure a default update form view builder for the entity being configured. Does not customize the builder but ensures the view gets created using the default builder.- Overrides:
updateFormView
in classAbstractWritableAttributesAndViewsBuilder<EntityAssociation>
- Returns:
- current builder
-
deleteFormView
Description copied from class:AbstractWritableAttributesAndViewsBuilder
Configure a default delete view builder for the entity being configured. Does not customize the builder but ensures the view gets created using the default builder.- Overrides:
deleteFormView
in classAbstractWritableAttributesAndViewsBuilder<EntityAssociation>
- Returns:
- current builder
-
detailView
Description copied from class:AbstractWritableAttributesAndViewsBuilder
Configure a default detail view builder for the entity being configured. Does not customize the builder but ensures the view gets created using the default builder.- Overrides:
detailView
in classAbstractWritableAttributesAndViewsBuilder<EntityAssociation>
- Returns:
- current builder
-
attribute
Description copied from class:AbstractWritableAttributesBuilder
Add a custom attribute this builder should add to the entity.- Overrides:
attribute
in classAbstractWritableAttributesBuilder<EntityAssociation>
- Parameters:
name
- Name of the attribute.value
- Value of the attribute.- Returns:
- current builder
-
attribute
Description copied from class:AbstractWritableAttributesBuilder
Add a custom attribute this builder should add to the entity.- Overrides:
attribute
in classAbstractWritableAttributesBuilder<EntityAssociation>
- Type Parameters:
S
- Class that is both key and value type of the attribute- Parameters:
type
- Type of the attribute.value
- Value of the attribute.- Returns:
- current builder
-
attribute
Description copied from class:AbstractWritableAttributesBuilder
Add an attribute registrar for one or more attributes that should be added. Provides a mechanism to get the owner (eg.EntityConfiguration
...) to be made accessible to the attribute values.- Overrides:
attribute
in classAbstractWritableAttributesBuilder<EntityAssociation>
- Parameters:
attributeRegistrar
- registrar- Returns:
- current builder
-
and
Apply an additional consumer to this builder.- Parameters:
consumer
- to apply- Returns:
- current builder
-
createViewFactoryBuilder
- Specified by:
createViewFactoryBuilder
in classAbstractWritableAttributesAndViewsBuilder<EntityAssociation>
-
initializeViewFactoryBuilder
protected <U extends EntityViewFactoryBuilder> void initializeViewFactoryBuilder(String viewName, String templateName, U builder) - Specified by:
initializeViewFactoryBuilder
in classAbstractWritableAttributesAndViewsBuilder<EntityAssociation>
-
registerAssociationMessageCodeResolver
-