com.elasticpath.domain.catalogview.impl
Class PriceFilterImpl

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
                  extended by com.elasticpath.domain.catalogview.impl.PriceFilterImpl
All Implemented Interfaces:
BranchNode, Filter, PriceFilter, RangeFilter, EpDomain, Transient, java.io.Serializable, java.lang.Comparable

public class PriceFilterImpl
extends AbstractRangeFilterImpl
implements PriceFilter

This class is a filter implementation on the product price.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
          Serial version id.
 
Fields inherited from interface com.elasticpath.domain.catalogview.PriceFilter
MAX_PRICE, MIN_PRICE
 
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
PriceFilterImpl()
          Default Constructer.
 
Method Summary
 int compareTo(java.lang.Object object)
          Compares this price filter with the specified object for order.
 int compareWithValue(java.lang.Object firstObj, java.lang.Object secondObj)
          Compare the given objs.
 java.util.Currency getCurrency()
          Returns the currency of this price filter.
 java.lang.String getDisplayName(java.util.Locale locale)
          Returns the display name of the filter with the given locale.
 java.math.BigDecimal getLowerPrice()
          Returns the lower price of the price filter.
 java.lang.String getSeoId()
          Returns the SEO identifier of the filter with the given locale.
 java.lang.String getSeoName(java.util.Locale locale)
          Returns the SEO url of the filter with the given locale.
 java.math.BigDecimal getUpperPrice()
          Returns the upper price of the price filter.
 void initialize(java.lang.String filterId)
          Sets the filter id and initialize the filter.
 boolean match(java.lang.Object obj)
          Check whether the given object has the same brand with this filter.
 void setCurrency(java.util.Currency currency)
          Set the currency of this price filter.
 void setLowerValue(java.lang.Object lowerValue)
          Set the lower value for the range.
 void setUpperValue(java.lang.Object upperValue)
          Set the upper value for the range.
 void setUtility(Utility utility)
          Sets the utility.
 
Methods inherited from class com.elasticpath.domain.catalogview.impl.AbstractRangeFilterImpl
addChild, addDisplayInfo, contains, getChildren, getDisplayInfo, getLevel, getLocalizedDisplayMap, getLowerValue, getParent, getPath, getRangeType, getUpperValue, setLocalizedDisplayMap, setParent, setRangeType
 
Methods inherited from class com.elasticpath.domain.catalogview.impl.AbstractFilterImpl
equals, filter, getId, 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.RangeFilter
addChild, addDisplayInfo, contains, getChildren, getDisplayInfo, getLocalizedDisplayMap, getLowerValue, getParent, getRangeType, getUpperValue, setLocalizedDisplayMap, setParent, setRangeType
 
Methods inherited from interface com.elasticpath.domain.catalogview.Filter
filter, getId, isLocalized, setId, setLocalized
 
Methods inherited from interface com.elasticpath.domain.EpDomain
getElasticPath, setElasticPath
 
Methods inherited from interface com.elasticpath.domain.catalogview.BranchNode
getLevel, getPath
 

Field Detail

serialVersionUID

public static final long serialVersionUID
Serial version id.

See Also:
Constant Field Values
Constructor Detail

PriceFilterImpl

public PriceFilterImpl()
Default Constructer.

Method Detail

compareTo

public int compareTo(java.lang.Object object)
              throws EpDomainException
Compares this price filter with the specified object for order.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
object - the given object
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
EpDomainException - in case the given object is not a PriceFilter or they are overlapping with each other

compareWithValue

public int compareWithValue(java.lang.Object firstObj,
                            java.lang.Object secondObj)
Compare the given objs. Generally, the given object should be BigDecimal.

Specified by:
compareWithValue in class AbstractRangeFilterImpl
Parameters:
firstObj - the given object.
secondObj - the given value.
Returns:
0: equals, 1+ firstObj larger than the secondObj, -1- firstObj less than the secondObj.

getCurrency

public java.util.Currency getCurrency()
Returns the currency of this price filter.

Specified by:
getCurrency in interface PriceFilter
Returns:
the currency of this price filter.

getDisplayName

public java.lang.String getDisplayName(java.util.Locale locale)
Returns the display name of the filter with the given locale.

Specified by:
getDisplayName in interface Filter
Overrides:
getDisplayName in class AbstractRangeFilterImpl
Parameters:
locale - the locale
Returns:
the display name of the filter with the given locale.

getLowerPrice

public java.math.BigDecimal getLowerPrice()
Returns the lower price of the price filter. Backward support the PriceFilter.

Specified by:
getLowerPrice in interface PriceFilter
Returns:
the lower price of the price filter.

getSeoId

public java.lang.String getSeoId()
Returns the SEO identifier of the filter with the given locale.

Specified by:
getSeoId in interface Filter
Overrides:
getSeoId in class AbstractFilterImpl
Returns:
the SEO identifier of the filter with the given locale.

getSeoName

public java.lang.String getSeoName(java.util.Locale locale)
Returns the SEO url of the filter with the given locale. Currently the id will be used as the seo url.

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

getUpperPrice

public java.math.BigDecimal getUpperPrice()
Returns the upper price of the price filter. Backward support the PriceFilter.

Specified by:
getUpperPrice in interface PriceFilter
Returns:
the upper price of the price filter.

initialize

public void initialize(java.lang.String filterId)
                throws EpCatalogViewRequestBindException
Sets the filter id and initialize the filter.

Specified by:
initialize in interface Filter
Parameters:
filterId - the id to set
Throws:
EpCatalogViewRequestBindException - when the given filter id is invalid

match

public boolean match(java.lang.Object obj)
Check whether the given object has the same brand with this filter. Generally, the given object should be a product.

Specified by:
match in interface Filter
Overrides:
match in class AbstractRangeFilterImpl
Parameters:
obj - the given object.
Returns:
true: the given object matchs with the filter.

setCurrency

public void setCurrency(java.util.Currency currency)
Set the currency of this price filter.

Specified by:
setCurrency in interface PriceFilter
Parameters:
currency - the currency.

setLowerValue

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

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

setUpperValue

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

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

setUtility

public void setUtility(Utility utility)
Sets the utility.

Parameters:
utility - the utility to set