com.elasticpath.domain.catalogview.impl
Class AbstractCatalogViewResultImpl

java.lang.Object
  extended by com.elasticpath.domain.impl.AbstractEpDomainImpl
      extended by com.elasticpath.domain.impl.AbstractTransientImpl
          extended by com.elasticpath.domain.catalogview.impl.AbstractCatalogViewResultImpl
All Implemented Interfaces:
CatalogViewResult, EpDomain, Transient, java.io.Serializable
Direct Known Subclasses:
BrowsingResultImpl, SearchResultImpl

public abstract class AbstractCatalogViewResultImpl
extends AbstractTransientImpl
implements CatalogViewResult

This is an abstract implementation of CatalogViewResult. It can be extended to create a concrete catalog view result for a search request or a catalog browsing request.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
          Serial version id.
 
Constructor Summary
AbstractCatalogViewResultImpl()
          Default Constructor.
 
Method Summary
 java.util.Map getAttributeFilterOptions()
          Returns a list of filter options on attribute.
 java.util.List getAttributeRangeFilterOptions(Attribute attribute)
          Return a list of attribute range filters for the given attribute.
 java.util.List getAttributeValueFilterOptions(Attribute attribute)
          Returns a list of filter options on the given Attribute.
 java.util.List getBrandFilterOptions()
          Returns a list of filter options on brand.
 CatalogViewRequest getCatalogViewRequest()
          Returns the catalog view request which generated this search result.
 Category getCategory()
          Returns the category.
 java.util.Map getDiversedAttributeValueFilters(java.util.List products, Attribute attribute)
          This method traverse the given products and try to find the diversed values with the given attribute.
 java.util.Map getDiversedBrands(java.util.List products)
          This method traverse the given products and try to find the diversed brands with the number of products belongs to each brand.
 java.util.List getFeaturedProducts()
          Returns a list of featured products, this list is by default sorted by featured product order.
 FilterFactory getFilterFactory()
          Returns the search filter factory.
 java.util.List getPriceFilterOptions()
          Returns a list of filter options on price range.
 java.util.List getProducts()
          Returns a list of products as the search result.
 java.util.List getSortedProducts()
          Returns a list of products as the search result.
 java.util.Map getTopBranchNodes(java.util.List leafNodes)
          This method traverse the given leaf nodes and will try to find the top branches with the number of leaf nodes falling in each branch.
 void replicateData(CatalogViewResult catalogViewResult)
          Replicate the data to this CatalogViewResult from the given CatalogViewResult.
 void setCatalogViewRequest(CatalogViewRequest catalogViewRequest)
          Sets the catalog view request which generated this search result.
 void setCategory(Category category)
          Sets the category.
 void setFeaturedProducts(java.util.List featuredProducts)
          Sets a list of featured products.
 void setFilterFactory(FilterFactory filterFactory)
          Sets the search filter factory.
 void setProducts(java.util.List products)
          Sets a list of products as the search result.
 
Methods inherited from class com.elasticpath.domain.impl.AbstractEpDomainImpl
getElasticPath, setElasticPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.elasticpath.domain.EpDomain
getElasticPath, setElasticPath
 

Field Detail

serialVersionUID

public static final long serialVersionUID
Serial version id.

See Also:
Constant Field Values
Constructor Detail

AbstractCatalogViewResultImpl

public AbstractCatalogViewResultImpl()
Default Constructor.

Method Detail

getAttributeFilterOptions

public java.util.Map getAttributeFilterOptions()
Returns a list of filter options on attribute.

Returns:
a list of filter options on attribute.

getAttributeRangeFilterOptions

public java.util.List getAttributeRangeFilterOptions(Attribute attribute)
Return a list of attribute range filters for the given attribute. The attribute has a range defined.

Parameters:
attribute - the given attribute.
Returns:
the list of attribute range filters

getAttributeValueFilterOptions

public java.util.List getAttributeValueFilterOptions(Attribute attribute)
Returns a list of filter options on the given Attribute.

Parameters:
attribute - the given attribute object.
Returns:
a list of filter options on the given attribute.

