Interface Category
- All Superinterfaces:
org.broadleafcommerce.common.copy.MultiTenantCloneable<Category>,Serializable
- All Known Implementing Classes:
CategoryImpl
public interface Category
extends Serializable, org.broadleafcommerce.common.copy.MultiTenantCloneable<Category>
Implementations of this interface are used to hold data about a Category. A category is a group of products.
You should implement this class if you want to make significant changes to how the Category is persisted. If you just want to add additional fields then you should extend
You should implement this class if you want to make significant changes to how the Category is persisted. If you just want to add additional fields then you should extend
CategoryImpl.- Author:
- btaylor, Jeff Fischer
-
Method Summary
Modifier and TypeMethodDescriptionbuildDefaultParentCategoryPath(List<Category> currentHierarchy) Build category hierarchy by walking the default category tree up to the root category.Gets the active end date.Deprecated.Use getActiveProductXrefs() instead.Gets the active start date.Deprecated.use getAllChildCategoryXrefs() instead.Deprecated.Use getAllParentCategoryXrefs() instead.Retrieve all the xref entities linking this category to parent categoriesDeprecated.Use getAllProductXrefs() instead.Deprecated.This will be removed in 3.1.0Deprecated.This will be replaced withgetCategoryAttributesMap()in 3.1.0.Gets the attributes for thisCategory.Deprecated.usegetCategoryMediaXref()insteadGets the category media map.Deprecated.Use getChildCategoryXrefs() instead.Gets the child category ids.Deprecated.This approach is inherently inefficient and should no longer be usedReturns a list of cross sale products that are related to this category.Returns a list of the cross sale products in this category as well as all cross sale products in all parent categories of this category.Returns a list of the featured products in this category as well as all featured products in all parent categories of this category.Returns a list of CategorySearchFacets that takes into consideration the search facets for this Category, the search facets for all parent categories, and the search facets that should be excluded from this Category.getCumulativeSearchFacets(Set<Category> categoryHierarchy) Returns a list of CategorySearchFacets that takes into consideration the search facets for this Category, the search facets for all parent categories, and the search facets that should be excluded from this Category.Returns a list of the upsale products in this category as well as all upsale products in all parent categories of this category.Deprecated.usegetParentCategory()insteadGets the description.Gets the display template.Gets the excluded SearchFacetsIntended to hold any unique identifier not tied to the Broadleaf Database Sequence Identifier.Gets the featured products.Returns the default fulfillment type for skus in this category.Creates the SEO url starting from this category and recursing up the hierarchy of default parent categories until the topmost category is reached.getId()Gets the primary key.Used to determine availability for all of the products/skus in this categoryGets the long description.Deprecated.This will be removed in 3.1.0Gets the meta data description of the categoryGets the meta data title of the categorygetName()Gets the name.Return the category that is the parent of this category - if applicablegetParentCategoryHierarchy(List<Category> currentHierarchy) Build the full category hierarchy by walking up the default category tree and the all parent category tree.getParentCategoryHierarchy(List<Category> currentHierarchy, Boolean firstParent) Build the full category hierarchy by walking up the default category tree and the all parent category tree.Return the parent category xref of the default parent or first applicable parentRetrieve the displayOrder that is used if the Category does not have any parentsReturns all of the SearchFacets that are directly associated with this CategoryReturns the tax code of this category.Returns a list of cross sale products that are related to this category.getUrl()Gets the url.Gets the url key.booleanChecks for child categories.booleanChecks for child categories.booleanisActive()Checks if is active.voidsetActiveEndDate(Date activeEndDate) Sets the active end date.voidsetActiveStartDate(Date activeStartDate) Sets the active start date.voidsetAllChildCategories(List<Category> childCategories) Deprecated.Use setAllChildCategoryXrefs() instead.voidsetAllChildCategoryXrefs(List<CategoryXref> childCategories) voidsetAllParentCategories(List<Category> allParentCategories) Deprecated.Use setAllParentCategoryXrefs() instead.voidsetAllParentCategoryXrefs(List<CategoryXref> allParentCategories) Set all the xref entities linking this product to parent categoriesvoidsetAllProducts(List<Product> allProducts) Deprecated.Use setAllProductXrefs() instead.voidsetAllProductXrefs(List<CategoryProductXref> allProducts) voidsetCategoryAttributes(List<CategoryAttribute> categoryAttributes) Deprecated.This will be replaced with#setCategoryAttributesMap()in 3.1.0.voidsetCategoryAttributesMap(Map<String, CategoryAttribute> categoryAttributes) voidsetCategoryMedia(Map<String, org.broadleafcommerce.common.media.domain.Media> categoryMedia) Deprecated.usesetCategoryMediaXref(Map)insteadvoidsetCategoryMediaXref(Map<String, CategoryMediaXref> categoryMediaXref) Sets the category media.voidsetChildCategories(List<Category> childCategories) Deprecated.Use setChildCategoryXrefs() instead.voidsetChildCategoryIds(List<Long> childCategoryIds) Sets the all child category ids.voidsetChildCategoryURLMap(Map<String, List<Long>> childCategoryURLMap) Deprecated.This approach is inherently inefficient and should no longer be usedvoidsetChildCategoryXrefs(List<CategoryXref> childCategories) voidsetCrossSaleProducts(List<RelatedProduct> crossSaleProducts) Sets the cross sale products that are related to this category.voidsetDefaultParentCategory(Category defaultParentCategory) Deprecated.usesetParentCategory(Category)insteadvoidsetDescription(String description) Sets the description.voidsetDisplayTemplate(String displayTemplate) Sets the display template.voidsetExcludedSearchFacets(List<CategoryExcludedSearchFacet> excludedSearchFacets) Sets the SearchFacets that should not be rendered by this Category.voidsetExternalId(String externalId) Sets a unique external IDvoidsetFeaturedProducts(List<FeaturedProduct> featuredProducts) Sets the featured products.voidsetFulfillmentType(FulfillmentType fulfillmentType) Sets the default fulfillment type for skus in this category.voidSets the primary key.voidsetInventoryType(InventoryType inventoryType) Sets the type of inventory for this categoryvoidsetLongDescription(String longDescription) Sets the long description.voidsetMetaDescription(String metaDescription) Sets the meta data description of the categoryvoidsetMetaTitle(String metaTitle) Sets the meta data title of the categoryvoidSets the name.voidsetOverrideGeneratedUrl(Boolean overrideGeneratedUrl) Sets the flag for whether or not the URL should not be generated in the adminvoidsetParentCategory(Category category) Set the parent category of this categoryvoidsetProductDescriptionPatternOverride(String productDescriptionPatternOverride) voidsetProductTitlePatternOverride(String productTitlePatternOverride) voidsetRootDisplayOrder(BigDecimal rootDisplayOrder) Set the displayOrder that is used if the Category does not have any parentsvoidsetSearchFacets(List<CategorySearchFacet> searchFacets) Sets the SearchFacets that are directly associated with this CategoryvoidsetTaxCode(String taxCode) Sets the tax code of this category.voidsetUpSaleProducts(List<RelatedProduct> upSaleProducts) Sets the upsale products that are related to this category.voidSets the url.voidSets the url key.Methods inherited from interface org.broadleafcommerce.common.copy.MultiTenantCloneable
createOrRetrieveCopyInstance
-
Method Details
-
getId
Gets the primary key.- Returns:
- the primary key
-
setId
Sets the primary key.- Parameters:
id- the new primary key
-
getName
Gets the name.- Returns:
- the name
-
setName
Sets the name.- Parameters:
name- the new name
-
getProductTitlePatternOverride
String getProductTitlePatternOverride() -
setProductTitlePatternOverride
-
getProductDescriptionPatternOverride
String getProductDescriptionPatternOverride() -
setProductDescriptionPatternOverride
-
getDefaultParentCategory
Deprecated.usegetParentCategory()insteadGets the default parent category. This method will delegate togetParentCategory()by default, unless the "use.legacy.default.category.mode" property is set to true in the implementation's property file. If set to true, this method will use legacy behavior, which is to return the deprecated defaultParentCategory field.- Returns:
- the default parent category
-
setDefaultParentCategory
Deprecated.usesetParentCategory(Category)insteadSets the default parent category. This method will delegate tosetParentCategory(Category)by default, unless the "use.legacy.default.category.mode" property is set to true in the implementation's property file. If set to true, this method will use legacy behavior, which is to set the deprecated defaultParentCategory field.- Parameters:
defaultParentCategory- the new default parent category
-
getParentCategory
Category getParentCategory()Return the category that is the parent of this category - if applicable- Returns:
-
setParentCategory
Set the parent category of this category- Parameters:
category-
-
getParentCategoryXref
CategoryXref getParentCategoryXref()Return the parent category xref of the default parent or first applicable parent- Returns:
-
getUrl
Gets the url. The url represents the presentation layer destination for this category. For example, if using Spring MVC, you could send the user to this destination by returning"redirect:"+currentCategory.getUrl();from a controller.- Returns:
- the url for the presentation layer component for this category
-
setUrl
Sets the url. The url represents the presentation layer destination for this category. For example, if using Spring MVC, you could send the user to this destination by returning"redirect:"+currentCategory.getUrl();from a controller.- Parameters:
url- the new url for the presentation layer component for this category
-
getOverrideGeneratedUrl
Boolean getOverrideGeneratedUrl()- Returns:
- the flag for whether or not the URL should not be generated in the admin
-
setOverrideGeneratedUrl
Sets the flag for whether or not the URL should not be generated in the admin- Parameters:
overrideGeneratedUrl-
-
getUrlKey
Gets the url key. The url key is used as part of SEO url generation for this category. Each segment of the url leading to a category is comprised of the url keys of the various associated categories in a hierarchy leading to this one. If the url key is null, the the name for the category formatted with dashes for spaces.- Returns:
- the url key for this category to appear in the SEO url
-
setUrlKey
Sets the url key. The url key is used as part of SEO url generation for this category. Each segment of the url leading to a category is comprised of the url keys of the various associated categories in a hierarchy leading to this one.- Parameters:
urlKey- the new url key for this category to appear in the SEO url
-
getGeneratedUrl
Creates the SEO url starting from this category and recursing up the hierarchy of default parent categories until the topmost category is reached. The url key for each category is used for each segment of the SEO url.- Returns:
- the generated SEO url for this category
-
getDescription
Gets the description.- Returns:
- the description
-
setDescription
Sets the description.- Parameters:
description- the new description
-
getActiveStartDate
Gets the active start date. If the current date is before activeStartDate, then this category will not be visible on the site.- Returns:
- the active start date
-
setActiveStartDate
Sets the active start date. If the current date is before activeStartDate, then this category will not be visible on the site.- Parameters:
activeStartDate- the new active start date
-
getActiveEndDate
Gets the active end date. If the current date is after activeEndDate, the this category will not be visible on the site.- Returns:
- the active end date
-
setActiveEndDate
Sets the active end date. If the current date is after activeEndDate, the this category will not be visible on the site.- Parameters:
activeEndDate- the new active end date
-
isActive
boolean isActive()Checks if is active. Returns true if the startDate is null or if the current date is after the start date, or if the endDate is null or if the current date is before the endDate.- Returns:
- true, if is active
-
getDisplayTemplate
Gets the display template. The display template can be used to help create a unique key that drives the presentation layer destination for this category. For example, if using Spring MVC, you might derive the view destination in this way:view = categoryTemplatePrefix + currentCategory.getDisplayTemplate();- Returns:
- the display template
-
setDisplayTemplate
Sets the display template. The display template can be used to help create a unique key that drives the presentation layer destination for this category. For example, if using Spring MVC, you might derive the view destination in this way:view = categoryTemplatePrefix + currentCategory.getDisplayTemplate();- Parameters:
displayTemplate- the new display template
-
getChildCategoryURLMap
Deprecated.This approach is inherently inefficient and should no longer be usedGets the child category url map. This map is keyed off of thegetGeneratedUrl()values for this category and all of its child categories. By calling get on this map using the generated url for a given category, you will receive the list of immediate child categories. This is inefficient, so its use is highly discouraged.- Returns:
- the child category url map
-
setChildCategoryURLMap
Deprecated.This approach is inherently inefficient and should no longer be usedSet the child category url map. This approach is inefficient, so its use is highly discouraged.- Parameters:
childCategoryURLMap-
-
getCategoryMedia
Deprecated.usegetCategoryMediaXref()insteadGets the category media map. The key is of arbitrary meaning and theMediainstance stores information about the media itself (image url, etc...)- Returns:
- the category Media
-
setCategoryMedia
@Deprecated void setCategoryMedia(@Nonnull Map<String, org.broadleafcommerce.common.media.domain.Media> categoryMedia) Deprecated.usesetCategoryMediaXref(Map)insteadSets the category media. The key is of arbitrary meaning and theMediainstance stores information about the media itself (image url, etc...)- Parameters:
categoryMedia- the category media
-
getCategoryMediaXref
Map<String,CategoryMediaXref> getCategoryMediaXref()Gets the category media map. The key is of arbitrary meaning and theMediainstance stores information about the media itself (image url, etc...)- Returns:
- the category Media
-
setCategoryMediaXref
Sets the category media. The key is of arbitrary meaning and theMediainstance stores information about the media itself (image url, etc...)- Parameters:
categoryMediaXref- the category media
-
getLongDescription
Gets the long description.- Returns:
- the long description
-
setLongDescription
Sets the long description.- Parameters:
longDescription- the new long description
-
getMetaTitle
String getMetaTitle()Gets the meta data title of the category- Returns:
-
setMetaTitle
Sets the meta data title of the category- Parameters:
metaTitle-
-
getMetaDescription
String getMetaDescription()Gets the meta data description of the category- Returns:
-
setMetaDescription
Sets the meta data description of the category- Parameters:
metaDescription-
-
getFeaturedProducts
Gets the featured products. Featured products are a special list of products you would like to showcase for this category.- Returns:
- the featured products
-
setFeaturedProducts
Sets the featured products. Featured products are a special list of products you would like to showcase for this category.- Parameters:
featuredProducts- the featured products
-
getCrossSaleProducts
List<RelatedProduct> getCrossSaleProducts()Returns a list of cross sale products that are related to this category.- Returns:
- a list of cross sale products
-
setCrossSaleProducts
Sets the cross sale products that are related to this category.- Parameters:
crossSaleProducts-- See Also:
-
getUpSaleProducts
List<RelatedProduct> getUpSaleProducts()Returns a list of cross sale products that are related to this category.- Returns:
- a list of cross sale products
-
setUpSaleProducts
Sets the upsale products that are related to this category.- Parameters:
upSaleProducts-- See Also:
-
getCumulativeCrossSaleProducts
List<RelatedProduct> getCumulativeCrossSaleProducts()Returns a list of the cross sale products in this category as well as all cross sale products in all parent categories of this category.- Returns:
- the cumulative cross sale products
-
getCumulativeUpSaleProducts
List<RelatedProduct> getCumulativeUpSaleProducts()Returns a list of the upsale products in this category as well as all upsale products in all parent categories of this category.- Returns:
- the cumulative upsale products
-
getCumulativeFeaturedProducts
List<FeaturedProduct> getCumulativeFeaturedProducts()Returns a list of the featured products in this category as well as all featured products in all parent categories of this category.- Returns:
- the cumulative featured products
-
getSearchFacets
List<CategorySearchFacet> getSearchFacets()Returns all of the SearchFacets that are directly associated with this Category- Returns:
- related SearchFacets
-
setSearchFacets
Sets the SearchFacets that are directly associated with this Category- Parameters:
searchFacets-
-
getExcludedSearchFacets
List<CategoryExcludedSearchFacet> getExcludedSearchFacets()Gets the excluded SearchFacets- Returns:
- the excluded SearchFacets
-
setExcludedSearchFacets
Sets the SearchFacets that should not be rendered by this Category. Typically, this will include facets from parent categories that do not apply to this category.- Parameters:
excludedSearchFacets-
-
getCumulativeSearchFacets
List<CategorySearchFacet> getCumulativeSearchFacets()Returns a list of CategorySearchFacets that takes into consideration the search facets for this Category, the search facets for all parent categories, and the search facets that should be excluded from this Category. This method will order the resulting list based on theCategorySearchFacet#getPosition()method for each category level. That is, the facets on this Category will be ordered by their position relative to each other with the ordered parent facets after that, etc.- Returns:
- the current active search facets for this category and all parent categories
-
getCumulativeSearchFacets
Returns a list of CategorySearchFacets that takes into consideration the search facets for this Category, the search facets for all parent categories, and the search facets that should be excluded from this Category. This method will order the resulting list based on theCategorySearchFacet#getPosition()method for each category level. That is, the facets on this Category will be ordered by their position relative to each other with the ordered parent facets after that, etc.Takes a Set of the categories that have been traversed in order to protect from circular dependencies.
- Parameters:
categoryHierarchy-- Returns:
- the current active search facets for this category and all parent categories *
-
buildDefaultParentCategoryPath
Build category hierarchy by walking the default category tree up to the root category. If the passed in tree is null then create the initial list.- Parameters:
currentHierarchy-- Returns:
-
getParentCategoryHierarchy
Build the full category hierarchy by walking up the default category tree and the all parent category tree.- Parameters:
currentHierarchy-- Returns:
- the full hierarchy
-
getParentCategoryHierarchy
Build the full category hierarchy by walking up the default category tree and the all parent category tree. Adds the option of only adding the first parent found.- Parameters:
currentHierarchy-firstParent- determines if ONLY the first parent category should be returned per hierarchy tier- Returns:
- the full hierarchy
-
getCategoryAttributesMap
Map<String,CategoryAttribute> getCategoryAttributesMap()Gets the attributes for thisCategory. In smaller sites, using these attributes might be preferred to extending the domain object itself.- Returns:
-
setCategoryAttributesMap
-
getCategoryAttributes
Deprecated.This will be replaced withgetCategoryAttributesMap()in 3.1.0.Gets the attributes for thisCategory. In smaller sites, using these attributes might be preferred to extending the domain object itself.- Returns:
-
setCategoryAttributes
Deprecated.This will be replaced with#setCategoryAttributesMap()in 3.1.0.Sets the attributes for thisCategory. In smaller sites, using these attributes might be preferred to extending the domain object and creating a new table to store custom properties. -
getCategoryAttributeByName
Deprecated.This will be removed in 3.1.0Convenience method to get aCategoryAttributeby name- Parameters:
name-- Returns:
-
getMappedCategoryAttributes
Deprecated.This will be removed in 3.1.0Convenience method to return theCategoryAttributes for theCategoryin an easily-consumable form- Returns:
-
getMultiValueCategoryAttributes
Map<String,CategoryAttribute> getMultiValueCategoryAttributes() -
getInventoryType
InventoryType getInventoryType()Used to determine availability for all of the products/skus in this category- Returns:
- the
InventoryTypefor this category
-
setInventoryType
Sets the type of inventory for this category- Parameters:
inventoryType- theInventoryTypefor this category
-
getFulfillmentType
FulfillmentType getFulfillmentType()Returns the default fulfillment type for skus in this category. May be null.- Returns:
-
setFulfillmentType
Sets the default fulfillment type for skus in this category. May return null.- Parameters:
fulfillmentType-
-
getAllChildCategories
Deprecated.use getAllChildCategoryXrefs() instead.Gets the child categories. This list includes all categories, regardless of whether or not they are active.- Returns:
- the list of active and inactive child categories.
-
setAllChildCategories
Deprecated.Use setAllChildCategoryXrefs() instead.Sets the list of child categories (active and inactive)- Parameters:
childCategories- the list of child categories
-
hasAllChildCategories
boolean hasAllChildCategories()Checks for child categories.- Returns:
- true, if this category has any children (active or not)
-
getChildCategories
Deprecated.Use getChildCategoryXrefs() instead.Gets the child categories. If child categories has not been previously set, then the list of active only categories will be returned.- Returns:
- the list of active child categories
-
setChildCategories
Deprecated.Use setChildCategoryXrefs() instead.Sets the all child categories. This should be a list of active only child categories.- Parameters:
childCategories- the list of active child categories.
-
getChildCategoryIds
Gets the child category ids. If child categories has not been previously set, then the list of active only categories will be returned. This method is optimized with Hydrated cache, which means that the algorithm required to harvest active child categories will not need to be rebuilt as long as the parent category (this category) is not evicted from second level cache.- Returns:
- the list of active child category ids
-
setChildCategoryIds
Sets the all child category ids. This should be a list of active only child categories.- Parameters:
childCategoryIds- the list of active child category ids.
-
hasChildCategories
boolean hasChildCategories()Checks for child categories.- Returns:
- true, if this category contains any active child categories.
-
getAllChildCategoryXrefs
List<CategoryXref> getAllChildCategoryXrefs() -
setAllChildCategoryXrefs
-
getChildCategoryXrefs
List<CategoryXref> getChildCategoryXrefs() -
setChildCategoryXrefs
-
getAllParentCategoryXrefs
List<CategoryXref> getAllParentCategoryXrefs()Retrieve all the xref entities linking this category to parent categories -
setAllParentCategoryXrefs
Set all the xref entities linking this product to parent categories -
getRootDisplayOrder
BigDecimal getRootDisplayOrder()Retrieve the displayOrder that is used if the Category does not have any parents -
setRootDisplayOrder
Set the displayOrder that is used if the Category does not have any parents -
getAllParentCategories
Deprecated.Use getAllParentCategoryXrefs() instead.Retrieve all parent categories- Returns:
- the list of parent categories
-
setAllParentCategories
Deprecated.Use setAllParentCategoryXrefs() instead.Sets the list of parent categories- Parameters:
allParentCategories- the list of parent categories
-
getActiveProductXrefs
List<CategoryProductXref> getActiveProductXrefs() -
getAllProductXrefs
List<CategoryProductXref> getAllProductXrefs() -
setAllProductXrefs
-
getActiveProducts
Deprecated.Use getActiveProductXrefs() instead.Convenience method to retrieve all of thisCategory'sProducts filtered by active. If you want all of theProducts (whether inactive or not) consider usinggetAllProducts(). -
getAllProducts
Deprecated.Use getAllProductXrefs() instead.Retrieve all theProductinstances associated with this category.
Note: this method does not take into account whether or not theProducts are active or not. If you need this functionality, usegetActiveProducts()- Returns:
- the list of products associated with this category.
-
setAllProducts
Deprecated.Use setAllProductXrefs() instead.Set all theProductinstances associated with this category.- Parameters:
allProducts- the list of products to associate with this category
-
getTaxCode
String getTaxCode()Returns the tax code of this category.- Returns:
- taxCode
-
setTaxCode
Sets the tax code of this category.- Parameters:
taxCode-
-
getExternalId
String getExternalId()Intended to hold any unique identifier not tied to the Broadleaf Database Sequence Identifier. For example, many implementations may integrate or import/export data from other systems that manage their own unique identifiers.- Returns:
- external ID
-
setExternalId
Sets a unique external ID- Parameters:
externalId-
-