com.endeca.infront.navigation.url
Class UrlNavigationStateBuilder

java.lang.Object
  extended by com.endeca.infront.navigation.url.UrlNavigationStateBuilder
All Implemented Interfaces:
NavigationStateBuilder

public class UrlNavigationStateBuilder
extends Object
implements NavigationStateBuilder

An implementation of NavigationStateBuilder that uses the UrlFormatter. The UrlFormatter is always required and can be set by calling setUrlFormatter(UrlFormatter).

If using the record page dimension value triggering functionality (see setRecordDetailsDimensionNames(List) for more information), you must also provide an MdexRequestBroker by calling the setMdexRequestBroker(MdexRequestBroker) method.

This class has configurable URL parameter names for navigation filters and record selection that are used to serialize navigation states. The default parameter names for each are (feature - name):

NameParameterFormatExamplecorresponding state object
Navigation filters N Either 0 (zero) for a root navigation request, or one or more dimension value IDs. If SEO formatting is used, the value is often base64 encoded and placed as part of the path. N=0
N=132831+154283
FilterState.getNavigationFilters()
Search filters term Ntt One or more terms for a record search. Each term is delimited by a plus sign, and each set of terms is delimited by the pipe character. Ntt=canon+cameras SearchFilter.getTerms()
Search filters key Ntk One or more search keys (properties or dimensions), each delimited by the pipe character. If not specified, the SearchFilter.getKey() will be used. Ntk=All
Ntk=product.description
SearchFilter.getKey()
Search filters match mode Ntx The match mode for record search in the navigation query, each delimited by the pipe character. If not specified, the SearchFilter.getMatchMode() will be used. Ntx=mode+matchallany
This example will result in 2 SearchFilter objects, with the first one using the default search key
Ntt=canon+cameras|blue+black&Ntk=|product.color&Ntx=mode+matchallany|mode+matchany
SearchFilter.getMatchMode()
Range filters Nf Sets a range filter with one of these formats:
key|LT+number
key|LTEQ+number
key|GT+number
key|GTEQ+number
key|BTWN+num1+num2
Nf=Price|LT+25
Nf=Price|BTWN+8+15
FilterState.getRangeFilters()
Geo filter Nfg Sets a GCLT geo filter using the following format, with radius in km:
key|latitude|longitude|radius
Ngg=store.geocode|42.365615|-71.075647|10 FilterState.getGeoFilter()
Record filters Nr The record filters for the navigation query. This parameter can be multi-valued Nr=AND(132831,propertyA:valueX,OR(propertyB:valueY,propertyC:valueZ))
Nr=NOT(132831)&Nr=propertyB:valueY
FilterState.getRecordFilters()
Featured records selector Rsel FilterState.getFeaturedRecords()
Record specification R One or more Endeca record specs. RecordState.isAggregateRecord() will return false. R=66091 RecordState.getRecordSpec()
EQL Filter Nrs One EQL expression used to filter the results Nrs=collection()/record[endeca:matches(.,"product.id","1000*")] FilterState.getEqlFilter()
Aggregate record specification A The record specification of the Endeca aggregated record. RecordState.isAggregateRecord() will return true. A=7 RecordState.getRecordSpec()
Autophrase Ntp Turns autophrase on or off - either 1 or 0. If 1, this is the equivalent to telling the MDEX to compute alternate phrasings and to apply them (Ntpc and Ntpr respectively in the presentation API). If 0, the MDEX will not apply alternate phrasings, but may compute them if the SearchSuggestionMdexQuery has phraseSuggestionEnabled=true Ntp=0 FilterState.isAutoPhraseEnabled()
Langauage Id Ntl Sets the language ID sent to the MDEX Engine Ntl=en-GB FilterState.getLanguageId()

This builder also provides configuration for removing URL parameters when a filter state is updated, a filter state is cleared, or on any update to the request state (including modifying other URL parameters):

Subclasses can customize the format of the navigation state serialization by overriding one of the following methods that modifies the UrlState using a navigation state:

Or the following for record state serialization: If a subclass overrides one of the above methods, it should also override the corresponding method for parsing the request into the corresponding filter(s).

This class is NOT thread-safe.

See Also:
NavigationStateBuilder

Field Summary
protected  Set<String> handledParams
          A list of the parameters that are parsed by the methods in this class.
 
Constructor Summary
UrlNavigationStateBuilder()
           
 
Method Summary
protected  void addAutoPhraseEnabled(NavigationState navigationState, UrlState urlState)
          Updates the UrlState, adding the autophraseParam if the current value of FilterState.isAutoPhraseEnabled() is different from the defaultFilterState.
