Class DefaultImportValidator
java.lang.Object
com.broadleafcommerce.dataimport.service.DefaultImportValidator
- All Implemented Interfaces:
ImportValidator
- Author:
- Phillip Verheyden (phillipuniverse)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanValidate(ImportRequest request) Returns whether this validator can validate the given request.protected ImportServicesPropertiesprotected longprotected com.broadleafcommerce.resource.security.xss.service.XSSRequestProcessingServicevoidsetImportServicesProperties(ImportServicesProperties importServicesProperties) voidsetXssRequestProcessingService(com.broadleafcommerce.resource.security.xss.service.XSSRequestProcessingService xssRequestProcessingService) 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.protected booleanChecks every field and value for XSS vulnerabilities.
-
Constructor Details
-
DefaultImportValidator
public DefaultImportValidator(long validationFailureLimit)
-
-
Method Details
-
canValidate
Description copied from interface:ImportValidatorReturns whether this validator can validate the given request.- Specified by:
canValidatein 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:ImportValidatorValidates the file and import request to confirm they meet the basic requirements for allowing persistence and processing of this import.- Specified by:
validatein 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
LineErrorreturned for a record if there were multiple errors found.- Parameters:
context- information about the current import being processed
-
validateXSS
Checks every field and value for XSS vulnerabilities. Returns true if any errors are found.- Parameters:
row- The imported row.lineNumber- The line number of the given row.errors- The List of LineErrors to hold error information.- Returns:
- True if any errors were found, false if there are no XSS errors.
-
getValidationFailureLimit
protected long getValidationFailureLimit() -
getXssRequestProcessingService
protected com.broadleafcommerce.resource.security.xss.service.XSSRequestProcessingService getXssRequestProcessingService() -
setXssRequestProcessingService
@Autowired public void setXssRequestProcessingService(com.broadleafcommerce.resource.security.xss.service.XSSRequestProcessingService xssRequestProcessingService) -
getImportServicesProperties
-
setImportServicesProperties
@Autowired public void setImportServicesProperties(ImportServicesProperties importServicesProperties)
-