org.broadleafcommerce.core.catalog.domain
Class CategoryImpl

java.lang.Object
  extended by org.broadleafcommerce.core.catalog.domain.CategoryImpl
All Implemented Interfaces:
java.io.Serializable, Category

@Entity
public class CategoryImpl
extends java.lang.Object
implements Category

Author:
bTaylor, Jeff Fischer
See Also:
Serialized Form

Field Summary
protected  java.util.Date activeEndDate
           
protected  java.util.Date activeStartDate
           
protected  java.util.List<Category> allChildCategories
           
protected  java.util.List<Category> allParentCategories
           
protected  java.util.List<Product> allProducts
           
protected  java.util.Map<java.lang.String,java.lang.String> categoryImages
          Deprecated. 
protected  java.util.Map<java.lang.String,Media> categoryMedia
           
protected  java.util.List<Category> childCategories
           
protected  java.util.Map<java.lang.String,java.util.List<java.lang.Long>> childCategoryURLMap
           
protected  Category defaultParentCategory
           
protected  java.lang.String description
           
protected  java.lang.String displayTemplate
           
protected  java.util.List<FeaturedProduct> featuredProducts
           
protected  java.lang.Long id
           
protected  java.lang.String longDescription
           
protected  java.lang.String name
           
protected  java.lang.String url
           
protected  java.lang.String urlKey
           
 
Constructor Summary
CategoryImpl()
           
 
Method Summary
 java.util.Map<java.lang.String,java.util.List<java.lang.Long>> createChildCategoryURLMap()
           
 boolean equals(java.lang.Object obj)
           
 java.util.Date getActiveEndDate()
          Gets the active end date.
 java.util.Date getActiveStartDate()
          Gets the active start date.
 java.util.List<Category> getAllChildCategories()
          Gets the child categories.
 java.util.List<Category> getAllParentCategories()
          Retrieve all parent categories
 java.util.List<Product> getAllProducts()
          Retrieve all the Product instances associated with this category.
 java.lang.String getCategoryImage(java.lang.String imageKey)
          Deprecated. 
 java.util.Map<java.lang.String,java.lang.String> getCategoryImages()
          Deprecated. 
 java.util.Map<java.lang.String,Media> getCategoryMedia()
          Gets the category media map.
 java.util.List<Category> getChildCategories()
          Gets the child categories.
 java.util.Map<java.lang.String,java.util.List<java.lang.Long>> getChildCategoryURLMap()
          Gets the child category url map.
 Category getDefaultParentCategory()
          Gets the default parent category.
 java.lang.String getDescription()
          Gets the description.
 java.lang.String getDisplayTemplate()
          Gets the display template.
 java.util.List<FeaturedProduct> getFeaturedProducts()
          Gets the featured products.
 java.lang.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.
 java.lang.Long getId()
          Gets the primary key.
 java.lang.String getLongDescription()
          Gets the long description.
 java.lang.String getName()
          Gets the name.
 java.lang.String getUrl()
          Gets the url.
 java.lang.String getUrlKey()
          Gets the url key.
 boolean hasAllChildCategories()
          Checks for child categories.
 boolean hasChildCategories()
          Checks for child categories.
 int hashCode()
           
 boolean isActive()
          Checks if is active.
 void setActiveEndDate(java.util.Date activeEndDate)
          Sets the active end date.
 void setActiveStartDate(java.util.Date activeStartDate)
          Sets the active start date.
 void setAllChildCategories(java.util.List<Category> childCategories)
          Sets the list of child categories (active and inactive)
 void setAllParentCategories(java.util.List<Category> allParentCategories)
          Sets the list of parent categories
 void setAllProducts(java.util.List<Product> allProducts)
          Set all the Product instances associated with this category.
 void setCategoryImages(java.util.Map<java.lang.String,java.lang.String> categoryImages)
          Deprecated. 
 void setCategoryMedia(java.util.Map<java.lang.String,Media> categoryMedia)
          Sets the category media.
 void setChildCategories(java.util.List<Category> childCategories)
          Sets the all child categories.
 void setChildCategoryURLMap(java.util.Map<java.lang.String,java.util.List<java.lang.Long>> childCategoryURLMap)
          Included to support the HydratedCacheJPAListener
 void setDefaultParentCategory(Category defaultParentCategory)
          Sets the default parent category.
 void setDescription(java.lang.String description)
          Sets the description.
 void setDisplayTemplate(java.lang.String displayTemplate)
          Sets the display template.
 void setFeaturedProducts(java.util.List<FeaturedProduct> featuredProducts)
          Sets the featured products.
 void setId(java.lang.Long id)
          Sets the primary key.
 void setLongDescription(java.lang.String longDescription)
          Sets the long description.
 void setName(java.lang.String name)
          Sets the name.
 void setUrl(java.lang.String url)
          Sets the url.
 void setUrlKey(java.lang.String urlKey)
          Sets the url key.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

