org.broadleafcommerce.core.catalog.domain
Interface Category

All Superinterfaces:
Serializable
All Known Implementing Classes:
CategoryImpl

public interface Category
extends Serializable

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 CategoryImpl.

Author:
btaylor, Jeff Fischer
See Also:
CategoryImpl}

Method Summary
 List<Category> buildCategoryHierarchy(List<Category> currentHierarchy)
          Build category hierarchy by walking the default category tree up to the root category.
 List<Category> buildFullCategoryHierarchy(List<Category> currentHierarchy)
          Build the full category hierarchy by walking up the default category tree and the all parent category tree.
 Date getActiveEndDate()
          Gets the active end date.
 List<Product> getActiveProducts()
          Deprecated. Use getActiveProductXrefs() instead.
 List<CategoryProductXref> getActiveProductXrefs()
           
 Date getActiveStartDate()
          Gets the active start date.
 List<Category> getAllChildCategories()
          Deprecated. use getAllChildCategoryXrefs() instead.
 List<CategoryXref> getAllChildCategoryXrefs()
           
 List<Category> getAllParentCategories()
          Deprecated. Use getAllParentCategoryXrefs() instead.
 List<CategoryXref> getAllParentCategoryXrefs()
           
 List<Product> getAllProducts()
          Deprecated. Use getAllProductXrefs() instead.
 List<CategoryProductXref> getAllProductXrefs()
           
 CategoryAttribute getCategoryAttributeByName(String name)
          Deprecated. This will be removed in 3.1.0
 List<CategoryAttribute> getCategoryAttributes()
          Deprecated. This will be replaced with getCategoryAttributesMap() in 3.1.0.
 Map<String,CategoryAttribute> getCategoryAttributesMap()
          Gets the attributes for this Category.
 String getCategoryImage(String imageKey)
          Deprecated. replaced by getCategoryMedia()
 Map<String,String> getCategoryImages()
          Deprecated. replaced by getCategoryMedia()
 Map<String,Media> getCategoryMedia()
          Gets the category media map.
 List<Category> getChildCategories()
          Deprecated. Use getChildCategoryXrefs() instead.
 List<Long> getChildCategoryIds()
          Gets the child category ids.
 Map<String,List<Long>> getChildCategoryURLMap()
          Deprecated. This approach is inherently inefficient and should no longer be used
 List<CategoryXref> getChildCategoryXrefs()
           
 List<RelatedProduct> getCrossSaleProducts()
          Returns a list of cross sale products that are related to this category.
 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.
 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.
 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.
 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.
 Category getDefaultParentCategory()
          Gets the default parent category.
 String getDescription()
          Gets the description.
 String getDisplayTemplate()
          Gets the display template.
 List<SearchFacet> getExcludedSearchFacets()
          Gets the excluded SearchFacets
 List<FeaturedProduct> getFeaturedProducts()
          Gets the featured products.
 FulfillmentType getFulfillmentType()
          Returns the default fulfillment type for skus in this category.
 String getGeneratedUrl()
          Creates the SEO url starting from this category and recursing up the hierarchy of default parent categories until the topmost category is reached.
 Long getId()
          Gets the primary key.
 InventoryType getInventoryType()
          Returns the type of inventory for this category
 String getLongDescription()
          Gets the long description.
 Map<String,CategoryAttribute> getMappedCategoryAttributes()
          Deprecated. This will be removed in 3.1.0
 String getName()
          Gets the name.
 List<CategorySearchFacet> getSearchFacets()
          Returns all of the SearchFacets that are directly associated with this Category
 String getTaxCode()
          Returns the tax code of this category.
 List<RelatedProduct> getUpSaleProducts()
          Returns a list of cross sale products that are related to this category.
 String getUrl()
          Gets the url.
 String getUrlKey()
          Gets the url key.
 boolean hasAllChildCategories()
          Checks for child categories.
 boolean hasChildCategories()
          Checks for child categories.
 boolean isActive()
          Checks if is active.
 void setActiveEndDate(Date activeEndDate)
          Sets the active end date.
 void setActiveStartDate(Date activeStartDate)
          Sets the active start date.
 void setAllChildCategories(List<Category> childCategories)
          Deprecated. Use setAllChildCategoryXrefs() instead.
 void setAllChildCategoryXrefs(List<CategoryXref> childCategories)
           
 void setAllParentCategories(List<Category> allParentCategories)
          Deprecated. Use setAllParentCategoryXrefs() instead.
 void setAllParentCategoryXrefs(List<CategoryXref> allParentCategories)
           
 void setAllProducts(List<Product> allProducts)
          Deprecated. Use setAllProductXrefs() instead.
 void setAllProductXrefs(List<CategoryProductXref> allProducts)
           
 void setCategoryAttributes(List<CategoryAttribute> categoryAttributes)
          Deprecated. This will be replaced with #setCategoryAttributesMap() in 3.1.0.
 void setCategoryAttributesMap(Map<String,CategoryAttribute> categoryAttributes)
           
 void setCategoryImages(Map<String,String> categoryImages)
          Deprecated. replaced by setCategoryMedia(java.util.Map)
 void setCategoryMedia(Map<String,Media> categoryMedia)
          Sets the category media.
 void setChildCategories(List<Category> childCategories)
          Deprecated. Use setChildCategoryXrefs() instead.
 void setChildCategoryIds(List<Long> childCategoryIds)
          Sets the all child category ids.
 void setChildCategoryURLMap(Map<String,List<Long>> childCategoryURLMap)
          Deprecated. This approach is inherently inefficient and should no longer be used
 void setChildCategoryXrefs(List<CategoryXref> childCategories)
           
 void setCrossSaleProducts(List<RelatedProduct> crossSaleProducts)
          Sets the cross sale products that are related to this category.
 void setDefaultParentCategory(Category defaultParentCategory)
          Sets the default parent category.
 void setDescription(String description)
          Sets the description.
 void setDisplayTemplate(String displayTemplate)
          Sets the display template.
 void setExcludedSearchFacets(List<SearchFacet> excludedSearchFacets)
          Sets the SearchFacets that should not be rendered by this Category.
 void setFeaturedProducts(List<FeaturedProduct> featuredProducts)
          Sets the featured products.
 void setFulfillmentType(FulfillmentType fulfillmentType)
          Sets the default fulfillment type for skus in this category.
 void setId(Long id)
          Sets the primary key.
 void setInventoryType(InventoryType inventoryType)
          Sets the type of inventory for this category
 void setLongDescription(String longDescription)
          Sets the long description.
 void setName(String name)
          Sets the name.
 void setSearchFacets(List<CategorySearchFacet> searchFacets)
          Sets the SearchFacets that are directly associated with this Category
 void setTaxCode(String taxCode)
          Sets the tax code of this category.
 void setUpSaleProducts(List<RelatedProduct> upSaleProducts)
          Sets the upsale products that are related to this category.
 void setUrl(String url)
          Sets the url.
 void setUrlKey(String urlKey)
          Sets the url key.
 

