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
 Date getActiveEndDate()
          Gets the active end date.
 Date getActiveStartDate()
          Gets the active start date.
 List<Category> getAllChildCategories()
          Gets the child categories.
 List<Category> getAllParentCategories()
          Retrieve all parent categories
 List<Product> getAllProducts()
          Retrieve all the Product instances associated with 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()
          Gets the child categories.
 Map<String,List<Long>> getChildCategoryURLMap()
          Gets the child category url map.
 Category getDefaultParentCategory()
          Gets the default parent category.
 String getDescription()
          Gets the description.
 String getDisplayTemplate()
          Gets the display template.
 List<FeaturedProduct> getFeaturedProducts()
          Gets the featured products.
 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.
 String getLongDescription()
          Gets the long description.
 String getName()
          Gets the name.
 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)
          Sets the list of child categories (active and inactive)
 void setAllParentCategories(List<Category> allParentCategories)
          Sets the list of parent categories
 void setAllProducts(List<Product> allProducts)
          Set all the Product instances associated with this category.
 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)
          Sets the all child categories.
 void setChildCategoryURLMap(Map<String,List<Long>> childCategoryURLMap)
          Included to support the HydratedCacheJPAListener
 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 setFeaturedProducts(List<FeaturedProduct> featuredProducts)
          Sets the featured products.
 void setId(Long id)
          Sets the primary key.
 void setLongDescription(String longDescription)
          Sets the long description.
 void setName(String name)
          Sets the name.
 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

getAllParentCategories

@Nonnull
List<Category> getAllParentCategories()
Retrieve all parent categories

Returns:
the list of parent categories

setAllParentCategories

void setAllParentCategories(@Nonnull
                            List<Category> allParentCategories)
Sets the list of parent categories

Parameters:
allParentCategories - the list of parent categories

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 is returned.

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

@Nonnull
Map<String,List<Long>> getChildCategoryURLMap()
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 lifecycle for this map is maintained via the HydratedCacheJPAListener. This listener keeps this map in a separate cache from the normal Hibernate level 2 cache, but will honor cache region settings for this entity, resulting in this map being evicted from its cache when this entity is removed from the Hibernate level 2 cache.

Returns:
the child category url map
See Also:
HydratedSetup

setChildCategoryURLMap

void setChildCategoryURLMap(@Nonnull
                            Map<String,List<Long>> childCategoryURLMap)
Included to support the HydratedCacheJPAListener

Parameters:
childCategoryURLMap -
See Also:
HydratedSetup

getAllChildCategories

@Nonnull
List<Category> getAllChildCategories()
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

void setAllChildCategories(@Nonnull
                           List<Category> childCategories)
Sets the list of child categories (active and inactive)

Parameters:
childCategories - the list of child categories

getChildCategories

@Nonnull
List<Category> getChildCategories()
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

hasChildCategories

boolean hasChildCategories()
Checks for child categories.

Returns:
true, if this category contains any active child categories.

setChildCategories

void setChildCategories(@Nonnull
                        List<Category> childCategories)
Sets the all child categories. This should be a list of active only child categories.

Parameters:
childCategories - the list of active child categories.

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

getAllProducts

@Nonnull
List<Product> getAllProducts()
Retrieve all the Product instances associated with this category.

Returns:
the list of products associated with this category.

setAllProducts

void setAllProducts(@Nonnull
                    List<Product> allProducts)
Set all the Product instances associated with this category.

Parameters:
allProducts - the list of products to associate with this category


Copyright © 2012. All Rights Reserved.