com.elasticpath.domain.catalogview.impl
Class AbstractRangeFilterImpl

java.lang.Object
  extended by com.elasticpath.domain.impl.AbstractEpDomainImpl
      extended by com.elasticpath.domain.impl.AbstractTransientImpl
          extended by com.elasticpath.domain.catalogview.impl.AbstractFilterImpl
              extended by com.elasticpath.domain.catalogview.impl.AbstractRangeFilterImpl
All Implemented Interfaces:
BranchNode, Filter, RangeFilter, EpDomain, Transient, java.io.Serializable, java.lang.Comparable
Direct Known Subclasses:
AttributeRangeFilterImpl, PriceFilterImpl

public abstract class AbstractRangeFilterImpl
extends AbstractFilterImpl
implements RangeFilter

The abstract range filter implement.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.elasticpath.domain.impl.AbstractTransientImpl
serialVersionUID
 
Fields inherited from interface com.elasticpath.domain.catalogview.RangeFilter
ALL, AND, BETWEEN, LESSTHAN, LOWER_VALUE_POSITION, MORETHAN, RANGE_TOKENS, UPPER_VALUE_POSITION
 
Fields inherited from interface com.elasticpath.domain.catalogview.Filter
ERROR_MSG, SEPARATOR, SEPARATOR_IN_REGEX
 
Constructor Summary
AbstractRangeFilterImpl()
           
 
Method Summary
 void addChild(RangeFilter childFilter)
          Add the given filter as a child.
 void addDisplayInfo(java.util.Locale locale, FilterDisplayInfo displayInfo)
          Add a localized display info in the localized map.
abstract  int compareWithValue(java.lang.Object firstObj, java.lang.Object secondObj)
          Compare the given objs.
 boolean contains(RangeFilter rangeFilter)
          Returns true if this price filter contains the given price filter.
 java.util.Set getChildren()
          Get the children filters.
 FilterDisplayInfo getDisplayInfo(java.util.Locale locale)
          Get the localized display info map.
 java.lang.String getDisplayName(java.util.Locale locale)
          Returns the display name of the filter with the given locale.
 int getLevel()
          Get node level.
 java.util.Map getLocalizedDisplayMap()
          Get the localized display map.
 java.lang.Object getLowerValue()
          Returns the lower value of the filter.
 RangeFilter getParent()
          Get the parent filter of this filter.
 java.util.Stack getPath()
          Get the path from the root price filter to this node on the tree.
 java.lang.String getRangeType()
          Get the range type.
 java.lang.String getSeoName(java.util.Locale locale)
          This method is not used.
 java.lang.Object getUpperValue()
          Returns the upper value of the filter.
 boolean match(java.lang.Object obj)
          Check whether the given object falls into the range in this filter.
 void setLocalizedDisplayMap(java.util.Map displayMap)
          Set the localized display map.
 void setLowerValue(java.lang.Object lowerValue)
          Set the lower value for the range.
 void setParent(RangeFilter parent)
          Set the parent filter of this filter.
 void setRangeType(java.lang.String rangeType)
          Set the range type.
 void setUpperValue(java.lang.Object upperValue)
          Set the upper value for the range.
 
Methods inherited from class com.elasticpath.domain.catalogview.impl.AbstractFilterImpl
equals, filter, getId, getSeoId, hashCode, isLocalized, setId, setLocalized
 
Methods inherited from class com.elasticpath.domain.impl.AbstractEpDomainImpl
getElasticPath, setElasticPath
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.elasticpath.domain.catalogview.Filter
filter, getId, getSeoId, initialize, isLocalized, setId, setLocalized
 
Methods inherited from interface com.elasticpath.domain.EpDomain
getElasticPath, setElasticPath
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

AbstractRangeFilterImpl

public AbstractRangeFilterImpl()
Method Detail

addChild

public void addChild(RangeFilter childFilter)
Add the given filter as a child.

Specified by:
addChild in interface RangeFilter
Parameters:
childFilter - the filter to be added as a child

addDisplayInfo

public void addDisplayInfo(java.util.Locale locale,
                           FilterDisplayInfo displayInfo)
Add a localized display info in the localized map.

