org.broadleafcommerce.openadmin.server.service.persistence.module.provider
Class RuleFieldPersistenceProvider
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.RuleFieldPersistenceProvider
- All Implemented Interfaces:
- FieldPersistenceProvider, org.springframework.core.Ordered
@Component(value="blRuleFieldPersistenceProvider")
@Scope(value="prototype")
public class RuleFieldPersistenceProvider
- extends FieldPersistenceProviderAdapter
- Author:
- Jeff Fischer
| Fields inherited from interface org.springframework.core.Ordered |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
|
Method Summary |
protected boolean |
canHandleExtraction(ExtractValueRequest extractValueRequest,
Property property)
|
protected boolean |
canHandlePersistence(PopulateValueRequest populateValueRequest,
Serializable instance)
|
protected DataWrapper |
convertJsonToDataWrapper(String json)
|
protected String |
convertMatchRuleJsonToMvel(DataDTOToMVELTranslator translator,
String entityKey,
String fieldService,
DataWrapper dw)
|
protected Property |
convertQuantityBasedRuleToJson(MVELToDataWrapperTranslator translator,
org.codehaus.jackson.map.ObjectMapper mapper,
Collection<QuantityBasedRule> quantityBasedRules,
String jsonProp,
String fieldService)
|
protected Property |
convertSimpleRuleToJson(MVELToDataWrapperTranslator translator,
org.codehaus.jackson.map.ObjectMapper mapper,
String matchRule,
String jsonProp,
String fieldService)
|
FieldProviderResponse |
extractValue(ExtractValueRequest extractValueRequest,
Property property)
Retrieve the property value from the requestedValue field from the request. |
FieldProviderResponse |
filterProperties(AddFilterPropertiesRequest addFilterPropertiesRequest,
Map<String,FieldMetadata> properties)
Filter the list of properties posted by the admin during and add or update. |
int |
getOrder()
|
protected void |
populateQuantityBaseRuleCollection(DataDTOToMVELTranslator translator,
String entityKey,
String fieldService,
String jsonPropertyValue,
Collection<QuantityBasedRule> criteriaList,
Class<?> memberType)
|
FieldProviderResponse |
populateValue(PopulateValueRequest populateValueRequest,
Serializable instance)
Set the property value on the target object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ruleBuilderFieldServiceFactory
protected RuleBuilderFieldServiceFactory ruleBuilderFieldServiceFactory
RuleFieldPersistenceProvider
public RuleFieldPersistenceProvider()
canHandlePersistence
protected boolean canHandlePersistence(PopulateValueRequest populateValueRequest,
Serializable instance)
canHandleExtraction
protected boolean canHandleExtraction(ExtractValueRequest extractValueRequest,
Property property)
populateValue
public FieldProviderResponse populateValue(PopulateValueRequest populateValueRequest,
Serializable instance)
throws PersistenceException
- Description copied from interface:
FieldPersistenceProvider
- 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.
- Specified by:
populateValue in interface FieldPersistenceProvider- Overrides:
populateValue in class FieldPersistenceProviderAdapter
- 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 FieldProviderResponse extractValue(ExtractValueRequest extractValueRequest,
Property property)
throws PersistenceException
- Description copied from interface:
FieldPersistenceProvider
- 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.
- Specified by:
extractValue in interface FieldPersistenceProvider- Overrides:
extractValue in class FieldPersistenceProviderAdapter
- 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 FieldProviderResponse filterProperties(AddFilterPropertiesRequest addFilterPropertiesRequest,
Map<String,FieldMetadata> properties)
- Description copied from interface:
FieldPersistenceProvider
- 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.
- Specified by:
filterProperties in interface FieldPersistenceProvider- Overrides:
filterProperties in class FieldPersistenceProviderAdapter
- Parameters:
addFilterPropertiesRequest - contains the Entity instance.properties - the collection of properties to filter
- Returns:
- whether or not the implementation handled the persistence request
convertQuantityBasedRuleToJson
protected Property convertQuantityBasedRuleToJson(MVELToDataWrapperTranslator translator,
org.codehaus.jackson.map.ObjectMapper mapper,
Collection<QuantityBasedRule> quantityBasedRules,
String jsonProp,
String fieldService)
convertSimpleRuleToJson
protected Property convertSimpleRuleToJson(MVELToDataWrapperTranslator translator,
org.codehaus.jackson.map.ObjectMapper mapper,
String matchRule,
String jsonProp,
String fieldService)
populateQuantityBaseRuleCollection
protected void populateQuantityBaseRuleCollection(DataDTOToMVELTranslator translator,
String entityKey,
String fieldService,
String jsonPropertyValue,
Collection<QuantityBasedRule> criteriaList,
Class<?> memberType)
convertJsonToDataWrapper
protected DataWrapper convertJsonToDataWrapper(String json)
convertMatchRuleJsonToMvel
protected String convertMatchRuleJsonToMvel(DataDTOToMVELTranslator translator,
String entityKey,
String fieldService,
DataWrapper dw)
getOrder
public int getOrder()
- Specified by:
getOrder in interface org.springframework.core.Ordered- Overrides:
getOrder in class FieldPersistenceProviderAdapter
Copyright © 2013. All Rights Reserved.