@Service(value="blEntityValidatorService") public class EntityValidatorServiceImpl extends Object implements EntityValidatorService, org.springframework.context.ApplicationContextAware
Property from the given Entity according to the
ValidationConfigurations associated with it.EntityValidatorService},
ValidationConfiguration}| Modifier and Type | Field and Description |
|---|---|
protected org.springframework.context.ApplicationContext |
applicationContext |
protected List<GlobalPropertyValidator> |
globalEntityValidators |
protected RowLevelSecurityService |
securityService |
| Constructor and Description |
|---|
EntityValidatorServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
List<GlobalPropertyValidator> |
getGlobalEntityValidators() |
protected List<String> |
getTypeHierarchy(Entity entity)
Returns the type hierarchy of the given entity in ascending order of type, stopping at Object
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setGlobalEntityValidators(List<GlobalPropertyValidator> globalEntityValidators)
Set the global validators that will be run on every entity that is attempted to be saved in the admin.
|
void |
validate(Entity submittedEntity,
Serializable instance,
Map<String,FieldMetadata> propertiesMetadata,
RecordHelper recordHelper,
boolean validateUnsubmittedProperties)
Validate the given entity.
|
protected List<GlobalPropertyValidator> globalEntityValidators
protected org.springframework.context.ApplicationContext applicationContext
protected RowLevelSecurityService securityService
public void validate(Entity submittedEntity, @Nullable Serializable instance, Map<String,FieldMetadata> propertiesMetadata, RecordHelper recordHelper, boolean validateUnsubmittedProperties)
EntityValidatorServiceEntity.setValidationFailure(boolean) appropriately.
Validation is invoked after the entire instance has been populated according to
BasicPersistenceModule.createPopulatedInstance(Serializable, Entity, Map, Boolean).validate in interface EntityValidatorServiceinstance - actual domain representation of entitypropertiesMetadata - all of the merged properties metadata for the given EntityvalidateUnsubmittedProperties - if set to true, will ignore validation for properties that weren't submitted
along with the entityprotected List<String> getTypeHierarchy(Entity entity)
Returns the type hierarchy of the given entity in ascending order of type, stopping at Object
For instance, if this entity's Entity.getType() is ProductBundleImpl, then the result will be:
[org.broadleafcommerce.core.catalog.domain.ProductBundleImpl, org.broadleafcommerce.core.catalog.domain.ProductImpl]
entity - public List<GlobalPropertyValidator> getGlobalEntityValidators()
getGlobalEntityValidators in interface EntityValidatorServiceEntitypublic void setGlobalEntityValidators(List<GlobalPropertyValidator> globalEntityValidators)
EntityValidatorServiceSet the global validators that will be run on every entity that is attempted to be saved in the admin. Global
validators are useful to operate on things like field types and other scenarios that could occur with a number of
entities. Rather than being required to define a ValidationConfiguration on all of those properties, this
can more conveniently validate that set of properties.
An example of a global validator in Broadleaf is the RequiredPropertyValidator which will ensure that every
property that is marked as required will fail validation if a value is unset.
setGlobalEntityValidators in interface EntityValidatorServiceglobalEntityValidators - the globalEntityValidators to setpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionCopyright © 2015. All rights reserved.