protected  void addEqlFilter(NavigationState navigationState, UrlState urlState)
          Updates the UrlState, adding the eqlparam if the current value of FilterState.getEqlFilter() is different from the defaultFilterState.
protected  void addFeaturedRecords(NavigationState navigationState, UrlState urlState)
          Updates the UrlState by adding featured records from the given NavigationState.
protected  void addGeoFilter(NavigationState navigationState, UrlState urlState)
          Updates the UrlState by adding a geo filter from the given NavigationState.
protected  void addLanguageId(NavigationState navigationState, UrlState urlState)
          Updates the UrlState, adding the languageParam if the current value of FilterState.getLanguageId() is different from the defaultFilterState.
protected  void addNavigationFilters(NavigationState navigationState, UrlState urlState)
          Updates the UrlState by adding navigation filters from the NavigationState.
protected  void addParameters(NavigationState navigationState, UrlState urlState)
          Updates the UrlState by adding URL parameters from the given NavigationState.
protected  void addParameters(RecordState recordState, UrlState urlState)
          Updates the UrlState by adding URL parameters from the given RecordState
protected  void addRangeFilters(NavigationState navigationState, UrlState urlState)
          Updates the UrlState by adding range filters from the given NavigationState.
protected  void addRecordFilters(NavigationState navigationState, UrlState urlState)
          Updates the UrlState by adding record filters from the given NavigationState
protected  void addRecordSpec(RecordState recordState, UrlState urlState)
          Updates the UrlState by adding the record spec from the given RecordState.
protected  void addSearchFilters(NavigationState navigationState, UrlState urlState)
          Updates the UrlState by adding search filters from the given NavigationState.
 UrlState buildUrlState(NavigationState navigationState)
           
 UrlState buildUrlState(RecordState recordState)
           
 String getAggregateRecordSpecParam()
           
 String getAutophraseParam()
          The parameter key used for autophrase - defaults to "Ntp"
 FilterState getDefaultFilterState()
          If null, a new FilterState will be created and its standard defaults will be used.
 MatchMode getDefaultMatchMode()
           
 String getDefaultSearchKey()
           
 String getEqlParam()
           
 String getFeaturedRecordsParam()
           
 String getGeoFilterParam()
           
 String getLanguageParam()
           
 MdexRequestBroker getMdexRequestBroker()
          Used to construct MDEX requests.
 String getNavigationFiltersParam()
           
 String getRangeFiltersParam()
           
 List<String> getRecordDetailsDimensionNames()
          Gets the list of dimensions which have been configured to be retrieved from records and added to the navigation state on record detail pages.
 String getRecordFilterParam()
           
 String getRecordSpecParam()
           
 List<String> getRemoveAlways()
          Sets the list of URL parameters that will get removed "always".
 List<String> getRemoveOnClearFilterState()
          Gets the list of URL parameters that will get removed when NavigationState.clearFilterState() is called.
 List<String> getRemoveOnUpdateFilterState()
          Gets the list of URL parameters that will get removed when any method that updates the filter state is called on NavigationState (removeSearches, removeFilters, selectNavigationFilter, etc.)
 String getSearchFiltersKeyParam()
           
 String getSearchFiltersMatchModeParam()
           
 String getSearchFiltersParam()
           
 UrlFormatter getUrlFormatter()
          Returns the UrlFormatter associated with this class.
protected  List<String> parseFeaturedRecords(UrlState urlState)
          Parses a List of featured records from the given UrlState.
protected  FilterState parseFilterState(UrlState urlState)
          Creates a new FilterState (or a clone of the FilterState specified by getDefaultFilterState()) and parses the filter state parameters on the given UrlState onto it.
protected  GeoFilter parseGeoFilter(UrlState urlState)
          Parses a GeoFilter off of the UrlState.
protected  List<String> parseNavigationFilters(UrlState urlState)
          Parses a List of navigation filters (dimension value IDs) off of the UrlState.
 NavigationState parseNavigationState(javax.servlet.http.HttpServletRequest request)
          Creates a NavigationState using the query string, path info, and character encoding from the given request object.
 NavigationState parseNavigationState(String queryString, String pathInfo, String characterEncoding)
           Create a NavigationState parsed from a query string, a path info, and a character encoding.
protected  Map<String,String> parseParameters(UrlState urlState)
          Parses parameters from the UrlState and returns them as a map.
