org.broadleafcommerce.openadmin.server.service.persistence.validation
Class RequiredPropertyValidator

java.lang.Object
  extended by org.broadleafcommerce.openadmin.server.service.persistence.validation.RequiredPropertyValidator
All Implemented Interfaces:
GlobalPropertyValidator

@Component(value="blRequiredPropertyValidator")
public class RequiredPropertyValidator
extends Object
implements GlobalPropertyValidator

Ensures that every property that is required from BasicFieldMetadata.getRequired() has a non-empty value being set.

Author:
Phillip Verheyden (phillipuniverse)

Field Summary
static String ERROR_MESSAGE
           
 
Constructor Summary
RequiredPropertyValidator()
           
 
Method Summary
 PropertyValidationResult validate(Entity entity, Serializable instance, Map<String,FieldMetadata> entityFieldMetadata, BasicFieldMetadata propertyMetadata, String propertyName, String value)
          Validates a property for an entity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_MESSAGE

public static String ERROR_MESSAGE
Constructor Detail

RequiredPropertyValidator

public RequiredPropertyValidator()
Method Detail

validate

public PropertyValidationResult validate(Entity entity,
                                         Serializable instance,
                                         Map<String,FieldMetadata> entityFieldMetadata,
                                         BasicFieldMetadata propertyMetadata,
                                         String propertyName,
                                         String value)
Description copied from interface: GlobalPropertyValidator
Validates a property for an entity

Specified by:
validate in interface GlobalPropertyValidator
Parameters:
entity - Entity DTO of the entity attempting to save
instance - actual object representation of entity. This can be cast to entity interfaces (like Sku or Product)
entityFieldMetadata - complete field metadata for all properties in entity
propertyMetadata - BasicFieldMetadata corresponding to the property that is being valid
propertyName - the property name of the value attempting to be saved (could be a sub-entity obtained via dot notation like 'defaultSku.name')
value - the value attempted to be saved
Returns:
true if this passes validation, false otherwise.


Copyright © 2013. All Rights Reserved.