Class ExcelMediaFilenameExtensionValidator
- java.lang.Object
-
- com.hybris.backoffice.excel.validators.ExcelMediaImportValidator
-
- com.hybris.backoffice.excel.validators.ExcelMediaFilenameExtensionValidator
-
- All Implemented Interfaces:
ExcelSingleMediaValidator
,ExcelValidator
public class ExcelMediaFilenameExtensionValidator extends ExcelMediaImportValidator
Validator which checks whether the uploaded file has a proper file extension. List of available file extensions is configured via "excel.available.media.extensions".
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
CONFIG_EXCEL_AVAILABLE_MEDIA_EXTENSIONS
protected static java.lang.String
EXCEL_IMPORT_VALIDATION_MEDIA_EXTENSIONS
-
Fields inherited from class com.hybris.backoffice.excel.validators.ExcelMediaImportValidator
VALIDATION_DECLARED_MULTIPLE_REFERENCES, VALIDATION_MISSING_FILE_IN_ZIP, VALIDATION_MISSING_ZIP, VALIDATION_PATH_AND_CODE_EMPTY
-
Fields inherited from interface com.hybris.backoffice.excel.validators.ExcelValidator
CTX_MEDIA_CONTENT_ENTRIES
-
-
Constructor Summary
Constructors Constructor Description ExcelMediaFilenameExtensionValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
getAvailableExtensions()
protected java.util.Collection<java.lang.String>
getConfigExtensions()
protected boolean
isNotAvailable(java.lang.String extension)
void
setConfigurationService(ConfigurationService configurationService)
java.util.List<ValidationMessage>
validateSingleValue(java.util.Map<java.lang.String,java.lang.Object> context, java.util.Map<java.lang.String,java.lang.String> parameters)
Allows to validate single media.protected java.util.List<ValidationMessage>
validateZipEntries(java.lang.String filePath)
-
Methods inherited from class com.hybris.backoffice.excel.validators.ExcelMediaImportValidator
canHandle, getImportService, getTypeService, hasImportData, setImportService, setTypeService, validate
-
-
-
-
Field Detail
-
EXCEL_IMPORT_VALIDATION_MEDIA_EXTENSIONS
protected static final java.lang.String EXCEL_IMPORT_VALIDATION_MEDIA_EXTENSIONS
- See Also:
- Constant Field Values
-
CONFIG_EXCEL_AVAILABLE_MEDIA_EXTENSIONS
protected static final java.lang.String CONFIG_EXCEL_AVAILABLE_MEDIA_EXTENSIONS
- See Also:
- Constant Field Values
-
-
Method Detail
-
validateSingleValue
public java.util.List<ValidationMessage> validateSingleValue(java.util.Map<java.lang.String,java.lang.Object> context, java.util.Map<java.lang.String,java.lang.String> parameters)
Description copied from interface:ExcelSingleMediaValidator
Allows to validate single media.- Specified by:
validateSingleValue
in interfaceExcelSingleMediaValidator
- Overrides:
validateSingleValue
in classExcelMediaImportValidator
- Parameters:
context
- which allows to hold information about the file.parameters
- values of excel's cell.- Returns:
- the collection of errors. If media has no errors, then the empty collection should be returned.
-
validateZipEntries
protected java.util.List<ValidationMessage> validateZipEntries(java.lang.String filePath)
-
isNotAvailable
protected boolean isNotAvailable(java.lang.String extension)
-
getConfigExtensions
protected java.util.Collection<java.lang.String> getConfigExtensions()
-
getAvailableExtensions
protected java.lang.String getAvailableExtensions()
-
setConfigurationService
public void setConfigurationService(ConfigurationService configurationService)
-
-