protected  List<RangeFilter> parseRangeFilters(UrlState urlState)
          Parses a List of RangeFilter off of the UrlState.
protected  List<String> parseRecordFilters(UrlState urlState)
          Returns a List of record filters parsed from the UrlState.
protected  String parseRecordSpec(UrlState urlState)
          Parses a record spec String off of the UrlState.
 RecordState parseRecordState(javax.servlet.http.HttpServletRequest request)
          Creates a RecordState using the query string, path info, and character encoding from the given request object.
 RecordState parseRecordState(String queryString, String pathInfo, String characterEncoding)
           Create a RecordState parsed from a path info, a query string, and a character encoding.
protected  List<SearchFilter> parseSearchFilters(UrlState urlState)
          Parses a List of SearchFilter objects off of the UrlState.
 void setAggregateRecordSpecParam(String aggregateRecordSpecParam)
          Sets the aggregateRecordSpecParam.
 void setAutophraseParam(String autophraseParam)
          Sets the autophraseParam
 void setDefaultFilterState(FilterState filterState)
          Sets a default FilterState object that will be used as the initial FilterState in NavigationState instances created by this NavigationStateBuilder.
 void setDefaultMatchMode(MatchMode defaultMatchMode)
          Sets the default match mode that will be set when a SearchFilter is parsed and a match mode is not specified in the URL parameter specified by getSearchFiltersMatchModeParam()
 void setDefaultSearchKey(String defaultSearchKey)
          Sets the default search key that will be set when a SearchFilter is parsed and a search key is not specified in the URL parameter specified by getSearchFiltersKeyParam().
 void setEqlParam(String eqlParam)
          Sets the parameter used for specifying the EQL filter.
 void setFeaturedRecordsParam(String featuredRecordsParam)
          Sets the featuredRecordsParam.
 void setGeoFilterParam(String geoFilterParam)
          Sets the geoFilterParam.
 void setLanguageParam(String languageParam)
          Sets the parameter used for specifying the language ID
 void setMdexRequestBroker(MdexRequestBroker mdexRequestBroker)
          Sets the request Broker used by this class to create record detail queries.
 void setNavigationFiltersParam(String navigationFiltersParam)
          Sets the dimensionFiltersParam.
 void setRangeFiltersParam(String rangeFiltersParam)
          Sets the rangeFiltersParam.
 void setRecordDetailsDimensionNames(List<String> recordDetailsDimensionNames)
          Sets the list of dimension values to be retrieved from records and added to the navigation state on record detail pages.
 void setRecordFilterParam(String recordFilterParam)
          Sets the recordFilterParam.
 void setRecordSpecParam(String recordSpecParam)
          Sets the recordSpecParam.
 void setRemoveAlways(List<String> removeAlways)
          Sets the list of URL parameters that will get removed "always".
 void setRemoveOnClearFilterState(List<String> removeOnClearFilterState)
          Sets the list of URL parameters that will get removed when NavigationState.clearFilterState() is called.
 void setRemoveOnUpdateFilterState(List<String> removeOnUpdateFilterState)
          Sets the list of URL parameters that will get removed when any method that updates the filter state is called on NavigationState (removeSearches, removeFilters, selectNavigationFilter, etc.)
 void setSearchFiltersKeyParam(String searchFiltersKeyParam)
          Sets the searchFiltersKeyParam.
 void setSearchFiltersMatchModeParam(String searchFiltersMatchModeParam)
          Sets the searchFiltersMatchModeParam.
 void setSearchFiltersParam(String searchFiltersParam)
          Sets the searchFiltersParam.
 void setUrlFormatter(UrlFormatter urlFormatter)
          Sets the UrlFormatter associated with this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handledParams

protected final Set<String> handledParams
A list of the parameters that are parsed by the methods in this class. This list is used by parseParameters(UrlState) to determine which parameters it should ignore because they have already been handled by other methods.

Subclasses that process a different set of parameters should either update this list or override parseParameters(UrlState) to parse the correct set of parameters.

Constructor Detail

UrlNavigationStateBuilder

public UrlNavigationStateBuilder()
Method Detail

parseNavigationState

public NavigationState parseNavigationState(javax.servlet.http.HttpServletRequest request)
                                     throws NavigationException
Creates a NavigationState using the query string, path info, and character encoding from the given request object. See parseNavigationState(String, String, String) for details.

Parameters:
request - the request object
Returns:
the NavigationState
Throws:
NavigationException - if a NavigationState could not be constructed from the given request object

