Class DefaultMerchCatalogService
- java.lang.Object
-
- com.hybris.merchandising.service.impl.DefaultMerchCatalogService
-
- All Implemented Interfaces:
MerchCatalogService
public class DefaultMerchCatalogService extends java.lang.Object implements MerchCatalogService
DefaultMerchCatalogService is a default implementation ofMerchCatalogService, used to make catalog requests for Merch v2 support.
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseSiteServicebaseSiteServiceprotected AbstractUrlResolver<CategoryModel>categoryUrlResolver
-
Constructor Summary
Constructors Constructor Description DefaultMerchCatalogService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BaseSiteServicegetBaseSiteService()Gets the configuredBaseSiteService, used to set the current site for the request.java.util.List<CategoryHierarchy>getCategories(java.lang.String baseSite, java.lang.String catalogId, java.lang.String catalogVersionId, java.lang.String baseCategoryUrl)getCategories is a method for retrieving the category hierarchy (including subcategories).AbstractUrlResolver<CategoryModel>getCategoryUrlResolver()Retrieves the configured URL resolver forCategoryModel.protected java.lang.StringgetUrl(CategoryModel category, java.lang.String baseCategoryUrl)getUrl resolves the URL for a providedCategoryModel.protected voidprocessSubCategories(CategoryHierarchy toPopulate, CategoryModel category, boolean root, java.lang.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.
-
-
-
Field Detail
-
baseSiteService
protected BaseSiteService baseSiteService
-
categoryUrlResolver
protected AbstractUrlResolver<CategoryModel> categoryUrlResolver
-
-
Method Detail
-
getCategories
public java.util.List<CategoryHierarchy> getCategories(java.lang.String baseSite, java.lang.String catalogId, java.lang.String catalogVersionId, java.lang.String baseCategoryUrl)
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.baseCategoryUrl- the URL we wish to use to access the category from.- Returns:
- a List of
CategoryHierarchyrepresenting the categories.
-
processSubCategories
protected void processSubCategories(CategoryHierarchy toPopulate, CategoryModel category, boolean root, java.lang.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.
-
getUrl
protected java.lang.String getUrl(CategoryModel category, java.lang.String baseCategoryUrl)
getUrl resolves the URL for a providedCategoryModel.- Parameters:
category- the category model to retrieve the URL for.- Returns:
- a String containing the URL.
-
getBaseSiteService
protected BaseSiteService getBaseSiteService()
Gets the configuredBaseSiteService, 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 configuredBaseSiteService, 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 forCategoryModel.- Returns:
- the configured resolver.
-
setCategoryUrlResolver
public void setCategoryUrlResolver(AbstractUrlResolver<CategoryModel> categoryUrlResolver)
Sets the configured URL resolver forCategoryModel.- Parameters:
categoryUrlResolver- the resolver to return.
-
-