Class DefaultMerchCatalogService

java.lang.Object
com.hybris.merchandising.service.impl.DefaultMerchCatalogService
All Implemented Interfaces:
MerchCatalogService

public class DefaultMerchCatalogService extends Object implements MerchCatalogService
DefaultMerchCatalogService is a default implementation of MerchCatalogService, used to make catalog requests for Merch v2 support.
  • Field Details

  • 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:
      getCategories in interface MerchCatalogService
      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 CategoryHierarchy representing the categories.
    • getProducts

      public List<Product> getProducts(IndexerBatchContext indexerBatchContext, MerchProductDirectoryConfigModel merchProductDirectoryConfigModel) throws IndexerException
      Description copied from interface: MerchCatalogService
      Method to retrieve all the associated to IndexerBatchContext.
      Specified by:
      getProducts in interface MerchCatalogService
      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

      Retrieves a list of CategoryHierarchy objects representing the category hierarchy.
      Specified by:
      getCategories in interface MerchCatalogService
      Parameters:
      config - - the MerchProductDirectoryConfigModel to 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 of SearchQuery to 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 context
      productDirectoryConfig - 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

      protected String getTranslatedFieldName(SearchQuery searchQuery, IndexedProperty indexedProperty)
    • 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 of MerchPropertyModel to the indexed properties within Solr.
      Parameters:
      merchProperties -
      indexedPropertiesMapping -
      Returns:
    • extractPropName

      protected String extractPropName(AbstractMerchPropertyModel merchProp)
    • extractPropTranslatedName

      protected String extractPropTranslatedName(AbstractMerchPropertyModel merchProp)
    • 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 - the CategoryHierarchy we wish to populate.
      category - the CategoryModel representing the hierarchy.
      root - whether the category is a root category or not.
      categoryUrl - the URL to prefix the category with.
    • createActionForIndexOperation

      protected String createActionForIndexOperation(IndexOperation indexOperation)
      createActionForIndexOperation is a method for retrieving the action to use when sending to Merchandising for a given IndexOperation.
      Parameters:
      indexOperation - the operation to retrieve the value for.
      Returns:
      the action to use.
    • getUrl

      protected String getUrl(CategoryModel category, String baseCategoryUrl)
      getUrl resolves the URL for a provided CategoryModel.
      Parameters:
      category - the category model to retrieve the URL for.
      Returns:
      a String containing the URL.
    • getBaseSiteService

      protected BaseSiteService getBaseSiteService()
      Gets the configured BaseSiteService, used to set the current site for the request.
      Returns:
      the injected base site service to use.
    • setBaseSiteService

      public void setBaseSiteService(BaseSiteService baseSiteService)
      Sets the configured BaseSiteService, used to set the current site for the request.
      Parameters:
      baseSiteService - the injected base site service to use.
    • getCategoryUrlResolver

      public AbstractUrlResolver<CategoryModel> getCategoryUrlResolver()
      Retrieves the configured URL resolver for CategoryModel.
      Returns:
      the configured resolver.
    • setCategoryUrlResolver

      public void setCategoryUrlResolver(AbstractUrlResolver<CategoryModel> categoryUrlResolver)
      Sets the configured URL resolver for CategoryModel.
      Parameters:
      categoryUrlResolver - the resolver to return.
    • setFacetSearchService

      public void setFacetSearchService(FacetSearchService facetSearchService)
    • setSearchQueryLanguageResolver

      public void setSearchQueryLanguageResolver(SearchQueryLanguageResolver searchQueryLanguageResolver)
    • setSearchQueryCurrencyResolver

      public void setSearchQueryCurrencyResolver(SearchQueryCurrencyResolver searchQueryCurrencyResolver)
    • setFieldNameTranslator

      public void setFieldNameTranslator(FieldNameTranslator fieldNameTranslator)
    • setMerchProductConverter

      public void setMerchProductConverter(Converter<ProductIndexContainer,Product> merchProductConverter)