Class CategoryBreadcrumbServiceExtensionHandler
java.lang.Object
org.broadleafcommerce.core.web.breadcrumbs.AbstractBreadcrumbServiceExtensionHandler
org.broadleafcommerce.core.web.breadcrumbs.CategoryBreadcrumbServiceExtensionHandler
- All Implemented Interfaces:
org.broadleafcommerce.common.breadcrumbs.service.BreadcrumbServiceExtensionHandler,org.broadleafcommerce.common.extension.ExtensionHandler
@Service("blCategoryBreadcrumbServiceExtensionHandler")
public class CategoryBreadcrumbServiceExtensionHandler
extends AbstractBreadcrumbServiceExtensionHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.broadleafcommerce.core.catalog.service.CatalogServiceprotected org.broadleafcommerce.common.breadcrumbs.service.BreadcrumbServiceExtensionManagerFields inherited from class org.broadleafcommerce.core.web.breadcrumbs.AbstractBreadcrumbServiceExtensionHandler
enabled, priority -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddParentCrumbs(List<org.broadleafcommerce.common.breadcrumbs.dto.BreadcrumbDTO> parentCrumbs, org.broadleafcommerce.core.catalog.domain.Category category, String url, Map<String, String[]> params) Add the parent crumb for the passed in category.protected org.broadleafcommerce.common.breadcrumbs.dto.BreadcrumbDTObuildCategorySearchCrumb(org.broadleafcommerce.core.catalog.domain.Category category, String url, Map<String, String[]> params) Hook for overrides, some implementations may want to build a crumb related to category filtering.protected org.broadleafcommerce.common.breadcrumbs.dto.BreadcrumbDTObuildCrumbForCategory(org.broadleafcommerce.core.catalog.domain.Category category, String url, Map<String, String[]> params) protected org.broadleafcommerce.core.catalog.domain.CategorydetermineFirstCategory(String testUrl, Map<String, String[]> params, org.broadleafcommerce.common.extension.ExtensionResultHolder<List<org.broadleafcommerce.common.breadcrumbs.dto.BreadcrumbDTO>> holder) protected org.broadleafcommerce.core.catalog.domain.CategorygetCategoryFromCategoryAttribute(org.broadleafcommerce.common.web.BroadleafRequestContext brc, String testUrl, Map<String, String[]> params) This indicates that we are on a category pageprotected org.broadleafcommerce.core.catalog.domain.CategorygetCategoryFromUrl(org.broadleafcommerce.common.web.BroadleafRequestContext brc, String requestUrl, Map<String, String[]> params) intImplementations must provide a priority for this extension handler as the order determines the breadcrumb order.protected org.broadleafcommerce.core.catalog.domain.CategorygetMatchingCategoryFromProduct(org.broadleafcommerce.common.web.BroadleafRequestContext brc, String testUrl, Map<String, String[]> params) This is an efficient test that checks to see if the requestURI matches the product URI.protected StringgetNameForCategoryLink(org.broadleafcommerce.core.catalog.domain.Category category) voidinit()org.broadleafcommerce.common.extension.ExtensionResultStatusTypemodifyBreadcrumbList(String url, Map<String, String[]> params, org.broadleafcommerce.common.extension.ExtensionResultHolder<List<org.broadleafcommerce.common.breadcrumbs.dto.BreadcrumbDTO>> holder) Methods inherited from class org.broadleafcommerce.core.web.breadcrumbs.AbstractBreadcrumbServiceExtensionHandler
buildLink, getPriority, isEnabled, setEnabled, setPriority
-
Field Details
-
catalogService
protected org.broadleafcommerce.core.catalog.service.CatalogService catalogService -
extensionManager
protected org.broadleafcommerce.common.breadcrumbs.service.BreadcrumbServiceExtensionManager extensionManager
-
-
Constructor Details
-
CategoryBreadcrumbServiceExtensionHandler
public CategoryBreadcrumbServiceExtensionHandler()
-
-
Method Details
-
init
@PostConstruct public void init() -
modifyBreadcrumbList
public org.broadleafcommerce.common.extension.ExtensionResultStatusType modifyBreadcrumbList(String url, Map<String, String[]> params, org.broadleafcommerce.common.extension.ExtensionResultHolder<List<org.broadleafcommerce.common.breadcrumbs.dto.BreadcrumbDTO>> holder) - Specified by:
modifyBreadcrumbListin interfaceorg.broadleafcommerce.common.breadcrumbs.service.BreadcrumbServiceExtensionHandler- Overrides:
modifyBreadcrumbListin classAbstractBreadcrumbServiceExtensionHandler
-
buildCrumbForCategory
-
addParentCrumbs
protected void addParentCrumbs(List<org.broadleafcommerce.common.breadcrumbs.dto.BreadcrumbDTO> parentCrumbs, org.broadleafcommerce.core.catalog.domain.Category category, String url, Map<String, String[]> params) Add the parent crumb for the passed in category. Recursively call to find all parents.- Parameters:
parentCrumbs-category-url-params-
-
buildCategorySearchCrumb
protected org.broadleafcommerce.common.breadcrumbs.dto.BreadcrumbDTO buildCategorySearchCrumb(org.broadleafcommerce.core.catalog.domain.Category category, String url, Map<String, String[]> params) Hook for overrides, some implementations may want to build a crumb related to category filtering.Out of box does nothing here.
- Parameters:
category-url-params-- Returns:
-
getNameForCategoryLink
protected String getNameForCategoryLink(org.broadleafcommerce.core.catalog.domain.Category category) -
determineFirstCategory
-
getMatchingCategoryFromProduct
protected org.broadleafcommerce.core.catalog.domain.Category getMatchingCategoryFromProduct(org.broadleafcommerce.common.web.BroadleafRequestContext brc, String testUrl, Map<String, String[]> params) This is an efficient test that checks to see if the requestURI matches the product URI. This works well for sites whose category urls prefix their product urls.- Parameters:
brc-testUrl-params-- Returns:
-
getCategoryFromCategoryAttribute
protected org.broadleafcommerce.core.catalog.domain.Category getCategoryFromCategoryAttribute(org.broadleafcommerce.common.web.BroadleafRequestContext brc, String testUrl, Map<String, String[]> params) This indicates that we are on a category page- Parameters:
brc-testUrl-params-- Returns:
-
getCategoryFromUrl
-
getDefaultPriority
public int getDefaultPriority()Description copied from class:AbstractBreadcrumbServiceExtensionHandlerImplementations must provide a priority for this extension handler as the order determines the breadcrumb order.- Specified by:
getDefaultPriorityin classAbstractBreadcrumbServiceExtensionHandler- Returns:
-