protected java.lang.Long id

name

protected java.lang.String name

url

protected java.lang.String url

urlKey

protected java.lang.String urlKey

description

protected java.lang.String description

activeStartDate

protected java.util.Date activeStartDate

activeEndDate

protected java.util.Date activeEndDate

displayTemplate

protected java.lang.String displayTemplate

longDescription

protected java.lang.String longDescription

defaultParentCategory

protected Category defaultParentCategory

allChildCategories

protected java.util.List<Category> allChildCategories

allParentCategories

protected java.util.List<Category> allParentCategories

allProducts

protected java.util.List<Product> allProducts

categoryImages

@Deprecated
protected java.util.Map<java.lang.String,java.lang.String> categoryImages
Deprecated. 

categoryMedia

protected java.util.Map<java.lang.String,Media> categoryMedia

featuredProducts

protected java.util.List<FeaturedProduct> featuredProducts

childCategoryURLMap

protected java.util.Map<java.lang.String,java.util.List<java.lang.Long>> childCategoryURLMap

childCategories

protected java.util.List<Category> childCategories
Constructor Detail

CategoryImpl

public CategoryImpl()
Method Detail

getId

public java.lang.Long getId()
Description copied from interface: Category
Gets the primary key.

Specified by:
getId in interface Category
Returns:
the primary key

setId

public void setId(java.lang.Long id)
Description copied from interface: Category
Sets the primary key.

Specified by:
setId in interface Category
Parameters:
id - the new primary key

getName

public java.lang.String getName()
Description copied from interface: Category
Gets the name.

Specified by:
getName in interface Category
Returns:
the name

setName

public void setName(java.lang.String name)
Description copied from interface: Category
Sets the name.

Specified by:
setName in interface Category
Parameters:
name - the new name

getUrl

public java.lang.String getUrl()
Description copied from interface: Category
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.

Specified by:
getUrl in interface Category
Returns:
the url for the presentation layer component for this category

setUrl

public void setUrl(java.lang.String url)
Description copied from interface: Category
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.

Specified by:
setUrl in interface Category
Parameters:
url - the new url for the presentation layer component for this category

getUrlKey

public java.lang.String getUrlKey()
Description copied from interface: Category
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.

Specified by:
getUrlKey in interface Category
Returns:
the url key for this category to appear in the SEO url

getGeneratedUrl

public java.lang.String getGeneratedUrl()
Description copied from interface: Category
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.

Specified by:
getGeneratedUrl in interface Category
Returns:
the generated SEO url for this category

setUrlKey

public void setUrlKey(java.lang.String urlKey)
Description copied from interface: Category
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.

Specified by:
setUrlKey in interface Category
Parameters:
urlKey - the new url key for this category to appear in the SEO url

getDescription

public java.lang.String getDescription()
Description copied from interface: Category
Gets the description.

Specified by:
getDescription in interface Category
Returns:
the description

setDescription

public void setDescription(java.lang.String description)
Description copied from interface: Category
Sets the description.