Method Detail

getId

@Nullable
Long getId()
Gets the primary key.

Returns:
the primary key

setId

void setId(@Nullable
           Long id)
Sets the primary key.

Parameters:
id - the new primary key

getName

@Nonnull
String getName()
Gets the name.

Returns:
the name

setName

void setName(@Nonnull
             String name)
Sets the name.

Parameters:
name - the new name

getDefaultParentCategory

@Nullable
Category getDefaultParentCategory()
Gets the default parent category.

Returns:
the default parent category

setDefaultParentCategory

void setDefaultParentCategory(@Nullable
                              Category defaultParentCategory)
Sets the default parent category.

Parameters:
defaultParentCategory - the new default parent category

getUrl

@Nullable
String 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

void setUrl(@Nullable
            String url)
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

getUrlKey

@Nullable
String 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

getGeneratedUrl

@Nullable
String 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

setUrlKey

void setUrlKey(@Nullable
               String urlKey)
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

getDescription

@Nullable
String getDescription()
Gets the description.

Returns:
the description

setDescription

void setDescription(@Nullable
                    String description)
Sets the description.

Parameters:
description - the new description

getActiveStartDate

@Nullable
Date 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

void setActiveStartDate(@Nullable
                        Date activeStartDate)
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

@Nullable
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

void setActiveEndDate(@Nullable
                      Date activeEndDate)
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

@Nullable
String 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

