Class ExcelCategoryValidator
java.lang.Object
com.hybris.backoffice.excel.validators.ExcelCategoryValidator
- All Implemented Interfaces:
ExcelValidator
Default excel validator for product's supercategories. The validator checks whether import parameters contains
"category" key, whether category exists and the category belongs to given catalog and version. This validator doesn't
check whether catalog and version exist. To do this, add
ExcelCatalogVersionValidator to a list of validators.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected static final StringFields inherited from interface com.hybris.backoffice.excel.validators.ExcelValidator
CTX_MEDIA_CONTENT_ENTRIES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanHandle(ImportParameters importParameters, AttributeDescriptorModel attributeDescriptor) Indicates whether given validator can handle a cell based on attribute descriptor and import parameters.protected Optional<CategoryModel>protected StringgetFormattedCategory(Map<String, String> parameters) voidsetCatalogVersionService(CatalogVersionService catalogVersionService) voidsetCategoryService(CategoryService categoryService) validate(ImportParameters importParameters, AttributeDescriptorModel attributeDescriptor, Map<String, Object> ctx) Validates given cell and returns validation result.protected Optional<ValidationMessage>
-
Field Details
-
CATEGORY_PATTERN
- See Also:
-
VALIDATION_CATEGORY_DOESNT_MATCH
- See Also:
-
VALIDATION_CATEGORY_EMPTY
- See Also:
-
-
Constructor Details
-
ExcelCategoryValidator
public ExcelCategoryValidator()
-
-
Method Details
-
validate
public ExcelValidationResult validate(ImportParameters importParameters, AttributeDescriptorModel attributeDescriptor, Map<String, Object> ctx) 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 interfaceExcelValidatorctx- - map which can be used as a cache. The map is shared between all request for given excel sheet.- Returns:
ExcelValidationResult
-
validateSingleValue
-
findValueInCache
-
getFormattedCategory
-
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.
-
getCatalogVersionService
-
setCatalogVersionService
-
getCategoryService
-
setCategoryService
-