parseRecordState

public RecordState parseRecordState(javax.servlet.http.HttpServletRequest request)
                             throws NavigationException
Creates a RecordState using the query string, path info, and character encoding from the given request object. See parseRecordState(String, String, String) for details.

Parameters:
request - the request object
Returns:
the RecordState
Throws:
NavigationException - if a RecordState could not be constructed from the given request object

parseNavigationState

public NavigationState parseNavigationState(String queryString,
                                            String pathInfo,
                                            String characterEncoding)
                                     throws NavigationException
Description copied from interface: NavigationStateBuilder

Create a NavigationState parsed from a query string, a path info, and a character encoding. Depending on the NavigationStateBuilder implementation and the way in which it is configured, the navigation state may be described by the query string, the path info, or some combination of the two.

Specified by:
parseNavigationState in interface NavigationStateBuilder
Parameters:
queryString - The query string that describes the NavigationState
pathInfo - The path info that describes the NavigationState
characterEncoding - The character encoding of the path info and query string
Returns:
a NavigationState constructed from the query string and path info
Throws:
NavigationException - if a NavigationState could not be constructed from the given query string and path info

parseRecordState

public RecordState parseRecordState(String queryString,
                                    String pathInfo,
                                    String characterEncoding)
                             throws NavigationException
Description copied from interface: NavigationStateBuilder

Create a RecordState parsed from a path info, a query string, and a character encoding. Depending on the NavigationStateBuilder implementation and the way in which it is configured, the record state may be described by the query string, the path info, or some combination of the two.

Specified by:
parseRecordState in interface NavigationStateBuilder
Parameters:
queryString - The query string that describes the RecordState
pathInfo - The path info that describes the RecordState
characterEncoding - The character encoding of the path info and query string
Returns:
a RecordState constructed from the query string and path info
Throws:
NavigationException - if a RecordState could not be constructed from the given query string and path info

buildUrlState

public UrlState buildUrlState(NavigationState navigationState)

buildUrlState

public UrlState buildUrlState(RecordState recordState)

getRemoveOnUpdateFilterState

public List<String> getRemoveOnUpdateFilterState()
Gets the list of URL parameters that will get removed when any method that updates the filter state is called on NavigationState (removeSearches, removeFilters, selectNavigationFilter, etc.)

Returns:
the list of parameters to remove, or null.

setRemoveOnUpdateFilterState

public void setRemoveOnUpdateFilterState(List<String> removeOnUpdateFilterState)
Sets the list of URL parameters that will get removed when any method that updates the filter state is called on NavigationState (removeSearches, removeFilters, selectNavigationFilter, etc.)

Parameters:
removeOnUpdateFilterState - the new list of parameters to remove

getRemoveOnClearFilterState

public List<String> getRemoveOnClearFilterState()
Gets the list of URL parameters that will get removed when NavigationState.clearFilterState() is called.

Returns:
the list of parameters to remove, or null.

setRemoveOnClearFilterState

public void setRemoveOnClearFilterState(List<String> removeOnClearFilterState)
Sets the list of URL parameters that will get removed when NavigationState.clearFilterState() is called.

Parameters:
removeOnClearFilterState - the new list of URL parameters

getRemoveAlways

public List<String> getRemoveAlways()
Sets the list of URL parameters that will get removed "always".

Returns:
the list of parameters to remove, or null.

setRemoveAlways

public void setRemoveAlways(List<String> removeAlways)
Sets the list of URL parameters that will get removed "always". If you set one of these parameters on a NavigationState, it will show up in its serialization. However, it will be removed if you make any subsequent change to the NavigationState.

The implications of this are that you must always call NavigationState.putParameter(String, String) as the last change you make to a NavigationState before serializing it.

Parameters:
removeAlways - the list of URL parameters

getRecordDetailsDimensionNames

public List<String> getRecordDetailsDimensionNames()
Gets the list of dimensions which have been configured to be retrieved from records and added to the navigation state on record detail pages.

If setRecordDetailsDimensionNames(List) has not been called or it has been called with a null argument, this method will return null.

Returns:
the list of dimensions

setRecordDetailsDimensionNames

public void setRecordDetailsDimensionNames(List<String> recordDetailsDimensionNames)
Sets the list of dimension values to be retrieved from records and added to the navigation state on record detail pages. If this list is specified, then on record detail pages:
  1. The record to be displayed will be loaded from the MDEX
  2. The record will be examined to see if it has any assignments from dimensions specified in this list
  3. If it does, then those dimension values will be added to the navigation state so that they can be used for triggering
