com.endeca.infront.navigation.model
Class FilterState

java.lang.Object
  extended by com.endeca.infront.navigation.model.FilterState
All Implemented Interfaces:
Cloneable

public class FilterState
extends Object
implements Cloneable

A class that contains the filters applied to an Endeca data set.

Exercise caution when modifying this object. Although this class is fully mutable, the FilterState contained by the main NavigationState should not be modified directly. Instead use clone() before modifying the filter state returned from NavigationState.getFilterState().


Constructor Summary
FilterState()
          Creates a new empty FilterState object.
FilterState(List<String> navigationFilters, List<SearchFilter> searches, List<RangeFilter> rangeFilters, GeoFilter geoFilter, List<String> recordFilters, List<String> featuredRecords, String securityFilter, String languageId, String rollupKey, boolean autoPhraseEnabled)
          Deprecated. use the empty constructor FilterState() and the requisite setter methods instead.
 
Method Summary
 FilterState clone()
          Returns a deep copy of this FilterState object.
 boolean containsRollupKey()
           
 boolean equals(Object obj)
          Returns true if the given object is equal to this filter state, false otherwise.
 EqlFilter getEqlFilter()
          Returns the EQL filter associated with this filter state.
 List<String> getFeaturedRecords()
          Returns a List of featured records, or an empty list if no featured records are specified.
 GeoFilter getGeoFilter()
           
 String getLanguageId()
           
 List<String> getNavigationFilters()
          Returns a List of navigation filters (dimension value IDs), or an empty list if no navigation filters are specified.
 List<RangeFilter> getRangeFilters()
          Returns a List of range filters, or an empty list if no range filters are specified.
 List<String> getRecordFilters()
          Returns a List of record filters, or an empty list if no record filters are specified.
 String getRollupKey()
           
 List<SearchFilter> getSearchFilters()
          Returns a List of search filters, or an empty list if no search filters are specified.
 String getSecurityFilter()
           
 int hashCode()
           
 boolean isAutoPhraseEnabled()
           
 boolean isEmpty()
          Returns true if this FilterState has no filters, false otherwise.
 void setAutoPhraseEnabled(boolean autoPhraseEnabled)
          Turns on autophrase in the engine.
 void setEqlFilter(EqlFilter eqlFilter)
          Sets the EQL filter associated with this filter state.
 void setFeaturedRecords(List<String> featuredRecords)
          The List of featured records.
 void setGeoFilter(GeoFilter geoFilter)
          The GeoFilter
 void setLanguageId(String languageId)
          Sets the language ID that gets passed to the MDEX.
 void setNavigationFilters(List<String> navigationFilters)
          The List of navigation filters (dimension value IDs).
 void setRangeFilters(List<RangeFilter> rangeFilters)
          The List of range filters.
 void setRecordFilters(List<String> recordFilters)
          The List of record filters.
 void setRollupKey(String rollupKey)
          If aggregate records are being used, this specifies the MDEX rollup field.
 void setSearchFilters(List<SearchFilter> searchFilters)
          The List of search filters.
 void setSecurityFilter(String securityFilter)
           Sets a security filter, which is specified using an MDEX record filter string.
 FilterState shallowCopy()
          Returns a shallow copy of a this FilterState object.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterState

public FilterState()
Creates a new empty FilterState object.


FilterState

@Deprecated
public FilterState(List<String> navigationFilters,
                              List<SearchFilter> searches,
                              List<RangeFilter> rangeFilters,
                              GeoFilter geoFilter,
                              List<String> recordFilters,
                              List<String> featuredRecords,
                              String securityFilter,
                              String languageId,
                              String rollupKey,
                              boolean autoPhraseEnabled)
Deprecated. use the empty constructor FilterState() and the requisite setter methods instead.

Creates a new FilterState object.

Method Detail

getNavigationFilters

public List<String> getNavigationFilters()
Returns a List of navigation filters (dimension value IDs), or an empty list if no navigation filters are specified.


getSearchFilters

public List<SearchFilter> getSearchFilters()
Returns a List of search filters, or an empty list if no search filters are specified.


getRangeFilters

public List<RangeFilter> getRangeFilters()
Returns a List of range filters, or an empty list if no range filters are specified.


getGeoFilter

public GeoFilter getGeoFilter()
Returns:
optional GeoFilter - defaults to null

getRecordFilters

public List<String> getRecordFilters()
Returns a List of record filters, or an empty list if no record filters are specified.


getFeaturedRecords

public List<String> getFeaturedRecords()
Returns a List of featured records, or an empty list if no featured records are specified.


setNavigationFilters

public void setNavigationFilters(List<String> navigationFilters)
The List of navigation filters (dimension value IDs).


