com.elasticpath.domain.catalogview.impl
Class AttributeRangeFilterImpl

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.AttributeRangeFilterImpl
All Implemented Interfaces:
AttributeFilter, AttributeRangeFilter, BranchNode, Filter, RangeFilter, EpDomain, Transient, java.io.Serializable, java.lang.Comparable

public class AttributeRangeFilterImpl
extends AbstractRangeFilterImpl
implements AttributeRangeFilter

The attribute filter with a range defined.

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
 
Fields inherited from interface com.elasticpath.domain.catalogview.Filter
ERROR_MSG, SEPARATOR, SEPARATOR_IN_REGEX
 
Constructor Summary
AttributeRangeFilterImpl()
          Default constructor.
 
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.
 boolean equals(java.lang.Object object)
          Returns true if this filter equals to the given object.
 Attribute getAttribute()
          Get the attribute object.
 java.lang.String getAttributeKey()
          Get the attribute key.
 java.lang.String getAttributeRangeFilterId(java.lang.String attributeKey, java.lang.String lowerAttributeStr, java.lang.String upperAttributeStr)
          Generates and returns a attribute range filter id based on the given attributeKey, lower value and upper value.
 AttributeService getAttributeService()
           
 java.lang.String getDisplayName(java.util.Locale locale)
          Returns the display name of the filter with the given locale.
 java.util.Locale getLocale()
          Get the locale for this attribute.
 java.lang.String getSeoId()
          This method returns the seo id.
 int hashCode()
          Returns the hash code.
 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 matchs this filter.
 boolean match(java.lang.Object obj, java.util.Locale locale)
          Check whether the given object matchs this filter.
 void setAttribute(Attribute attribute)
           
 void setAttributeKey(java.lang.String attributeKey)
          Set the attribute Key.
 void setAttributeService(AttributeService attributeService)
           
 void setLocale(java.util.Locale locale)
          Set the locale for this attribute.
 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.
 
Methods inherited from class com.elasticpath.domain.catalogview.impl.AbstractRangeFilterImpl
addChild, addDisplayInfo, contains, getChildren, getDisplayInfo, getLevel, getLocalizedDisplayMap, getLowerValue, getParent, getPath, getRangeType, getSeoName, getUpperValue, setLocalizedDisplayMap, setParent, setRangeType
 
Methods inherited from class com.elasticpath.domain.catalogview.impl.AbstractFilterImpl
filter, getId, 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, getSeoName, isLocalized, setId, setLocalized
 
Methods inherited from interface com.elasticpath.domain.EpDomain
getElasticPath, setElasticPath
 
Methods inherited from interface com.elasticpath.domain.catalogview.BranchNode
getLevel, getPath
 
Methods inherited from interface com.elasticpath.domain.catalogview.Filter
filter, getId, getSeoName, isLocalized, setId, setLocalized
 
Methods inherited from interface com.elasticpath.domain.EpDomain
getElasticPath, setElasticPath
 

Constructor Detail

AttributeRangeFilterImpl

public AttributeRangeFilterImpl()
Default constructor. Initialize the attribute service.

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 AttributeValue.

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.

equals

public boolean equals(java.lang.Object object)
Returns true if this filter equals to the given object.

Overrides:
equals in class AbstractFilterImpl
Parameters:
object - the object to compare
Returns:
true if this filter equals to the given object.

getAttribute

public Attribute getAttribute()
Description copied from interface: AttributeFilter
Get the attribute object.

Specified by:
getAttribute in interface AttributeFilter
Returns:
the attribute

getAttributeKey

public java.lang.String getAttributeKey()
Get the attribute key.

Specified by:
getAttributeKey in interface AttributeFilter
Returns:
the attributeKey

getAttributeRangeFilterId

public java.lang.String getAttributeRangeFilterId(java.lang.String attributeKey,
                                                  java.lang.String lowerAttributeStr,
                                                  java.lang.String upperAttributeStr)
                                           throws EpBindException
Generates and returns a attribute range filter id based on the given attributeKey, lower value and upper value.

Specified by:
getAttributeRangeFilterId in interface AttributeRangeFilter
Parameters:
attributeKey - the attribute key
lowerAttributeStr - the lower value
upperAttributeStr - the upper value
Returns:
a attribute range filter id
Throws:
EpBindException - when the given value is not valid to be converted

getAttributeService

public AttributeService getAttributeService()
Returns:
the attributeService

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.

getLocale

public java.util.Locale getLocale()
Get the locale for this attribute.

Returns:
the locale

getSeoId

public java.lang.String getSeoId()
This method returns the seo id.

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

hashCode

public int hashCode()
Returns the hash code.

Overrides:
hashCode in class AbstractFilterImpl
Returns:
the hash code

initialize

public void initialize(java.lang.String filterId)
                throws EpCatalogViewRequestBindException
Description copied from interface: Filter
Sets the filter id and initialize the filter.

Specified by:
initialize in interface Filter
Parameters:
filterId - the filter id
Throws:
EpCatalogViewRequestBindException - the exception

match

public boolean match(java.lang.Object obj)
Check whether the given object matchs 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.

match

public boolean match(java.lang.Object obj,
                     java.util.Locale locale)
Check whether the given object matchs this filter. Generally, the given object should be a product.

Specified by:
match in interface AttributeRangeFilter
Parameters:
obj - the given object.
locale - the given locale
Returns:
true: the given object matchs with the filter.

setAttribute

public void setAttribute(Attribute attribute)
Parameters:
attribute - the attribute to set

setAttributeKey

public void setAttributeKey(java.lang.String attributeKey)
Set the attribute Key.

Specified by:
setAttributeKey in interface AttributeFilter
Parameters:
attributeKey - the attributeKey to set

setAttributeService

public void setAttributeService(AttributeService attributeService)
Parameters:
attributeService - the attributeService to set

setLocale

public void setLocale(java.util.Locale locale)
Set the locale for this attribute.

Parameters:
locale - the locale to set

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