Class MediaFieldPersistenceProvider
java.lang.Object
org.broadleafcommerce.openadmin.server.service.persistence.module.provider.AbstractFieldPersistenceProvider
org.broadleafcommerce.openadmin.server.service.persistence.module.provider.FieldPersistenceProviderAdapter
org.broadleafcommerce.openadmin.server.service.persistence.module.provider.MediaFieldPersistenceProvider
- All Implemented Interfaces:
FieldPersistenceProvider,org.springframework.core.Ordered
@Component("blMediaFieldPersistenceProvider")
@Scope("prototype")
public class MediaFieldPersistenceProvider
extends FieldPersistenceProviderAdapter
- Author:
- Brian Polster
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected EntityConfigurationprotected MediaBuilderServiceprotected SandBoxHelperFields inherited from interface org.broadleafcommerce.openadmin.server.service.persistence.module.provider.FieldPersistenceProvider
BASIC, HTML, MAP_FIELD, MEDIA, MONEY, RULEFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancanHandleExtraction(ExtractValueRequest extractValueRequest, Property property) protected booleancanHandlePersistence(PopulateValueRequest populateValueRequest, Serializable instance) protected booleancheckEquality(Object one, Object two) protected StringconvertMediaToJson(Media media) protected booleanestablishDirtyState(Media newMedia, Media media) protected ObjectextractParent(PopulateValueRequest populateValueRequest, Serializable instance) extractValue(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.intgetOrder()protected Class<?>getStartingValueType(PopulateValueRequest populateValueRequest) populateValue(PopulateValueRequest populateValueRequest, Serializable instance) Set the property value on the target object.protected voidupdateMedia(PopulateValueRequest populateValueRequest, Media newMedia, boolean persist, Media media) protected voidupdateMediaFields(Media oldMedia, Media newMedia) Methods inherited from class org.broadleafcommerce.openadmin.server.service.persistence.module.provider.FieldPersistenceProviderAdapter
addSearchMapping, checkDirtyState, isFieldDirty, setNonDisplayableValuesMethods inherited from class org.broadleafcommerce.openadmin.server.service.persistence.module.provider.AbstractFieldPersistenceProvider
alwaysRun, buildFieldInfo, canHandlePopulateNull, getListFieldType, getMapFieldType
-
Field Details
-
entityConfiguration
-
sandBoxHelper
-
extensionManager
-
mediaBuilderService
-
-
Constructor Details
-
MediaFieldPersistenceProvider
public MediaFieldPersistenceProvider()
-
-
Method Details
-
canHandlePersistence
protected boolean canHandlePersistence(PopulateValueRequest populateValueRequest, Serializable instance) -
canHandleExtraction
-
populateValue
public MetadataProviderResponse populateValue(PopulateValueRequest populateValueRequest, Serializable instance) throws PersistenceException Description copied from interface:FieldPersistenceProviderSet 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.- Specified by:
populateValuein interfaceFieldPersistenceProvider- Overrides:
populateValuein classFieldPersistenceProviderAdapter- 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
- Throws:
PersistenceException
-
extractValue
public MetadataProviderResponse extractValue(ExtractValueRequest extractValueRequest, Property property) throws PersistenceException Description copied from interface:FieldPersistenceProviderRetrieve 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.- Specified by:
extractValuein interfaceFieldPersistenceProvider- Overrides:
extractValuein classFieldPersistenceProviderAdapter- 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
- Throws:
PersistenceException
-
filterProperties
public MetadataProviderResponse filterProperties(AddFilterPropertiesRequest addFilterPropertiesRequest, Map<String, FieldMetadata> properties) Description copied from interface:FieldPersistenceProviderFilter 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.- Specified by:
filterPropertiesin interfaceFieldPersistenceProvider- Overrides:
filterPropertiesin classFieldPersistenceProviderAdapter- Parameters:
addFilterPropertiesRequest- contains the Entity instance.properties- the collection of properties to filter- Returns:
- whether or not the implementation handled the persistence request
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered- Overrides:
getOrderin classFieldPersistenceProviderAdapter
-
updateMedia
protected void updateMedia(PopulateValueRequest populateValueRequest, Media newMedia, boolean persist, Media media) throws IllegalAccessException, FieldNotAvailableException -
checkEquality
-
establishDirtyState
protected boolean establishDirtyState(Media newMedia, Media media) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException -
getStartingValueType
protected Class<?> getStartingValueType(PopulateValueRequest populateValueRequest) throws ClassNotFoundException, IllegalAccessException -
convertMediaToJson
-
updateMediaFields
-
extractParent
protected Object extractParent(PopulateValueRequest populateValueRequest, Serializable instance) throws IllegalAccessException, FieldNotAvailableException
-