void setDisplayTemplate(@Nullable
                        String displayTemplate)
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
@Nonnull
Map<String,List<Long>> getChildCategoryURLMap()
Deprecated. This approach is inherently inefficient and should no longer be used

Gets the child category url map. This map is keyed off of the getGeneratedUrl() 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
void setChildCategoryURLMap(@Nonnull
                                       Map<String,List<Long>> childCategoryURLMap)
Deprecated. This approach is inherently inefficient and should no longer be used

Set the child category url map. This approach is inefficient, so its use is highly discouraged.

Parameters:
childCategoryURLMap -

getCategoryImages

@Deprecated
@Nonnull
Map<String,String> getCategoryImages()
Deprecated. replaced by getCategoryMedia()

Gets the category images.

Returns:
the category images

getCategoryImage

@Deprecated
@Nullable
String getCategoryImage(@Nonnull
                                            String imageKey)
Deprecated. replaced by getCategoryMedia()

Gets the category image.

Parameters:
imageKey - the image key
Returns:
the category image

setCategoryImages

@Deprecated
void setCategoryImages(@Nonnull
                                  Map<String,String> categoryImages)
Deprecated. replaced by setCategoryMedia(java.util.Map)

Sets the category images.

Parameters:
categoryImages - the category images

getCategoryMedia

@Nonnull
Map<String,Media> getCategoryMedia()
Gets the category media map. The key is of arbitrary meaning and the Media instance stores information about the media itself (image url, etc...)

Returns:
the category Media

setCategoryMedia

void setCategoryMedia(@Nonnull
                      Map<String,Media> categoryMedia)
Sets the category media. The key is of arbitrary meaning and the Media instance stores information about the media itself (image url, etc...)

Parameters:
categoryMedia - the category media

getLongDescription

@Nullable
String getLongDescription()
Gets the long description.

Returns:
the long description

setLongDescription

void setLongDescription(@Nullable
                        String longDescription)
Sets the long description.

Parameters:
longDescription - the new long description

getFeaturedProducts

@Nonnull
List<FeaturedProduct> 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

void setFeaturedProducts(@Nonnull
                         List<FeaturedProduct> featuredProducts)
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

void setCrossSaleProducts(List<RelatedProduct> crossSaleProducts)
Sets the cross sale products that are related to this category.

Parameters:
crossSaleProducts -
See Also:
getCrossSaleProducts()

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

void setUpSaleProducts(List<RelatedProduct> upSaleProducts)
Sets the upsale products that are related to this category.

Parameters:
upSaleProducts -
See Also:
getUpSaleProducts()

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

void setSearchFacets(List<CategorySearchFacet> searchFacets)
Sets the SearchFacets that are directly associated with this Category

Parameters:
searchFacets -

setExcludedSearchFacets

void setExcludedSearchFacets(List<SearchFacet> excludedSearchFacets)
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 -

getExcludedSearchFacets

List<SearchFacet> getExcludedSearchFacets()
Gets the excluded SearchFacets

Returns:
the excluded SearchFacets

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 the CategorySearchFacet#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

buildCategoryHierarchy

List<Category> buildCategoryHierarchy(List<Category> currentHierarchy)
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:

buildFullCategoryHierarchy

List<Category> buildFullCategoryHierarchy(List<Category> currentHierarchy)
Build the full category hierarchy by walking up the default category tree and the all parent category tree.

Parameters:
currentHierarchy -
Returns:
the full hierarchy

getCategoryAttributesMap

Map<String,CategoryAttribute> getCategoryAttributesMap()
Gets the attributes for this Category. In smaller sites, using these attributes might be preferred to extending the domain object itself.

Returns:
See Also:
#getMappedCategoryAttributes()}

setCategoryAttributesMap

void setCategoryAttributesMap(Map<String,CategoryAttribute> categoryAttributes)

getCategoryAttributes

List<CategoryAttribute> getCategoryAttributes()
Deprecated. This will be replaced with getCategoryAttributesMap() in 3.1.0.

Gets the attributes for this Category. In smaller sites, using these attributes might be preferred to extending the domain object itself.

Returns:
See Also:
#getMappedCategoryAttributes()}

setCategoryAttributes