This allows the content for the record detail page to be triggered based on the dimension values from the record.

For example, if you had a category dimension you could include it in this list. Then you would be able to trigger different record detail page content based on the category of the record being viewed.

If this list is specified (thus enabling record dimension value triggering), then an MdexRequestBroker must also be provided by calling setMdexRequestBroker(MdexRequestBroker).

Parameters:
recordDetailsDimensionNames - the list of dimensions

getMdexRequestBroker

public MdexRequestBroker getMdexRequestBroker()
Used to construct MDEX requests. The MdexRequestBroker must be available within the scope of the request, but should not be modified or used outside the scope of the NavigationCartridgeHandler and NavigationStateBuilder. Use of the MdexRequestBroker in other classes is not supported.

Returns:
The instance of the MdexRequestBroker.

setMdexRequestBroker

public void setMdexRequestBroker(MdexRequestBroker mdexRequestBroker)
Sets the request Broker used by this class to create record detail queries. The request Broker is only needed if you are using the record page dimension value triggering feature.

Parameters:
mdexRequestBroker - the MdexRequestBroker.
See Also:
setRecordDetailsDimensionNames(List)

getUrlFormatter

public UrlFormatter getUrlFormatter()
Returns the UrlFormatter associated with this class.

Returns:
the UrlFormatter associated with this class

setUrlFormatter

public void setUrlFormatter(UrlFormatter urlFormatter)
Sets the UrlFormatter associated with this class.

Parameters:
urlFormatter - the UrlFormatter to associate with this class

getDefaultMatchMode

public MatchMode getDefaultMatchMode()
Returns:
the default match mode - defaults to MatchMode.ALL.

setDefaultMatchMode

public void setDefaultMatchMode(MatchMode defaultMatchMode)
Sets the default match mode that will be set when a SearchFilter is parsed and a match mode is not specified in the URL parameter specified by getSearchFiltersMatchModeParam()

Parameters:
defaultMatchMode - the new default match mode

getDefaultSearchKey

public String getDefaultSearchKey()
Returns:
the default search key - defaults to "All"

setDefaultSearchKey

public void setDefaultSearchKey(String defaultSearchKey)
Sets the default search key that will be set when a SearchFilter is parsed and a search key is not specified in the URL parameter specified by getSearchFiltersKeyParam().

Parameters:
defaultSearchKey - the new default search key

setDefaultFilterState

public void setDefaultFilterState(FilterState filterState)
Sets a default FilterState object that will be used as the initial FilterState in NavigationState instances created by this NavigationStateBuilder.

Can be to set a default languageId, autoPhraseEnabled, rollupKey, and securityFilter. Use this method to set the default FilterState statically through something like Spring XML.

To programmatically change the default values in the FilterState, based on URL parameters or other logic, override the parseFilterState(UrlState) method.

If there are search filters, range filters, record filter, or dimension filters configured in the default filter state, the default parse methods (parseSearchFilters(com.endeca.soleng.urlformatter.UrlState), parseNavigationFilters(com.endeca.soleng.urlformatter.UrlState), etc.) will use the default filters if there is no value for the URL parameter that is used to specify each filter type, and will override these defaults if a URL parameter value exists.

Parameters:
filterState - the new default filter state

getDefaultFilterState

public FilterState getDefaultFilterState()
If null, a new FilterState will be created and its standard defaults will be used.

Returns:
the default FilterState - may be null.

parseNavigationFilters

protected List<String> parseNavigationFilters(UrlState urlState)
                                       throws NavigationException
Parses a List of navigation filters (dimension value IDs) off of the UrlState. Subclasses can override this method to customize its behavior.

For record detail pages, this implementation also adds any dimension values for the configured dimensions that occur on the record to the navigation state. These dimensions are specified using the setRecordDetailsDimensionNames(List) method.

If there is a default FilterState configured that contains navigation filters, these navigation filters will be returned if there are no navigation filters set in URL, and will be overridden otherwise.

Parameters:
urlState - the URL state containing the parameters from the request
Returns:
a list of navigation filters
Throws:
NavigationException - if there is an error parsing the navigation filters
See Also:
addNavigationFilters(NavigationState, UrlState)

addNavigationFilters

protected void addNavigationFilters(NavigationState navigationState,
                                    UrlState urlState)
Updates the UrlState by adding navigation filters from the NavigationState.

Parameters:
navigationState - the navigation state containing the filters
urlState - the URL state to add the filters to
See Also:
parseNavigationFilters(UrlState)

