Class DefaultMerchCatalogService
java.lang.Object
com.hybris.merchandising.service.impl.DefaultMerchCatalogService
- All Implemented Interfaces:
MerchCatalogService
DefaultMerchCatalogService is a default implementation of
MerchCatalogService, used
to make catalog requests for Merch v2 support.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BaseSiteServiceprotected static final Stringprotected static final Stringprotected AbstractUrlResolver<CategoryModel>protected static final Stringprotected static final Stringprotected FacetSearchServiceprotected FieldNameTranslatorprotected Converter<ProductIndexContainer,Product> protected SearchQueryCurrencyResolverprotected SearchQueryLanguageResolver -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcreateActionForIndexOperation(IndexOperation indexOperation) createActionForIndexOperation is a method for retrieving the action to use when sending to Merchandising for a givenIndexOperation.protected Map<String,IndexedPropertyInfo> createIndexedPropertiesMapping(IndexerBatchContext batchContext, SearchQuery searchQuery) Method used to retrieve a map of configured key value pairs for handling mapping between Solr internal data modelprotected IndexedPropertyInfocreateIndexedPropertyInfo(SearchQuery searchQuery, IndexedProperty indexedProperty) Helper method to populate IndexedPropertyInfo based on configured underprotected Map<String,FacetField> createMerchFacetPropertiesMapping(IndexerBatchContext batchContext, SearchQuery searchQuery) createMerchFacetPropertiesMapping is a method for mapping facets to output for consumption by Merchandising.createMerchPropertiesMapping(List<MerchPropertyModel> merchProperties, Map<String, IndexedPropertyInfo> indexedPropertiesMapping) createMerchPropertiesMapping is a method for mapping from the configured list ofMerchPropertyModelto the indexed properties within Solr.protected SearchQuerycreateSearchQuery(IndexerBatchContext indexerBatchContext, MerchProductDirectoryConfigModel productDirectory) Method is used to generate an instance ofSearchQueryto query Solr to retrieve updated product information.protected StringextractPropName(AbstractMerchPropertyModel merchProp) protected Stringprotected BaseSiteServiceGets the configuredBaseSiteService, used to set the current site for the request.Retrieves a list ofCategoryHierarchyobjects representing the category hierarchy.getCategories(String baseSite, String catalogId, String catalogVersionId, String baseCatalogPageUrl) getCategories is a method for retrieving the category hierarchy (including subcategories).Retrieves the configured URL resolver forCategoryModel.protected LanguageModelgetDefaultLanguage(IndexerBatchContext indexerBatchContext, MerchProductDirectoryConfigModel productDirectoryConfig) Method return default language based on product directory configuration and index configurationgetProducts(IndexerBatchContext indexerBatchContext, MerchProductDirectoryConfigModel merchProductDirectoryConfigModel) Method to retrieve all the associated toIndexerBatchContext.protected StringgetTranslatedFieldName(SearchQuery searchQuery, IndexedProperty indexedProperty) protected StringgetUrl(CategoryModel category, String baseCategoryUrl) getUrl resolves the URL for a providedCategoryModel.protected booleanisToSynchronize(List<CatalogVersionModel> catalogVersionsToExport, InputDocument document) Method to determine whether a given document is for the Online or Staging catalog.protected voidprocessSubCategories(CategoryHierarchy toPopulate, CategoryModel category, boolean root, String categoryUrl) processSubCategories is a method for taking a category model and recursively processing its sub categories.voidsetBaseSiteService(BaseSiteService baseSiteService) Sets the configuredBaseSiteService, used to set the current site for the request.voidsetCategoryUrlResolver(AbstractUrlResolver<CategoryModel> categoryUrlResolver) Sets the configured URL resolver forCategoryModel.voidsetFacetSearchService(FacetSearchService facetSearchService) voidsetFieldNameTranslator(FieldNameTranslator fieldNameTranslator) voidsetMerchProductConverter(Converter<ProductIndexContainer, Product> merchProductConverter) voidsetSearchQueryCurrencyResolver(SearchQueryCurrencyResolver searchQueryCurrencyResolver) voidsetSearchQueryLanguageResolver(SearchQueryLanguageResolver searchQueryLanguageResolver)
-
Field Details
-
DEFAULT_QUERY_TEMPLATE
- See Also:
-
EXECUTE
- See Also:
-
CATALOG_VERSION
- See Also:
-
CATALOG_ID
- See Also:
-
facetSearchService
-
fieldNameTranslator
-
searchQueryLanguageResolver
-
searchQueryCurrencyResolver
-
baseSiteService
-
categoryUrlResolver
-
merchProductConverter
-
-
Constructor Details
-
DefaultMerchCatalogService
public DefaultMerchCatalogService()
-
-
Method Details
-
getCategories
public List<CategoryHierarchy> getCategories(String baseSite, String catalogId, String catalogVersionId, String baseCatalogPageUrl) getCategories is a method for retrieving the category hierarchy (including subcategories).- Specified by:
getCategoriesin interfaceMerchCatalogService- Parameters:
baseSite- the base site we wish to retrieve the category hierarchy for.catalogId- the catalog we wish to retrieve the category hierarchy from.catalogVersionId- the catalog version we wish to retrieve the category hierarchy for.- Returns:
- a List of
CategoryHierarchyrepresenting the categories.
-
getProducts
public List<Product> getProducts(IndexerBatchContext indexerBatchContext, MerchProductDirectoryConfigModel merchProductDirectoryConfigModel) throws IndexerException Description copied from interface:MerchCatalogServiceMethod to retrieve all the associated toIndexerBatchContext.- Specified by:
getProductsin interfaceMerchCatalogService- Parameters:
indexerBatchContext- represents a context valid for the duration of an indexer batch.merchProductDirectoryConfigModel- the config model being used to retrieve products for.- Returns:
- List of that represents the merchandising properties
- Throws:
IndexerException- in case of errors.
-
getCategories
public List<CategoryHierarchy> getCategories(MerchProductDirectoryConfigModel config) throws IndexerException Retrieves a list ofCategoryHierarchyobjects representing the category hierarchy.- Specified by:
getCategoriesin interfaceMerchCatalogService- Parameters:
config- - theMerchProductDirectoryConfigModelto retrieve categories for.- Returns:
- a List representing the category hierarchy.
- Throws:
IndexerException- in case of errors.
-
createSearchQuery
protected SearchQuery createSearchQuery(IndexerBatchContext indexerBatchContext, MerchProductDirectoryConfigModel productDirectory) Method is used to generate an instance ofSearchQueryto query Solr to retrieve updated product information.- Parameters:
indexerBatchContext- represents a context valid for the duration of an indexer batch.productDirectory- - this is the product directory we wish to export products for.- Returns:
- SearchQuery
-
getDefaultLanguage
protected LanguageModel getDefaultLanguage(IndexerBatchContext indexerBatchContext, MerchProductDirectoryConfigModel productDirectoryConfig) Method return default language based on product directory configuration and index configuration- Parameters:
indexerBatchContext- indexing contextproductDirectoryConfig- product dirctory configuration- Returns:
- default language
-
createIndexedPropertiesMapping
protected Map<String,IndexedPropertyInfo> createIndexedPropertiesMapping(IndexerBatchContext batchContext, SearchQuery searchQuery) Method used to retrieve a map of configured key value pairs for handling mapping between Solr internal data model- Parameters:
batchContext- indexerBatchContext represents a context valid for the duration of an indexer batch.searchQuery-- Returns:
-
isToSynchronize
protected boolean isToSynchronize(List<CatalogVersionModel> catalogVersionsToExport, InputDocument document) Method to determine whether a given document is for the Online or Staging catalog.- Parameters:
catalogVersionsToExport-document-- Returns:
-
createIndexedPropertyInfo
protected IndexedPropertyInfo createIndexedPropertyInfo(SearchQuery searchQuery, IndexedProperty indexedProperty) Helper method to populate IndexedPropertyInfo based on configured under- Parameters:
searchQuery-indexedProperty-- Returns:
-
getTranslatedFieldName
-
createMerchFacetPropertiesMapping
protected Map<String,FacetField> createMerchFacetPropertiesMapping(IndexerBatchContext batchContext, SearchQuery searchQuery) throws IndexerException createMerchFacetPropertiesMapping is a method for mapping facets to output for consumption by Merchandising.- Parameters:
batchContext-searchQuery-- Returns:
- Throws:
IndexerException
-
createMerchPropertiesMapping
protected Map<String,String> createMerchPropertiesMapping(List<MerchPropertyModel> merchProperties, Map<String, IndexedPropertyInfo> indexedPropertiesMapping) createMerchPropertiesMapping is a method for mapping from the configured list ofMerchPropertyModelto the indexed properties within Solr.- Parameters:
merchProperties-indexedPropertiesMapping-- Returns:
-
extractPropName
-
extractPropTranslatedName
-
processSubCategories
protected void processSubCategories(CategoryHierarchy toPopulate, CategoryModel category, boolean root, String categoryUrl) processSubCategories is a method for taking a category model and recursively processing its sub categories.- Parameters:
toPopulate- theCategoryHierarchywe wish to populate.category- theCategoryModelrepresenting the hierarchy.root- whether the category is a root category or not.categoryUrl- the URL to prefix the category with.
-
createActionForIndexOperation
createActionForIndexOperation is a method for retrieving the action to use when sending to Merchandising for a givenIndexOperation.- Parameters:
indexOperation- the operation to retrieve the value for.- Returns:
- the action to use.
-
getUrl
getUrl resolves the URL for a providedCategoryModel.- Parameters:
category- the category model to retrieve the URL for.- Returns:
- a String containing the URL.
-
getBaseSiteService
Gets the configuredBaseSiteService, used to set the current site for the request.- Returns:
- the injected base site service to use.
-
setBaseSiteService
Sets the configuredBaseSiteService, used to set the current site for the request.- Parameters:
baseSiteService- the injected base site service to use.
-
getCategoryUrlResolver
Retrieves the configured URL resolver forCategoryModel.- Returns:
- the configured resolver.
-
setCategoryUrlResolver
Sets the configured URL resolver forCategoryModel.- Parameters:
categoryUrlResolver- the resolver to return.
-
setFacetSearchService
-
setSearchQueryLanguageResolver
-
setSearchQueryCurrencyResolver
-
setFieldNameTranslator
-
setMerchProductConverter
public void setMerchProductConverter(Converter<ProductIndexContainer, Product> merchProductConverter)
-