Class DefaultImportValidator
java.lang.Object
com.broadleafcommerce.dataimport.service.DefaultImportValidator
- All Implemented Interfaces:
ImportValidator
- Author:
- Phillip Verheyden (phillipuniverse)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canValidate
(ImportRequest request) Returns whether this validator can validate the given request.validate
(ImportValidationContext<? extends FileReaderContext> context) Validates the file and import request to confirm they meet the basic requirements for allowing persistence and processing of this import.validateRecords
(ImportValidationContext<? extends FileReaderContext> context) Iterates through all of the records, returning a list of all validation errors that were encountered.
-
Constructor Details
-
DefaultImportValidator
public DefaultImportValidator(long validationFailureLimit)
-
-
Method Details
-
canValidate
Description copied from interface:ImportValidator
Returns whether this validator can validate the given request.- Specified by:
canValidate
in interfaceImportValidator
- Parameters:
request
- metadata about the import request- Returns:
- true if this validator can validate the given request, false otherwise
-
validate
public ImportValidationResponse validate(ImportValidationContext<? extends FileReaderContext> context) Description copied from interface:ImportValidator
Validates the file and import request to confirm they meet the basic requirements for allowing persistence and processing of this import.- Specified by:
validate
in interfaceImportValidator
- Returns:
- a detailed response describing any validation errors that were found
-
validateRecords
protected List<LineError> validateRecords(ImportValidationContext<? extends FileReaderContext> context) Iterates through all of the records, returning a list of all validation errors that were encountered.There may be more than one
LineError
returned for a record if there were multiple errors found.- Parameters:
context
- information about the current import being processed
-