Specified by:
setDescription in interface Category
Parameters:
description - the new description

getActiveStartDate

public java.util.Date getActiveStartDate()
Description copied from interface: Category
Gets the active start date. If the current date is before activeStartDate, then this category will not be visible on the site.

Specified by:
getActiveStartDate in interface Category
Returns:
the active start date

setActiveStartDate

public void setActiveStartDate(java.util.Date activeStartDate)
Description copied from interface: Category
Sets the active start date. If the current date is before activeStartDate, then this category will not be visible on the site.

Specified by:
setActiveStartDate in interface Category
Parameters:
activeStartDate - the new active start date

getActiveEndDate

public java.util.Date getActiveEndDate()
Description copied from interface: Category
Gets the active end date. If the current date is after activeEndDate, the this category will not be visible on the site.

Specified by:
getActiveEndDate in interface Category
Returns:
the active end date

setActiveEndDate

public void setActiveEndDate(java.util.Date activeEndDate)
Description copied from interface: Category
Sets the active end date. If the current date is after activeEndDate, the this category will not be visible on the site.

Specified by:
setActiveEndDate in interface Category
Parameters:
activeEndDate - the new active end date

isActive

public boolean isActive()
Description copied from interface: Category
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.

Specified by:
isActive in interface Category
Returns:
true, if is active

getDisplayTemplate

public java.lang.String getDisplayTemplate()
Description copied from interface: Category
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();

Specified by:
getDisplayTemplate in interface Category
Returns:
the display template

setDisplayTemplate

public void setDisplayTemplate(java.lang.String displayTemplate)
Description copied from interface: Category
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();

Specified by:
setDisplayTemplate in interface Category
Parameters:
displayTemplate - the new display template

getLongDescription

public java.lang.String getLongDescription()
Description copied from interface: Category
Gets the long description.

Specified by:
getLongDescription in interface Category
Returns:
the long description

setLongDescription

public void setLongDescription(java.lang.String longDescription)
Description copied from interface: Category
Sets the long description.

Specified by:
setLongDescription in interface Category
Parameters:
longDescription - the new long description

getDefaultParentCategory

public Category getDefaultParentCategory()
Description copied from interface: Category
Gets the default parent category.

Specified by:
getDefaultParentCategory in interface Category
Returns:
the default parent category

setDefaultParentCategory

public void setDefaultParentCategory(Category defaultParentCategory)
Description copied from interface: Category
Sets the default parent category.

Specified by:
setDefaultParentCategory in interface Category
Parameters:
defaultParentCategory - the new default parent category

getAllChildCategories

public java.util.List<Category> getAllChildCategories()
Description copied from interface: Category
Gets the child categories. This list includes all categories, regardless of whether or not they are active.

Specified by:
getAllChildCategories in interface Category
Returns:
the list of active and inactive child categories.

hasAllChildCategories

public boolean hasAllChildCategories()
Description copied from interface: Category
Checks for child categories.

Specified by:
hasAllChildCategories in interface Category
Returns:
true, if this category has any children (active or not)

setAllChildCategories

public void setAllChildCategories(java.util.List<Category> childCategories)
Description copied from interface: Category
Sets the list of child categories (active and inactive)

Specified by:
setAllChildCategories in interface Category
Parameters:
childCategories - the list of child categories

getChildCategories

public java.util.List<Category> getChildCategories()
Description copied from interface: Category
Gets the child categories. If child categories has not been previously set, then the list of active only categories will be returned.

Specified by:
getChildCategories in interface Category
Returns:
the list of active child categories

hasChildCategories

public boolean hasChildCategories()
Description copied from interface: Category
Checks for child categories.

Specified by:
hasChildCategories in interface Category
Returns:
true, if this category contains any active child categories.

setChildCategories

public void setChildCategories(java.util.List<Category> childCategories)
Description copied from interface: Category
Sets the all child categories. This should be a list of active only child categories.