parseSearchFilters

protected List<SearchFilter> parseSearchFilters(UrlState urlState)
                                         throws NavigationException
Parses a List of SearchFilter objects off of the UrlState. Subclasses can override this method to customize the behavior of this method.

If there is a default FilterState configured that contains SearchFilter objects, these search filters will be returned if there are no search filters set in URL, and will be overridden otherwise.

Parameters:
urlState - the URL state containing the parameters from the request
Returns:
a List of SearchFilter
Throws:
NavigationException - is there was an error parsing the search filters
See Also:
addSearchFilters(NavigationState, UrlState), getDefaultFilterState()

addSearchFilters

protected void addSearchFilters(NavigationState navigationState,
                                UrlState urlState)
Updates the UrlState by adding search filters from the given NavigationState.

Parameters:
navigationState - the NavigationState containing the search filters
urlState - the URL state to add the search filters to
See Also:
parseSearchFilters(UrlState)

parseRangeFilters

protected List<RangeFilter> parseRangeFilters(UrlState urlState)
                                       throws NavigationException
Parses a List of RangeFilter off of the UrlState. Subclasses can override this method to customize the behavior of this method.

If there is a default FilterState configured that contains RangeFilter objects, these range filters will be returned if there are no range filters set in URL, and will be overridden otherwise.

Parameters:
urlState - the URL state containing the parameters from the request
Returns:
a List of RangeFilter
Throws:
NavigationException - if there was an error parsing the rnage filters
See Also:
addRangeFilters(NavigationState, UrlState)

parseGeoFilter

protected GeoFilter parseGeoFilter(UrlState urlState)
                            throws NavigationException
Parses a GeoFilter off of the UrlState. Subclasses can override this method to customize the behavior of this method.

If there is a default FilterState configured that contains a GeoFilter this geo filter will be returned if there is no geo filter set in URL, and will be overridden otherwise.

Parameters:
urlState - the URL state containing the parameters from the request
Returns:
a GeoFilter
Throws:
NavigationException - if there is an error parsing the geo filter
See Also:
addGeoFilter(NavigationState, UrlState)

addRangeFilters

protected void addRangeFilters(NavigationState navigationState,
                               UrlState urlState)
Updates the UrlState by adding range filters from the given NavigationState.

Parameters:
navigationState - the NavigationState containing the range filters
urlState - the URL state to add the range filters to
See Also:
parseRangeFilters(UrlState)

addGeoFilter

protected void addGeoFilter(NavigationState navigationState,
                            UrlState urlState)
Updates the UrlState by adding a geo filter from the given NavigationState.

Parameters:
navigationState - the NavigationState containing the geo filter
urlState - the URL state to add the geo filter to
See Also:
parseGeoFilter(UrlState)

parseRecordFilters

protected List<String> parseRecordFilters(UrlState urlState)
                                   throws NavigationException
Returns a List of record filters parsed from the UrlState. Subclasses can override this method to customize the behavior of this method.

By default this implementation will only parse a single record filter.

If there is a default FilterState configured that contains record filters these record filters will be returned if there are no record filters set in URL, and will be overridden otherwise.

Parameters:
urlState - the URL state containing the parameters from the request
Returns:
the record filters from the URL state
Throws:
NavigationException - if there is an error parsing the record filters
See Also:
addRecordFilters(NavigationState, UrlState)

addRecordFilters

protected void addRecordFilters(NavigationState navigationState,
                                UrlState urlState)
Updates the UrlState by adding record filters from the given NavigationState

Parameters:
navigationState - the NavigationState containing the record filters
urlState - the URL state to add the record filters to
See Also:
parseRecordFilters(UrlState)

parseFeaturedRecords

protected List<String> parseFeaturedRecords(UrlState urlState)
                                     throws NavigationException
Parses a List of featured records from the given UrlState. Subclasses can override this method to customize the behavior of this method.

If there is a default FilterState configured that contains featured records these featured records will be returned if there are no featured records set in URL, and will be overridden otherwise.

Parameters:
urlState - the URL state containing the parameters from the request
Returns:
a List of featured records
Throws:
NavigationException - if there is an error parsing the featured records
See Also:
addFeaturedRecords(NavigationState, UrlState)

addFeaturedRecords

protected void addFeaturedRecords(NavigationState navigationState,
                                  UrlState urlState)
Updates the UrlState by adding featured records from the given NavigationState.