setSearchFilters

public void setSearchFilters(List<SearchFilter> searchFilters)
The List of search filters.

See Also:
getSearchFilters()

setRangeFilters

public void setRangeFilters(List<RangeFilter> rangeFilters)
The List of range filters.

See Also:
getRangeFilters()

setGeoFilter

public void setGeoFilter(GeoFilter geoFilter)
The GeoFilter

See Also:
getGeoFilter()

setRecordFilters

public void setRecordFilters(List<String> recordFilters)
The List of record filters.

See Also:
getRecordFilters()

setFeaturedRecords

public void setFeaturedRecords(List<String> featuredRecords)
The List of featured records. Featured records are either a list of record specs if no rollup key has been specified, or a list of the values for each record of the property specified by the rollup key.

See Also:
getFeaturedRecords(), containsRollupKey()

getSecurityFilter

public String getSecurityFilter()
Returns:
the security filter (MDEX Record Filter format) - defaults to null

setSecurityFilter

public void setSecurityFilter(String securityFilter)

Sets a security filter, which is specified using an MDEX record filter string. This filter will not get cleared by NavigationState.clearFilterState().

The intended use is for this filter to be set globally, and not get changed by individual cartridge handlers, whereas the setRecordFilters is intended to be used by cartridge handlers, and not intended to be used for a global security filter.

This filter will ultimately get combined with the record filters specified by getRecordFilters() and passed to the MDEX as:

AND(securityFilter,recordFilters[0],recordFilters[1],...)

Parameters:
securityFilter - the security filter in MDEX record filter form - e.g. AND(propertyX:1,propertyY:admin)

isAutoPhraseEnabled

public boolean isAutoPhraseEnabled()
Returns:
true if auto-phrase is enabled - defaults to true

setAutoPhraseEnabled

public void setAutoPhraseEnabled(boolean autoPhraseEnabled)
Turns on autophrase in the engine. If true, this is the equivalent to telling the MDEX to compute alternate phrasings and to apply them. If false, the MDEX will not apply alternate phrasings, but may compute them if the SearchSuggestionMdexQuery has phraseSuggestionEnabled=true

Parameters:
autoPhraseEnabled -

getLanguageId

public String getLanguageId()
Returns:
the configured languageId - defaults to null.

setLanguageId

public void setLanguageId(String languageId)
Sets the language ID that gets passed to the MDEX. The format for this string is the same format that the MDEX expects. The MDEX defaults to 'en' if this is not set. Examples include 'en', 'en-GB', 'fr', 'jp', 'zh', 'zh-CN', etc.

Setting this value to null will use the MDEX default

Parameters:
languageId -

getRollupKey

public String getRollupKey()
Returns:
the rollup key used for aggregate records - defaults to null
See Also:
setRollupKey(String)

setRollupKey

public void setRollupKey(String rollupKey)
If aggregate records are being used, this specifies the MDEX rollup field. Otherwise, returns null.

Used to specify the rollup key for records results, aggregate counts for refinements, dimension search, and breadcrumbs, and used as the rollup key for record spotlight results.

In the case of record spotlight results on an aggregate dataset, the spotlighted records are specified by the property value of this rollup field

Set to null to remove the rollup key

Note that this field must be enabled for Record Filtering in the MDEX.


containsRollupKey

public boolean containsRollupKey()
Returns:
returns true if getRollupKey() returns a non-null and non-empty string value

getEqlFilter

public EqlFilter getEqlFilter()
Returns the EQL filter associated with this filter state.

Returns:
the EQL filter containing an EQL expression. May be null.
See Also:
setEqlFilter(EqlFilter)

setEqlFilter

public void setEqlFilter(EqlFilter eqlFilter)
Sets the EQL filter associated with this filter state. The EQL filter contains an EQL expression.

Parameters:
eqlFilter - the EQL filter containing an EQL expression.

equals

public boolean equals(Object obj)
Returns true if the given object is equal to this filter state, false otherwise.

Overrides:
equals in class Object
Returns:
true if the given object is equal to this filter state, false otherwise.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

clone

public FilterState clone()
Returns a deep copy of this FilterState object.

Overrides:
clone in class Object

shallowCopy

public FilterState shallowCopy()
Returns a shallow copy of a this FilterState object. All List references remain the same. Use clone() to create a deep copy.

Returns:
a copy of this class

isEmpty

public boolean isEmpty()
Returns true if this FilterState has no filters, false otherwise. Does not check the securityFilter, languageId, autoPhraseEnabled, or rollupKey

Returns:
true if this FilterState has no filters, false otherwise.


Copyright © 2012, Oracle and/or its affiliates. All rights reserved.