Specified by:
setChildCategories in interface Category
Parameters:
childCategories - the list of active child categories.

getCategoryImages

@Deprecated
public java.util.Map<java.lang.String,java.lang.String> getCategoryImages()
Deprecated. 

Description copied from interface: Category
Gets the category images.

Specified by:
getCategoryImages in interface Category
Returns:
the category images

getCategoryImage

@Deprecated
public java.lang.String getCategoryImage(java.lang.String imageKey)
Deprecated. 

Description copied from interface: Category
Gets the category image.

Specified by:
getCategoryImage in interface Category
Parameters:
imageKey - the image key
Returns:
the category image

setCategoryImages

@Deprecated
public void setCategoryImages(java.util.Map<java.lang.String,java.lang.String> categoryImages)
Deprecated. 

Description copied from interface: Category
Sets the category images.

Specified by:
setCategoryImages in interface Category
Parameters:
categoryImages - the category images

getChildCategoryURLMap

public java.util.Map<java.lang.String,java.util.List<java.lang.Long>> getChildCategoryURLMap()
Description copied from interface: Category
Gets the child category url map. This map is keyed off of the Category.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.

Specified by:
getChildCategoryURLMap in interface Category
Returns:
the child category url map
See Also:
HydratedSetup

createChildCategoryURLMap

public java.util.Map<java.lang.String,java.util.List<java.lang.Long>> createChildCategoryURLMap()

setChildCategoryURLMap

public void setChildCategoryURLMap(java.util.Map<java.lang.String,java.util.List<java.lang.Long>> childCategoryURLMap)
Description copied from interface: Category
Included to support the HydratedCacheJPAListener

Specified by:
setChildCategoryURLMap in interface Category
See Also:
HydratedSetup

getAllParentCategories

public java.util.List<Category> getAllParentCategories()
Description copied from interface: Category
Retrieve all parent categories

Specified by:
getAllParentCategories in interface Category
Returns:
the list of parent categories

setAllParentCategories

public void setAllParentCategories(java.util.List<Category> allParentCategories)
Description copied from interface: Category
Sets the list of parent categories

Specified by:
setAllParentCategories in interface Category
Parameters:
allParentCategories - the list of parent categories

getFeaturedProducts

public java.util.List<FeaturedProduct> getFeaturedProducts()
Description copied from interface: Category
Gets the featured products. Featured products are a special list of products you would like to showcase for this category.

Specified by:
getFeaturedProducts in interface Category
Returns:
the featured products

setFeaturedProducts

public void setFeaturedProducts(java.util.List<FeaturedProduct> featuredProducts)
Description copied from interface: Category
Sets the featured products. Featured products are a special list of products you would like to showcase for this category.

Specified by:
setFeaturedProducts in interface Category
Parameters:
featuredProducts - the featured products

getAllProducts

public java.util.List<Product> getAllProducts()
Description copied from interface: Category
Retrieve all the Product instances associated with this category.

Specified by:
getAllProducts in interface Category
Returns:
the list of products associated with this category.

setAllProducts

public void setAllProducts(java.util.List<Product> allProducts)
Description copied from interface: Category
Set all the Product instances associated with this category.

Specified by:
setAllProducts in interface Category
Parameters:
allProducts - the list of products to associate with this category

getCategoryMedia

public java.util.Map<java.lang.String,Media> getCategoryMedia()
Description copied from interface: Category
Gets the category media map. The key is of arbitrary meaning and the Media instance stores information about the media itself (image url, etc...)

Specified by:
getCategoryMedia in interface Category
Returns:
the category Media

setCategoryMedia

public void setCategoryMedia(java.util.Map<java.lang.String,Media> categoryMedia)
Description copied from interface: Category
Sets the category media. The key is of arbitrary meaning and the Media instance stores information about the media itself (image url, etc...)

Specified by:
setCategoryMedia in interface Category
Parameters:
categoryMedia - the category media

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object


Copyright © 2012. All Rights Reserved.