Class EntityConfigurationImpl<T>
java.lang.Object
com.foreach.across.core.support.AttributeSupport
com.foreach.across.modules.entity.registry.EntityConfigurationImpl<T>
- All Implemented Interfaces:
com.foreach.across.core.support.ReadableAttributes
,com.foreach.across.core.support.WritableAttributes
,ConfigurableEntityViewRegistry
,EntityConfiguration<T>
,EntityViewRegistry
,MutableEntityConfiguration<T>
,org.springframework.core.AttributeAccessor
public class EntityConfigurationImpl<T>
extends com.foreach.across.core.support.AttributeSupport
implements MutableEntityConfiguration<T>
The base configuration for an Entity type. Provides access to the
EntityModel
,
EntityPropertyRegistry
along with the registered views and attributes.- Since:
- 1.0.0
- Author:
- Arne Vandamme
-
Constructor Summary
ConstructorDescriptionEntityConfigurationImpl
(@NonNull String name, @NonNull Class<? extends T> entityType) EntityConfigurationImpl
(Class<T> entityType) -
Method Summary
Modifier and TypeMethodDescriptionassociation
(String name) Retrieve a named association as aMutableEntityAssociation
.createAssociation
(String name) Register a new association with a specific name.com.foreach.across.modules.spring.security.actions.AllowableActions
com.foreach.across.modules.spring.security.actions.AllowableActions
getAllowableActions
(T entity) Shortcut toEntityInformation.getId(Object)
.Class<?>
Shortcut toEntityInformation.getIdType()
}.Shortcut toEntityModel.getLabel(Object)
.getName()
Get the property registry as aMutableEntityPropertyRegistry
.<Y extends EntityViewFactory>
YgetViewFactory
(String viewName) String[]
boolean
boolean
boolean
isHidden()
boolean
Shortcut toEntityInformation.isNew(Object)
.void
registerView
(@NonNull String viewName, @NonNull EntityViewFactory viewFactory) void
removeView
(String viewName) Remove a view from the registry.void
setAllowableActionsBuilder
(@NonNull EntityConfigurationAllowableActionsBuilder allowableActionsBuilder) Set the builder for theAllowableActions
of this entity configuration.void
setDisplayName
(String displayName) Set the default display name for this entity type.void
setEntityMessageCodeResolver
(@NonNull EntityMessageCodeResolver entityMessageCodeResolver) Set the message code resolver.void
setEntityModel
(EntityModel<T, Serializable> entityModel) Set theEntityModel
for interacting with the entity repository.void
setHidden
(boolean hidden) Should this configuration be shown in UI implementations?void
setPropertyRegistry
(@NonNull MutableEntityPropertyRegistry propertyRegistry) Set the property registry for this configuration.toString()
Methods inherited from class com.foreach.across.core.support.AttributeSupport
attributeMap, attributeNames, getAttribute, getAttribute, getAttribute, hasAttribute, hasAttribute, removeAttribute, removeAttribute, setAttribute, setAttribute, setAttributes
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.core.AttributeAccessor
attributeNames, computeAttribute, getAttribute, hasAttribute, removeAttribute, setAttribute
Methods inherited from interface com.foreach.across.core.support.ReadableAttributes
attributeMap, attributeNames, getAttribute, getAttribute, getAttribute, hasAttribute, hasAttribute
Methods inherited from interface com.foreach.across.core.support.WritableAttributes
removeAttribute, setAttribute, setAttributes
-
Constructor Details
-
EntityConfigurationImpl
-
EntityConfigurationImpl
-
-
Method Details
-
getEntityModel
- Specified by:
getEntityModel
in interfaceEntityConfiguration<T>
- Returns:
- basic model for performing entity operations
-
hasEntityModel
public boolean hasEntityModel()- Specified by:
hasEntityModel
in interfaceEntityConfiguration<T>
- Returns:
- true if this configuration actually has an entity model configured
-
setEntityModel
Description copied from interface:MutableEntityConfiguration
Set theEntityModel
for interacting with the entity repository. Required for auto-generated administration UI.- Specified by:
setEntityModel
in interfaceMutableEntityConfiguration<T>
- Parameters:
entityModel
- instance
-
getEntityType
- Specified by:
getEntityType
in interfaceEntityConfiguration<T>
- Returns:
- simple class that instances of this entity are.
-
getName
- Specified by:
getName
in interfaceEntityConfiguration<T>
- Returns:
- unique name for this configuration
-
getDisplayName
- Specified by:
getDisplayName
in interfaceEntityConfiguration<T>
- Returns:
- default display name to use in the UI
- See Also:
-
setDisplayName
Description copied from interface:MutableEntityConfiguration
Set the default display name for this entity type.- Specified by:
setDisplayName
in interfaceMutableEntityConfiguration<T>
- Parameters:
displayName
- value
-
isHidden
public boolean isHidden()- Specified by:
isHidden
in interfaceEntityConfiguration<T>
- Returns:
- true if this configuration should not be displayed in UI implementations
-
setHidden
public void setHidden(boolean hidden) Description copied from interface:MutableEntityConfiguration
Should this configuration be shown in UI implementations?- Specified by:
setHidden
in interfaceMutableEntityConfiguration<T>
- Parameters:
hidden
- true if this configuration should not be shown in UI implementations
-
hasView
- Specified by:
hasView
in interfaceEntityViewRegistry
-
registerView
public void registerView(@NonNull @NonNull String viewName, @NonNull @NonNull EntityViewFactory viewFactory) - Specified by:
registerView
in interfaceConfigurableEntityViewRegistry
-
removeView
Description copied from interface:ConfigurableEntityViewRegistry
Remove a view from the registry.- Specified by:
removeView
in interfaceConfigurableEntityViewRegistry
- Parameters:
viewName
- name of the view
-
getViewFactory
- Specified by:
getViewFactory
in interfaceEntityViewRegistry
-
getViewNames
- Specified by:
getViewNames
in interfaceEntityViewRegistry
-
getPropertyRegistry
Description copied from interface:MutableEntityConfiguration
Get the property registry as aMutableEntityPropertyRegistry
.- Specified by:
getPropertyRegistry
in interfaceEntityConfiguration<T>
- Specified by:
getPropertyRegistry
in interfaceMutableEntityConfiguration<T>
- Returns:
- mutable instance of the property registry
-
setPropertyRegistry
Description copied from interface:MutableEntityConfiguration
Set the property registry for this configuration.- Specified by:
setPropertyRegistry
in interfaceMutableEntityConfiguration<T>
- Parameters:
propertyRegistry
- instancce
-
getEntityMessageCodeResolver
- Specified by:
getEntityMessageCodeResolver
in interfaceEntityConfiguration<T>
- Returns:
- message code resolver to use for resolving messages in the context of this entity type
-
setEntityMessageCodeResolver
public void setEntityMessageCodeResolver(@NonNull @NonNull EntityMessageCodeResolver entityMessageCodeResolver) Description copied from interface:MutableEntityConfiguration
Set the message code resolver.- Specified by:
setEntityMessageCodeResolver
in interfaceMutableEntityConfiguration<T>
- Parameters:
entityMessageCodeResolver
- instance
-
isNew
Description copied from interface:EntityConfiguration
Shortcut toEntityInformation.isNew(Object)
.- Specified by:
isNew
in interfaceEntityConfiguration<T>
- Parameters:
entity
- instance- Returns:
- true if new (unsaved) entity instance
-
getIdType
Description copied from interface:EntityConfiguration
Shortcut toEntityInformation.getIdType()
}.- Specified by:
getIdType
in interfaceEntityConfiguration<T>
- Returns:
- type of the id parameter of this entity (can be null)
-
getId
Description copied from interface:EntityConfiguration
Shortcut toEntityInformation.getId(Object)
.- Specified by:
getId
in interfaceEntityConfiguration<T>
- Parameters:
entity
- instance- Returns:
- id value of the entity
-
getLabel
Description copied from interface:EntityConfiguration
Shortcut toEntityModel.getLabel(Object)
.- Specified by:
getLabel
in interfaceEntityConfiguration<T>
- Parameters:
entity
- instance- Returns:
- label valud of the entity
-
getAssociations
- Specified by:
getAssociations
in interfaceEntityConfiguration<T>
- Returns:
- list of associations this entity has to others
-
createAssociation
Description copied from interface:MutableEntityConfiguration
Register a new association with a specific name. Should return any already existing association with that name.- Specified by:
createAssociation
in interfaceMutableEntityConfiguration<T>
- Parameters:
name
- of the association- Returns:
- mutable instance of the association
-
association
Description copied from interface:MutableEntityConfiguration
Retrieve a named association as aMutableEntityAssociation
.- Specified by:
association
in interfaceEntityConfiguration<T>
- Specified by:
association
in interfaceMutableEntityConfiguration<T>
- Parameters:
name
- of the association- Returns:
- mutable instance of the association (or null if non existing)
-
getAllowableActionsBuilder
- Specified by:
getAllowableActionsBuilder
in interfaceMutableEntityConfiguration<T>
- Returns:
- the allowable actions builder instance
-
setAllowableActionsBuilder
public void setAllowableActionsBuilder(@NonNull @NonNull EntityConfigurationAllowableActionsBuilder allowableActionsBuilder) Description copied from interface:MutableEntityConfiguration
Set the builder for theAllowableActions
of this entity configuration.- Specified by:
setAllowableActionsBuilder
in interfaceMutableEntityConfiguration<T>
- Parameters:
allowableActionsBuilder
- instance
-
getAllowableActions
public com.foreach.across.modules.spring.security.actions.AllowableActions getAllowableActions()- Specified by:
getAllowableActions
in interfaceEntityConfiguration<T>
- Returns:
- the set of actions allowed on all entities of this EntityConfiguration
-
getAllowableActions
public com.foreach.across.modules.spring.security.actions.AllowableActions getAllowableActions(T entity) - Specified by:
getAllowableActions
in interfaceEntityConfiguration<T>
- Parameters:
entity
- for which to fetch the allowed actions- Returns:
- the set of actions allowed on the specific entity
-
toString
-