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
ConstructorsConstructorDescriptionEntityConfigurationImpl(@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.AllowableActionscom.foreach.across.modules.spring.security.actions.AllowableActionsgetAllowableActions(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[]booleanbooleanbooleanisHidden()booleanShortcut toEntityInformation.isNew(Object).voidregisterView(@NonNull String viewName, @NonNull EntityViewFactory viewFactory) voidremoveView(String viewName) Remove a view from the registry.voidsetAllowableActionsBuilder(@NonNull EntityConfigurationAllowableActionsBuilder allowableActionsBuilder) Set the builder for theAllowableActionsof this entity configuration.voidsetDisplayName(String displayName) Set the default display name for this entity type.voidsetEntityMessageCodeResolver(@NonNull EntityMessageCodeResolver entityMessageCodeResolver) Set the message code resolver.voidsetEntityModel(EntityModel<T, Serializable> entityModel) Set theEntityModelfor interacting with the entity repository.voidsetHidden(boolean hidden) Should this configuration be shown in UI implementations?voidsetPropertyRegistry(@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, setAttributesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.core.AttributeAccessor
attributeNames, computeAttribute, getAttribute, hasAttribute, removeAttribute, setAttributeMethods inherited from interface com.foreach.across.core.support.ReadableAttributes
attributeMap, attributeNames, getAttribute, getAttribute, getAttribute, hasAttribute, hasAttributeMethods inherited from interface com.foreach.across.core.support.WritableAttributes
removeAttribute, setAttribute, setAttributes
-
Constructor Details
-
EntityConfigurationImpl
-
EntityConfigurationImpl
-
-
Method Details
-
getEntityModel
- Specified by:
getEntityModelin interfaceEntityConfiguration<T>- Returns:
- basic model for performing entity operations
-
hasEntityModel
public boolean hasEntityModel()- Specified by:
hasEntityModelin interfaceEntityConfiguration<T>- Returns:
- true if this configuration actually has an entity model configured
-
setEntityModel
Description copied from interface:MutableEntityConfigurationSet theEntityModelfor interacting with the entity repository. Required for auto-generated administration UI.- Specified by:
setEntityModelin interfaceMutableEntityConfiguration<T>- Parameters:
entityModel- instance
-
getEntityType
- Specified by:
getEntityTypein interfaceEntityConfiguration<T>- Returns:
- simple class that instances of this entity are.
-
getName
- Specified by:
getNamein interfaceEntityConfiguration<T>- Returns:
- unique name for this configuration
-
getDisplayName
- Specified by:
getDisplayNamein interfaceEntityConfiguration<T>- Returns:
- default display name to use in the UI
- See Also:
-
setDisplayName
Description copied from interface:MutableEntityConfigurationSet the default display name for this entity type.- Specified by:
setDisplayNamein interfaceMutableEntityConfiguration<T>- Parameters:
displayName- value
-
isHidden
public boolean isHidden()- Specified by:
isHiddenin interfaceEntityConfiguration<T>- Returns:
- true if this configuration should not be displayed in UI implementations
-
setHidden
public void setHidden(boolean hidden) Description copied from interface:MutableEntityConfigurationShould this configuration be shown in UI implementations?- Specified by:
setHiddenin interfaceMutableEntityConfiguration<T>- Parameters:
hidden- true if this configuration should not be shown in UI implementations
-
hasView
- Specified by:
hasViewin interfaceEntityViewRegistry
-
registerView
public void registerView(@NonNull @NonNull String viewName, @NonNull @NonNull EntityViewFactory viewFactory) - Specified by:
registerViewin interfaceConfigurableEntityViewRegistry
-
removeView
Description copied from interface:ConfigurableEntityViewRegistryRemove a view from the registry.- Specified by:
removeViewin interfaceConfigurableEntityViewRegistry- Parameters:
viewName- name of the view
-
getViewFactory
- Specified by:
getViewFactoryin interfaceEntityViewRegistry
-
getViewNames
- Specified by:
getViewNamesin interfaceEntityViewRegistry
-
getPropertyRegistry
Description copied from interface:MutableEntityConfigurationGet the property registry as aMutableEntityPropertyRegistry.- Specified by:
getPropertyRegistryin interfaceEntityConfiguration<T>- Specified by:
getPropertyRegistryin interfaceMutableEntityConfiguration<T>- Returns:
- mutable instance of the property registry
-
setPropertyRegistry
Description copied from interface:MutableEntityConfigurationSet the property registry for this configuration.- Specified by:
setPropertyRegistryin interfaceMutableEntityConfiguration<T>- Parameters:
propertyRegistry- instancce
-
getEntityMessageCodeResolver
- Specified by:
getEntityMessageCodeResolverin 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:MutableEntityConfigurationSet the message code resolver.- Specified by:
setEntityMessageCodeResolverin interfaceMutableEntityConfiguration<T>- Parameters:
entityMessageCodeResolver- instance
-
isNew
Description copied from interface:EntityConfigurationShortcut toEntityInformation.isNew(Object).- Specified by:
isNewin interfaceEntityConfiguration<T>- Parameters:
entity- instance- Returns:
- true if new (unsaved) entity instance
-
getIdType
Description copied from interface:EntityConfigurationShortcut toEntityInformation.getIdType()}.- Specified by:
getIdTypein interfaceEntityConfiguration<T>- Returns:
- type of the id parameter of this entity (can be null)
-
getId
Description copied from interface:EntityConfigurationShortcut toEntityInformation.getId(Object).- Specified by:
getIdin interfaceEntityConfiguration<T>- Parameters:
entity- instance- Returns:
- id value of the entity
-
getLabel
Description copied from interface:EntityConfigurationShortcut toEntityModel.getLabel(Object).- Specified by:
getLabelin interfaceEntityConfiguration<T>- Parameters:
entity- instance- Returns:
- label valud of the entity
-
getAssociations
- Specified by:
getAssociationsin interfaceEntityConfiguration<T>- Returns:
- list of associations this entity has to others
-
createAssociation
Description copied from interface:MutableEntityConfigurationRegister a new association with a specific name. Should return any already existing association with that name.- Specified by:
createAssociationin interfaceMutableEntityConfiguration<T>- Parameters:
name- of the association- Returns:
- mutable instance of the association
-
association
Description copied from interface:MutableEntityConfigurationRetrieve a named association as aMutableEntityAssociation.- Specified by:
associationin interfaceEntityConfiguration<T>- Specified by:
associationin interfaceMutableEntityConfiguration<T>- Parameters:
name- of the association- Returns:
- mutable instance of the association (or null if non existing)
-
getAllowableActionsBuilder
- Specified by:
getAllowableActionsBuilderin interfaceMutableEntityConfiguration<T>- Returns:
- the allowable actions builder instance
-
setAllowableActionsBuilder
public void setAllowableActionsBuilder(@NonNull @NonNull EntityConfigurationAllowableActionsBuilder allowableActionsBuilder) Description copied from interface:MutableEntityConfigurationSet the builder for theAllowableActionsof this entity configuration.- Specified by:
setAllowableActionsBuilderin interfaceMutableEntityConfiguration<T>- Parameters:
allowableActionsBuilder- instance
-
getAllowableActions
public com.foreach.across.modules.spring.security.actions.AllowableActions getAllowableActions()- Specified by:
getAllowableActionsin 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:
getAllowableActionsin interfaceEntityConfiguration<T>- Parameters:
entity- for which to fetch the allowed actions- Returns:
- the set of actions allowed on the specific entity
-
toString
-