void setCategoryAttributes(List<CategoryAttribute> categoryAttributes)
Deprecated. This will be replaced with #setCategoryAttributesMap() in 3.1.0.

Sets the attributes for this Category. In smaller sites, using these attributes might be preferred to extending the domain object and creating a new table to store custom properties.


getCategoryAttributeByName

CategoryAttribute getCategoryAttributeByName(String name)
Deprecated. This will be removed in 3.1.0

Convenience method to get a CategoryAttribute by name

Parameters:
name -
Returns:
See Also:
#getCategoryAttributes()}, {@link #getMappedCategoryAttributes()}

getMappedCategoryAttributes

Map<String,CategoryAttribute> getMappedCategoryAttributes()
Deprecated. This will be removed in 3.1.0

Convenience method to return the CategoryAttributes for the Category in an easily-consumable form

Returns:

getInventoryType

InventoryType getInventoryType()
Returns the type of inventory for this category

Returns:
the InventoryType for this category

setInventoryType

void setInventoryType(InventoryType inventoryType)
Sets the type of inventory for this category

Parameters:
inventoryType - the InventoryType for this category

getFulfillmentType

FulfillmentType getFulfillmentType()
Returns the default fulfillment type for skus in this category. May be null.

Returns:

setFulfillmentType

void setFulfillmentType(FulfillmentType fulfillmentType)
Sets the default fulfillment type for skus in this category. May return null.

Parameters:
fulfillmentType -

getAllChildCategories

@Nonnull
@Deprecated
List<Category> 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.

hasAllChildCategories

boolean hasAllChildCategories()
Checks for child categories.

Returns:
true, if this category has any children (active or not)

setAllChildCategories

@Deprecated
void setAllChildCategories(@Nonnull
                                      List<Category> childCategories)
Deprecated. Use setAllChildCategoryXrefs() instead.

Sets the list of child categories (active and inactive)

Parameters:
childCategories - the list of child categories

getChildCategories

@Deprecated
@Nonnull
List<Category> 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

getChildCategoryIds

@Nonnull
List<Long> 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

void setChildCategoryIds(@Nonnull
                         List<Long> childCategoryIds)
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.

setChildCategories

@Deprecated
void setChildCategories(@Nonnull
                                   List<Category> childCategories)
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.

getAllChildCategoryXrefs

List<CategoryXref> getAllChildCategoryXrefs()

getChildCategoryXrefs

List<CategoryXref> getChildCategoryXrefs()

setChildCategoryXrefs

void setChildCategoryXrefs(List<CategoryXref> childCategories)

setAllChildCategoryXrefs

void setAllChildCategoryXrefs(List<CategoryXref> childCategories)

getAllParentCategoryXrefs

List<CategoryXref> getAllParentCategoryXrefs()

setAllParentCategoryXrefs

void setAllParentCategoryXrefs(List<CategoryXref> allParentCategories)

getAllParentCategories

@Deprecated
@Nonnull
List<Category> getAllParentCategories()
Deprecated. Use getAllParentCategoryXrefs() instead.

Retrieve all parent categories

Returns:
the list of parent categories

setAllParentCategories

@Deprecated
void setAllParentCategories(@Nonnull
                                       List<Category> allParentCategories)
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

void setAllProductXrefs(List<CategoryProductXref> allProducts)

getActiveProducts

@Deprecated
List<Product> getActiveProducts()
Deprecated. Use getActiveProductXrefs() instead.

Convenience method to retrieve all of this Category's Products filtered by active. If you want all of the Products (whether inactive or not) consider using getAllProducts().

Returns:
the list of active Products for this Category
See Also:
Product#isActive()}

getAllProducts

@Deprecated
@Nonnull
List<Product> getAllProducts()
Deprecated. Use getAllProductXrefs() instead.

Retrieve all the Product instances associated with this category.
Note: this method does not take into account whether or not the Products are active or not. If you need this functionality, use getActiveProducts()

Returns:
the list of products associated with this category.

setAllProducts

@Deprecated
void setAllProducts(@Nonnull
                               List<Product> allProducts)
Deprecated. Use setAllProductXrefs() instead.

Set all the Product instances 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

void setTaxCode(String taxCode)
Sets the tax code of this category.

Parameters:
taxCode -


Copyright © 2013. All Rights Reserved.