getBrandFilterOptions

public java.util.List getBrandFilterOptions()
Returns a list of filter options on brand.

Specified by:
getBrandFilterOptions in interface CatalogViewResult
Returns:
a list of filter options on brand.

getCatalogViewRequest

public CatalogViewRequest getCatalogViewRequest()
Returns the catalog view request which generated this search result.

Specified by:
getCatalogViewRequest in interface CatalogViewResult
Returns:
the catalog view request

getCategory

public Category getCategory()
Returns the category.

Specified by:
getCategory in interface CatalogViewResult
Returns:
the category.

getDiversedAttributeValueFilters

public java.util.Map getDiversedAttributeValueFilters(java.util.List products,
                                                      Attribute attribute)
This method traverse the given products and try to find the diversed values with the given attribute. If all given products has the same value on an attribute, an empty map will be returned.

Parameters:
products - a products list
attribute - the given attribute
Returns:
a Map contains attribute values. Attribute Value is the key, and the number of products with same value.

getDiversedBrands

public java.util.Map getDiversedBrands(java.util.List products)
This method traverse the given products and try to find the diversed brands with the number of products belongs to each brand. If all given products fall into one brand, an empty map will be returned.

Parameters:
products - a products list
Returns:
a Map contains brands. Brand is the key, and the number of products under that Brand as value.

getFeaturedProducts

public java.util.List getFeaturedProducts()
Returns a list of featured products, this list is by default sorted by featured product order.

Specified by:
getFeaturedProducts in interface CatalogViewResult
Returns:
a list of featured products

getFilterFactory

public FilterFactory getFilterFactory()
Returns the search filter factory.

Returns:
the search filter factory.

getPriceFilterOptions

public java.util.List getPriceFilterOptions()
Returns a list of filter options on price range.

Specified by:
getPriceFilterOptions in interface CatalogViewResult
Returns:
a list of filter options on price range.

getProducts

public java.util.List getProducts()
Returns a list of products as the search result.

Specified by:
getProducts in interface CatalogViewResult
Returns:
a list of products as the search result.

getSortedProducts

public java.util.List getSortedProducts()
Returns a list of products as the search result. This list has been sorted based on the sorter specified in CatalogViewRequest.

Specified by:
getSortedProducts in interface CatalogViewResult
Returns:
a list of products as the search result.

getTopBranchNodes

public java.util.Map getTopBranchNodes(java.util.List leafNodes)
This method traverse the given leaf nodes and will try to find the top branches with the number of leaf nodes falling in each branch. If all given leaf nodes fall into one branch node, an empty map will be returned.

Parameters:
leafNodes - a leaf nodes list
Returns:
a Map contains branch nodes. BranchNode is the key, and the number of leaf nodes under that BranchNode as value.

replicateData

public void replicateData(CatalogViewResult catalogViewResult)
Replicate the data to this CatalogViewResult from the given CatalogViewResult.

Specified by:
replicateData in interface CatalogViewResult
Parameters:
catalogViewResult - the CatalogViewResult to be replicated

setCatalogViewRequest

public void setCatalogViewRequest(CatalogViewRequest catalogViewRequest)
Sets the catalog view request which generated this search result.

Specified by:
setCatalogViewRequest in interface CatalogViewResult
Parameters:
catalogViewRequest - the catalog view request

setCategory

public void setCategory(Category category)
Sets the category.

Specified by:
setCategory in interface CatalogViewResult
Parameters:
category - the category to set

setFeaturedProducts

public void setFeaturedProducts(java.util.List featuredProducts)
Sets a list of featured products.

Specified by:
setFeaturedProducts in interface CatalogViewResult
Parameters:
featuredProducts - a list of featured products

setFilterFactory

public void setFilterFactory(FilterFactory filterFactory)
Sets the search filter factory.

Parameters:
filterFactory - the search filter factory.

setProducts

public void setProducts(java.util.List products)
Sets a list of products as the search result.

Specified by:
setProducts in interface CatalogViewResult
Parameters:
products - a list of products as the search result.