Class DefaultImportValidator

java.lang.Object
com.broadleafcommerce.dataimport.service.DefaultImportValidator
All Implemented Interfaces:
ImportValidator

public class DefaultImportValidator extends Object implements ImportValidator
Author:
Phillip Verheyden (phillipuniverse)
  • Constructor Details

    • DefaultImportValidator

      public DefaultImportValidator(long validationFailureLimit)
  • Method Details

    • canValidate

      public boolean canValidate(ImportRequest request)
      Description copied from interface: ImportValidator
      Returns whether this validator can validate the given request.
      Specified by:
      canValidate in interface ImportValidator
      Parameters:
      request - metadata about the import request
      Returns:
      true if this validator can validate the given request, false otherwise
    • validate

      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 interface ImportValidator
      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
    • validateXSS

      protected boolean validateXSS(Map<String,String> row, long lineNumber, List<LineError> errors)
      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

      protected ImportServicesProperties getImportServicesProperties()
    • setImportServicesProperties

      @Autowired public void setImportServicesProperties(ImportServicesProperties importServicesProperties)