Interface FieldPersistenceProvider
- All Superinterfaces:
org.springframework.core.Ordered
- All Known Implementing Classes:
AbstractFieldPersistenceProvider,AbstractMoneyFieldPersistenceProvider,BasicFieldPersistenceProvider,DefaultFieldPersistenceProvider,FieldPersistenceProviderAdapter,MapFieldPersistenceProvider,MediaFieldPersistenceProvider,MoneyFieldPersistenceProvider,RuleFieldPersistenceProvider
public interface FieldPersistenceProvider
extends org.springframework.core.Ordered
Classes implementing this interface are capable of handling persistence related events for fields whose values
are being requested or set for the admin. This includes any special translations or transformations required to get
from the string representation in the admin back to the field on a Hibernate entity - and the reverse. Providers are
typically added in response to new admin presentation annotation support that requires special persistence behavior.
Note,
FieldPersistenceProvider instances are part of BasicPersistenceModule,
and therefore relate to variations on persistence of basic fields. Implementers should generally
extend FieldPersistenceProviderAdapter.- Author:
- Jeff Fischer
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intTheMediaFieldPersistenceProviderMUST come prior to the normal Map field provider since they can both respond to the same type of map fields.static final intstatic final intTheRuleFieldPersistenceProviderMUST come prior to the normal map field provider.Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Method Summary
Modifier and TypeMethodDescriptionaddSearchMapping(AddSearchMappingRequest addSearchMappingRequest, List<FilterMapping> filterMappings) AddFilterMappinginstances.booleanIf the provider should always run, regardless if a previous provider returned a response of HANDLED_BREAKbooleanIf the provider should handle populating null values or if it should delegate to the default persistence providerextractValue(ExtractValueRequest extractValueRequest, Property property) Retrieve the property value from the requestedValue field from the request.filterProperties(AddFilterPropertiesRequest addFilterPropertiesRequest, Map<String, FieldMetadata> properties) Filter the list of properties posted by the admin during and add or update.populateValue(PopulateValueRequest populateValueRequest, Serializable instance) Set the property value on the target object.Methods inherited from interface org.springframework.core.Ordered
getOrder
-
Field Details
-
BASIC
static final int BASIC- See Also:
-
MEDIA
static final int MEDIATheMediaFieldPersistenceProviderMUST come prior to the normal Map field provider since they can both respond to the same type of map fields. However, the Media fields are a special case since it needs to parse out the Media DTO- See Also:
-
RULE
static final int RULETheRuleFieldPersistenceProviderMUST come prior to the normal map field provider. They both deal with map field types but rules are a special case- See Also:
-
MAP_FIELD
static final int MAP_FIELD- See Also:
-
MONEY
static final int MONEY- See Also:
-
HTML
static final int HTML- See Also:
-
-
Method Details
-
populateValue
MetadataProviderResponse populateValue(PopulateValueRequest populateValueRequest, Serializable instance) Set the property value on the target object. Implementations should translate the requestedValue field from the request and set on the instance parameter. You are basically taking the string value submitted by the admin application and converting it into the format required to set on the target field of instance (which should be a JPA managed entity). Used during admin create and update events.- Parameters:
populateValueRequest- contains the requested value and support classes.instance- the persistence entity instance on which to set the value harvested from the request- Returns:
- whether or not the implementation handled the persistence request
-
extractValue
Retrieve the property value from the requestedValue field from the request. Implementations should translate the requestedValue and set on the property parameter. The requestedValue is the field value taken from the JPA managed entity instance. You are taking this field value and converting it into a string representation appropriate for the property instance parameter. Used during admin fetch events.- Parameters:
extractValueRequest- contains the requested value and support classes.property- the property for the admin that will contain the information harvested from the persistence value- Returns:
- whether or not the implementation handled the persistence request
-
addSearchMapping
MetadataProviderResponse addSearchMapping(AddSearchMappingRequest addSearchMappingRequest, List<FilterMapping> filterMappings) AddFilterMappinginstances. The FilterMappings are used by the system to refine the fetch criteria used to retrieve lists of records for the admin. The requestedCto contains filters requested from the admin and is generally used to drive the added FilterMapping instances.- Parameters:
addSearchMappingRequest- contains the requested cto and support classes.filterMappings- filter criteria should be added here. It is used to generate the final search criteria.- Returns:
- whether or not the implementation handled the persistence request
-
filterProperties
MetadataProviderResponse filterProperties(AddFilterPropertiesRequest addFilterPropertiesRequest, Map<String, FieldMetadata> properties) Filter the list of properties posted by the admin during and add or update. This is the property list immediately before persistence is attempted. Properties may be altered, removed or added.- Parameters:
addFilterPropertiesRequest- contains the Entity instance.properties- the collection of properties to filter- Returns:
- whether or not the implementation handled the persistence request
-
alwaysRun
boolean alwaysRun()If the provider should always run, regardless if a previous provider returned a response of HANDLED_BREAK- Returns:
- if this provider should always run
-
canHandlePopulateNull
boolean canHandlePopulateNull()If the provider should handle populating null values or if it should delegate to the default persistence provider- Returns:
-