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 CategoryImpl.
Author:
btaylor, Jeff Fischer
  • Method Details

    • 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
    • getProductTitlePatternOverride

      String getProductTitlePatternOverride()
    • setProductTitlePatternOverride

      void setProductTitlePatternOverride(String productTitlePatternOverride)
    • getProductDescriptionPatternOverride

      String getProductDescriptionPatternOverride()
    • setProductDescriptionPatternOverride

      void setProductDescriptionPatternOverride(String productDescriptionPatternOverride)
    • getDefaultParentCategory

      @Deprecated @Nullable Category getDefaultParentCategory()
      Deprecated.
      Gets the default parent category. This method will delegate to getParentCategory() 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 void setDefaultParentCategory(@Nullable Category defaultParentCategory)
      Deprecated.
      Sets the default parent category. This method will delegate to setParentCategory(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

      void setParentCategory(Category category)
      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

      @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
    • getOverrideGeneratedUrl

      Boolean getOverrideGeneratedUrl()
      Returns:
      the flag for whether or not the URL should not be generated in the admin
    • setOverrideGeneratedUrl

      void setOverrideGeneratedUrl(Boolean overrideGeneratedUrl)
      Sets the flag for whether or not the URL should not be generated in the admin
      Parameters:
      overrideGeneratedUrl -
    • 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
    • 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
    • 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
    • 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 -
    • getCategoryMedia

      @Nonnull @Deprecated Map<String,org.broadleafcommerce.common.media.domain.Media> getCategoryMedia()
      Deprecated.
      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

      @Deprecated void setCategoryMedia(@Nonnull Map<String,org.broadleafcommerce.common.media.domain.Media> categoryMedia)
      Deprecated.
      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
    • getCategoryMediaXref

      Map<String,CategoryMediaXref> getCategoryMediaXref()
      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
    • setCategoryMediaXref

      void setCategoryMediaXref(Map<String,CategoryMediaXref> categoryMediaXref)
      Sets the category media. The key is of arbitrary meaning and the Media instance stores information about the media itself (image url, etc...)
      Parameters:
      categoryMediaXref - 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
    • getMetaTitle

      String getMetaTitle()
      Gets the meta data title of the category
      Returns:
    • setMetaTitle

      void setMetaTitle(String metaTitle)
      Sets the meta data title of the category
      Parameters:
      metaTitle -
    • getMetaDescription

      String getMetaDescription()
      Gets the meta data description of the category
      Returns:
    • setMetaDescription

      void setMetaDescription(String metaDescription)
      Sets the meta data description of the category
      Parameters:
      metaDescription -
    • 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:
    • 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:
    • 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 -
    • getExcludedSearchFacets

      List<CategoryExcludedSearchFacet> getExcludedSearchFacets()
      Gets the excluded SearchFacets
      Returns:
      the excluded SearchFacets
    • setExcludedSearchFacets

      void setExcludedSearchFacets(List<CategoryExcludedSearchFacet> 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 -
    • 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
    • getCumulativeSearchFacets

      List<CategorySearchFacet> 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. 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.

      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

      List<Category> buildDefaultParentCategoryPath(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:
    • getParentCategoryHierarchy

      List<Category> getParentCategoryHierarchy(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
    • getParentCategoryHierarchy

      List<Category> getParentCategoryHierarchy(List<Category> currentHierarchy, Boolean firstParent)
      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 this Category. In smaller sites, using these attributes might be preferred to extending the domain object itself.
      Returns:
    • setCategoryAttributesMap

      void setCategoryAttributesMap(Map<String,CategoryAttribute> categoryAttributes)
    • getCategoryAttributes

      @Deprecated 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:
    • setCategoryAttributes

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

      @Deprecated CategoryAttribute getCategoryAttributeByName(String name)
      Deprecated.
      This will be removed in 3.1.0
      Convenience method to get a CategoryAttribute by name
      Parameters:
      name -
      Returns:
    • getMappedCategoryAttributes

      @Deprecated 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:
    • getMultiValueCategoryAttributes

      Map<String,CategoryAttribute> getMultiValueCategoryAttributes()
    • getInventoryType

      InventoryType getInventoryType()
      Used to determine availability for all of the products/skus in 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.
    • 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
    • hasAllChildCategories

      boolean hasAllChildCategories()
      Checks for child categories.
      Returns:
      true, if this category has any children (active or not)
    • 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
    • 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.
    • 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.
    • getAllChildCategoryXrefs

      List<CategoryXref> getAllChildCategoryXrefs()
    • setAllChildCategoryXrefs

      void setAllChildCategoryXrefs(List<CategoryXref> childCategories)
    • getChildCategoryXrefs

      List<CategoryXref> getChildCategoryXrefs()
    • setChildCategoryXrefs

      void setChildCategoryXrefs(List<CategoryXref> childCategories)
    • getAllParentCategoryXrefs

      List<CategoryXref> getAllParentCategoryXrefs()
      Retrieve all the xref entities linking this category to parent categories
    • setAllParentCategoryXrefs

      void setAllParentCategoryXrefs(List<CategoryXref> allParentCategories)
      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

      void setRootDisplayOrder(BigDecimal rootDisplayOrder)
      Set the displayOrder that is used if the Category does not have any parents
    • 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
    • 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 -
    • 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

      void setExternalId(String externalId)
      Sets a unique external ID
      Parameters:
      externalId -