Parameters:
navigationState - the NavigationState containing the featured records
urlState - the URL state to add the featured records to
See Also:
parseFeaturedRecords(UrlState)

parseRecordSpec

protected String parseRecordSpec(UrlState urlState)
                          throws NavigationException
Parses a record spec String off of the UrlState. Subclasses can override this method to customize the behavior of this method.

Parameters:
urlState - the URL state containing the parameters from the request
Returns:
a record spec String
Throws:
NavigationException - if there is an error parsing the record spec
See Also:
addRecordSpec(RecordState, UrlState)

addRecordSpec

protected void addRecordSpec(RecordState recordState,
                             UrlState urlState)
Updates the UrlState by adding the record spec from the given RecordState.

Parameters:
recordState - the RecordState containing the record spec
urlState - the URL state to add the record state to
See Also:
parseRecordSpec(UrlState)

parseFilterState

protected FilterState parseFilterState(UrlState urlState)
                                throws NavigationException
Creates a new FilterState (or a clone of the FilterState specified by getDefaultFilterState()) and parses the filter state parameters on the given UrlState onto it.

This method directly parses the languageParam and autophraseParam, and overrides the default FilterState values if these parameters exist and have valid values.

This method also delegates to the other parse methods (parseSearchFilters, parseNaviationFilter, parseGeoFilter, etc.)

Parameters:
urlState - the UrlState to parse
Returns:
a filter state parsed from the given UrlState
Throws:
NavigationException - if there is an error parsing the filter state

addAutoPhraseEnabled

protected void addAutoPhraseEnabled(NavigationState navigationState,
                                    UrlState urlState)
Updates the UrlState, adding the autophraseParam if the current value of FilterState.isAutoPhraseEnabled() is different from the defaultFilterState.

Parameters:
navigationState - the NavigationState to use in updating the UrlState
urlState - the UrlState to be updated

addEqlFilter

protected void addEqlFilter(NavigationState navigationState,
                            UrlState urlState)
Updates the UrlState, adding the eqlparam if the current value of FilterState.getEqlFilter() is different from the defaultFilterState.

Parameters:
navigationState - the NavigationState to use in updating the UrlState.
urlState - the UrlState to be updated.

addLanguageId

protected void addLanguageId(NavigationState navigationState,
                             UrlState urlState)
Updates the UrlState, adding the languageParam if the current value of FilterState.getLanguageId() is different from the defaultFilterState.

Parameters:
navigationState - the NavigationState to use in updating the UrlState
urlState - the UrlState to be updated

parseParameters

protected Map<String,String> parseParameters(UrlState urlState)
                                      throws NavigationException
Parses parameters from the UrlState and returns them as a map. Known parameters such as the navigation filter parameter and the record spec parameter (see setNavigationFiltersParam(String) and setRecordSpecParam(String)) are ignored since they are processed by other methods; parseParameters is intended as a catch-all for everything else.

Subclasses can override this method to customize its behavior.

Parameters:
urlState - the urlState containing the parameters from the request
Returns:
the parsed parameters as a map
Throws:
NavigationException - if there is an error parsing the parameters
See Also:
parseParameters(UrlState)

addParameters

protected void addParameters(NavigationState navigationState,
                             UrlState urlState)
Updates the UrlState by adding URL parameters from the given NavigationState.

Parameters:
navigationState - the NavigationState containing the parameters
urlState - the UrlState to update
See Also:
parseParameters(UrlState)

addParameters

protected void addParameters(RecordState recordState,
                             UrlState urlState)
Updates the UrlState by adding URL parameters from the given RecordState

Parameters:
recordState - the RecordState containing the parameters
urlState - the UrlState to update
See Also:
parseParameters(UrlState)

getNavigationFiltersParam

public String getNavigationFiltersParam()
Returns:
the parameter key used for dimension filters (navigation state) - typically "N".

This supersedes UrlFormatter.getNavStateParamKey().


setNavigationFiltersParam

public void setNavigationFiltersParam(String navigationFiltersParam)
Sets the dimensionFiltersParam.

This will also call BasicUrlFormatter.setNavStateParamKey(String)

Parameters:
navigationFiltersParam - to set. Cannot be null.
Throws:
IllegalArgumentException - if navigationFiltersParam is null.

getSearchFiltersParam

public String getSearchFiltersParam()
Returns:
the parameter key used for the search term in a search filter - typically "Ntt".

setSearchFiltersParam

public void setSearchFiltersParam(String searchFiltersParam)
Sets the searchFiltersParam.

