Class ExcelMediaImportValidator
- java.lang.Object
-
- com.hybris.backoffice.excel.validators.ExcelMediaImportValidator
-
- All Implemented Interfaces:
ExcelSingleMediaValidator,ExcelValidator
- Direct Known Subclasses:
ExcelMediaCollectionImportValidator,ExcelMediaFilenameExtensionValidator
public class ExcelMediaImportValidator extends java.lang.Object implements ExcelSingleMediaValidator
Validator which checks if media import data is correct. Checks:- if at least one
AbstractExcelMediaImportTranslator.PARAM_FILE_PATHorAbstractExcelMediaImportTranslator.PARAM_CODEis defined - if given
AbstractExcelMediaImportTranslator.PARAM_FILE_PATHexists in uploaded content - if there is only one reference defined
-
-
Field Summary
Fields Modifier and Type Field Description protected TypeServicetypeServicestatic java.lang.StringVALIDATION_DECLARED_MULTIPLE_REFERENCESstatic java.lang.StringVALIDATION_MISSING_FILE_IN_ZIPstatic java.lang.StringVALIDATION_MISSING_ZIPstatic java.lang.StringVALIDATION_PATH_AND_CODE_EMPTY-
Fields inherited from interface com.hybris.backoffice.excel.validators.ExcelValidator
CTX_MEDIA_CONTENT_ENTRIES
-
-
Constructor Summary
Constructors Constructor Description ExcelMediaImportValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancanHandle(ImportParameters importParameters, AttributeDescriptorModel attributeDescriptor)Indicates whether given validator can handle a cell based on attribute descriptor and import parameters.ExcelImportServicegetImportService()Deprecated, for removal: This API element is subject to removal in a future version.since 1808, not used anymoreTypeServicegetTypeService()protected booleanhasImportData(ImportParameters importParameters)voidsetImportService(ExcelImportService importService)Deprecated, for removal: This API element is subject to removal in a future version.since 1808, not used anymorevoidsetTypeService(TypeService typeService)ExcelValidationResultvalidate(ImportParameters importParameters, AttributeDescriptorModel attributeDescriptor, java.util.Map<java.lang.String,java.lang.Object> context)Validates given cell and returns validation result.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.
-
-
-
Field Detail
-
VALIDATION_DECLARED_MULTIPLE_REFERENCES
public static final java.lang.String VALIDATION_DECLARED_MULTIPLE_REFERENCES
- See Also:
- Constant Field Values
-
VALIDATION_PATH_AND_CODE_EMPTY
public static final java.lang.String VALIDATION_PATH_AND_CODE_EMPTY
- See Also:
- Constant Field Values
-
VALIDATION_MISSING_FILE_IN_ZIP
public static final java.lang.String VALIDATION_MISSING_FILE_IN_ZIP
- See Also:
- Constant Field Values
-
VALIDATION_MISSING_ZIP
public static final java.lang.String VALIDATION_MISSING_ZIP
- See Also:
- Constant Field Values
-
typeService
protected TypeService typeService
-
-
Method Detail
-
canHandle
public boolean canHandle(ImportParameters importParameters, AttributeDescriptorModel attributeDescriptor)
Description copied from interface:ExcelValidatorIndicates whether given validator can handle a cell based on attribute descriptor and import parameters.- Specified by:
canHandlein interfaceExcelValidator- Returns:
- boolean whether validator can handle the cell.
-
hasImportData
protected boolean hasImportData(ImportParameters importParameters)
-
validate
public ExcelValidationResult validate(ImportParameters importParameters, AttributeDescriptorModel attributeDescriptor, java.util.Map<java.lang.String,java.lang.Object> context)
Description copied from interface:ExcelValidatorValidates given cell and returns validation result. If cell doesn't have validation issues thenExcelValidationResult.SUCCESSshould be returned.- Specified by:
validatein interfaceExcelValidatorcontext- - map which can be used as a cache. The map is shared between all request for given excel sheet.- Returns:
ExcelValidationResult
-
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:ExcelSingleMediaValidatorAllows to validate single media.- Specified by:
validateSingleValuein interfaceExcelSingleMediaValidator- 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.
-
getTypeService
public TypeService getTypeService()
-
setTypeService
public void setTypeService(TypeService typeService)
-
getImportService
@Deprecated(since="1808", forRemoval=true) public ExcelImportService getImportService()Deprecated, for removal: This API element is subject to removal in a future version.since 1808, not used anymore
-
setImportService
@Deprecated(since="1808", forRemoval=true) public void setImportService(ExcelImportService importService)Deprecated, for removal: This API element is subject to removal in a future version.since 1808, not used anymore
-
-