Specified by:
addDisplayInfo in interface RangeFilter
Parameters:
locale - the given locale.
displayInfo - the displayInfo.

compareWithValue

public abstract int compareWithValue(java.lang.Object firstObj,
                                     java.lang.Object secondObj)
Compare the given objs.

Parameters:
firstObj - the given object.
secondObj - the given value.
Returns:
0: equals, 1+ firstObj larger than the secondObj, -1- firstObj less than the secondObj.

contains

public boolean contains(RangeFilter rangeFilter)
Returns true if this price filter contains the given price filter.

Specified by:
contains in interface RangeFilter
Parameters:
rangeFilter - the price filter
Returns:
true if this price filter contains the given price filter

getChildren

public java.util.Set getChildren()
Get the children filters.

Specified by:
getChildren in interface RangeFilter
Returns:
the children filters as a set

getDisplayInfo

public FilterDisplayInfo getDisplayInfo(java.util.Locale locale)
Get the localized display info map.

Specified by:
getDisplayInfo in interface RangeFilter
Parameters:
locale - the given locale.
Returns:
the display info for this locale

getDisplayName

public java.lang.String getDisplayName(java.util.Locale locale)
Description copied from interface: Filter
Returns the display name of the filter with the given locale.

Specified by:
getDisplayName in interface Filter
Parameters:
locale - the given locale
Returns:
the display name

getLevel

public int getLevel()
Get node level. The root nodes will have level 1.
A node's level = it's parent node's level + 1

Specified by:
getLevel in interface BranchNode
Returns:
the category level

getLocalizedDisplayMap

public java.util.Map getLocalizedDisplayMap()
Get the localized display map.

Specified by:
getLocalizedDisplayMap in interface RangeFilter
Returns:
the displayMap

getLowerValue

public java.lang.Object getLowerValue()
Returns the lower value of the filter.

Specified by:
getLowerValue in interface RangeFilter
Returns:
the lower value of the filter.

getParent

public RangeFilter getParent()
Get the parent filter of this filter. Returns null if this filter is a root node.

Specified by:
getParent in interface RangeFilter
Returns:
the parent filter or null if it is a root node

getPath

public java.util.Stack getPath()
Get the path from the root price filter to this node on the tree.

Specified by:
getPath in interface BranchNode
Returns:
a stack contains the path, the root category is on the top.

getRangeType

public java.lang.String getRangeType()
Get the range type.

Specified by:
getRangeType in interface RangeFilter
Returns:
the rangeType

getSeoName

public java.lang.String getSeoName(java.util.Locale locale)
This method is not used.

Specified by:
getSeoName in interface Filter
Parameters:
locale - the locale
Returns:
the SEO url of the filter with the given locale.

getUpperValue

public java.lang.Object getUpperValue()
Returns the upper value of the filter.

Specified by:
getUpperValue in interface RangeFilter
Returns:
the upper value of the filter.

match

public boolean match(java.lang.Object obj)
Check whether the given object falls into the range in this filter. Generally, the given object should be a product.

Specified by:
match in interface Filter
Parameters:
obj - the given object.
Returns:
true: the given object falls into the range in this filter.

setLocalizedDisplayMap

public void setLocalizedDisplayMap(java.util.Map displayMap)
Set the localized display map.

Specified by:
setLocalizedDisplayMap in interface RangeFilter
Parameters:
displayMap - the displayMap to set

setLowerValue

public void setLowerValue(java.lang.Object lowerValue)
Set the lower value for the range.

Specified by:
setLowerValue in interface RangeFilter
Parameters:
lowerValue - the lowerValue to set

setParent

public void setParent(RangeFilter parent)
Set the parent filter of this filter.

Specified by:
setParent in interface RangeFilter
Parameters:
parent - the parent filter

setRangeType

public void setRangeType(java.lang.String rangeType)
Set the range type.

Specified by:
setRangeType in interface RangeFilter
Parameters:
rangeType - the rangeType to set

setUpperValue

public void setUpperValue(java.lang.Object upperValue)
Set the upper value for the range.

Specified by:
setUpperValue in interface RangeFilter
Parameters:
upperValue - the upperValue to set