Parameters:
searchFiltersParam - to set. Cannot be null.
Throws:
IllegalArgumentException - if searchFiltersParam is null.

getSearchFiltersKeyParam

public String getSearchFiltersKeyParam()
Returns:
the parameter key used for the search key in a search filter - typically "Ntk".

setSearchFiltersKeyParam

public void setSearchFiltersKeyParam(String searchFiltersKeyParam)
Sets the searchFiltersKeyParam.

Parameters:
searchFiltersKeyParam - to set. Cannot be null.
Throws:
IllegalArgumentException - if searchFiltersKeyParam is null.

getSearchFiltersMatchModeParam

public String getSearchFiltersMatchModeParam()
Returns:
the parameter key used for the search match mode in a search filter - typically "Ntx".

setSearchFiltersMatchModeParam

public void setSearchFiltersMatchModeParam(String searchFiltersMatchModeParam)
Sets the searchFiltersMatchModeParam.

Parameters:
searchFiltersMatchModeParam - to set. Cannot be null.
Throws:
IllegalArgumentException - if searchFiltersMatchModeParam is null.

getRangeFiltersParam

public String getRangeFiltersParam()
Returns:
the parameter key used for range filters - typically "Nf".

setRangeFiltersParam

public void setRangeFiltersParam(String rangeFiltersParam)
Sets the rangeFiltersParam.

Parameters:
rangeFiltersParam - to set. Cannot be null.
Throws:
IllegalArgumentException - if rangeFiltersParam is null.

getGeoFilterParam

public String getGeoFilterParam()
Returns:
the parameter key used for the geo filter - typically "Nfg".

setGeoFilterParam

public void setGeoFilterParam(String geoFilterParam)
Sets the geoFilterParam.

Parameters:
geoFilterParam - to set. Cannot be null.
Throws:
IllegalArgumentException - if geoFilterParam is null.

getRecordFilterParam

public String getRecordFilterParam()
Returns:
the parameter key used for the record filter - typically "Nr".

setRecordFilterParam

public void setRecordFilterParam(String recordFilterParam)
Sets the recordFilterParam.

Parameters:
recordFilterParam - to set. Cannot be null.
Throws:
IllegalArgumentException - if recordFilterParam is null.

getFeaturedRecordsParam

public String getFeaturedRecordsParam()
Returns:
the parameter key used for search filters - typically "Rsel".

setFeaturedRecordsParam

public void setFeaturedRecordsParam(String featuredRecordsParam)
Sets the featuredRecordsParam.

Parameters:
featuredRecordsParam - to set. Cannot be null.
Throws:
IllegalArgumentException - if featuredRecordsParam is null.

getRecordSpecParam

public String getRecordSpecParam()
Returns:
the parameter key used for record - typically "R".

This supersedes UrlFormatter.getERecParamKey().


setRecordSpecParam

public void setRecordSpecParam(String recordSpecParam)
Sets the recordSpecParam.

This will also call BasicUrlFormatter.setERecParamKey(String)

Parameters:
recordSpecParam - to set. Cannot be null.
Throws:
IllegalArgumentException - if recordParam is null.

getAggregateRecordSpecParam

public String getAggregateRecordSpecParam()
Returns:
the parameter key used for record - typically "A".

This supersedes UrlFormatter.getAggrERecParamKey().


setAggregateRecordSpecParam

public void setAggregateRecordSpecParam(String aggregateRecordSpecParam)
Sets the aggregateRecordSpecParam.

This will also call BasicUrlFormatter.setAggrERecParamKey(String)

Parameters:
aggregateRecordSpecParam - to set. Cannot be null.
Throws:
IllegalArgumentException - if recordParam is null.

getAutophraseParam

public String getAutophraseParam()
The parameter key used for autophrase - defaults to "Ntp"

Returns:
the autophrase parameter

setAutophraseParam

public void setAutophraseParam(String autophraseParam)
Sets the autophraseParam

Parameters:
autophraseParam - the new autophrase parameter

getLanguageParam

public String getLanguageParam()
Returns:
the parameter key used for language id - defaults to "Ntl"

setLanguageParam

public void setLanguageParam(String languageParam)
Sets the parameter used for specifying the language ID

Parameters:
languageParam - the new language parameter

getEqlParam

public String getEqlParam()
Returns:
the parameter key used for EQL filter - defaults to "Nrs".

setEqlParam

public void setEqlParam(String eqlParam)
Sets the parameter used for specifying the EQL filter.

Parameters:
eqlParam - the new EQL filter parameter.


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