public class UrlState extends Object implements Cloneable
UrlFormatter
objects and marshaled into ENEQuery
objects via QueryBuilder
objects.UrlFormatter
,
QueryBuilder
Constructor and Description |
---|
UrlState(UrlFormatter pUrlFormatter,
String pEncoding)
Constructs an empty
UrlState object. |
Modifier and Type | Method and Description |
---|---|
void |
clearNavState()
Clears any existing navigation state from this
UrlState . |
Object |
clone()
Returns a cloned instance of this
UrlState object. |
boolean |
containsAggrERec()
Returns true if this
UrlState contains an AggrERec parameter. |
boolean |
containsERec()
Returns true if this
UrlState contains an ERec parameter. |
boolean |
containsNavState()
Returns true if this
UrlState contains a navigation state
parameter. |
com.endeca.navigation.AggrERec |
getAggrERec()
Returns the associated AggrERec for this UrlState.
|
String |
getCanonicalLink()
Returns a canonical link for this
UrlState . |
String |
getEncoding()
Returns the character encoding that is used when marshaling parameters
and strings contained within this
UrlState . |
com.endeca.navigation.ERec |
getERec()
Returns the associated ERec for this UrlState.
|
com.endeca.navigation.DimLocationList |
getNavState()
Returns the navigation state for this
UrlState or null
if there is no navigation state. |
String |
getParam(String pKey)
Returns the value associated with the specified key in the underlying
parameter map.
|
Collection |
getParameters()
Returns a collection of all
UrlParam mappings contained within
this UrlState . |
UrlParam |
getUrlParam(String pKey)
Returns the full
UrlParam value associated with the specified
key in the underlying parameter map. |
void |
inform(com.endeca.navigation.ENEQueryResults pENEQueryResults)
Initializes this
UrlState using state from the
specified ENEQueryResults . |
UrlState |
removeDescriptor(com.endeca.navigation.DimVal pDescriptor,
boolean pClone)
Removes the specifed descriptor
DimVal from the current
navigation state. |
void |
removeNavState()
Fully removes any navigation state from this
UrlState . |
String |
removeParam(String pKey)
Removes any value associated with the specified key from the underlying
parameter map.
|
UrlState |
selectAncestor(com.endeca.navigation.DimVal pAncestor,
com.endeca.navigation.DimVal pDescriptor,
boolean pClone)
Selects an ancestor
DimVal for the specified descriptor
DimVal . |
UrlState |
selectRefinement(com.endeca.navigation.Dimension pRefinementDimension,
com.endeca.navigation.DimVal pRefinement,
boolean pClone)
Selects a navigation refinement
DimVal from the specified
refinement Dimension . |
UrlState |
selectRefinement(com.endeca.navigation.DimLocation pRefinement,
boolean pClone)
Selects a navigation refinement using a
DimLocation object. |
void |
setAggrERec(com.endeca.navigation.AggrERec pAggrERec)
Sets the associated AggrERec for this UrlState.
|
void |
setERec(com.endeca.navigation.ERec pERec)
Sets the associated ERec for this UrlState.
|
void |
setNavState(com.endeca.navigation.DimensionList pDescriptorDimensionList)
Sets the navigation state for this
UrlState using a DimensionList . |
void |
setNavState(com.endeca.navigation.DimLocationList pDimLocationList)
Sets the navigation state for this
UrlState using a DimLocationList . |
void |
setNavState(com.endeca.navigation.ERec pERec,
com.endeca.navigation.DimValList pDimValList)
Sets the navigation state for this
UrlState using an ERec
and a DimValList . |
String |
setParam(String pKey,
String pValue)
Associates the specified value with the specified key in the underlying
parameter map.
|
String |
toString()
Returns an encoded string representation of this
UrlState . |
public UrlState(UrlFormatter pUrlFormatter, String pEncoding)
UrlState
object.pUrlFormatter
- the UrlFormatter
to associate with the UrlState
pEncoding
- the character encoding that should be used when performing various
string transformations. If not null, this value overrides the default encoding for the
specified UrlFormatter
.UrlFormatter.getDefaultEncoding()
public String getEncoding()
UrlState
.public String toString()
UrlState
.
This method utilizes UrlFormatter.formatUrl(UrlState)
to construct
the string.public String getCanonicalLink()
UrlState
.public String setParam(String pKey, String pValue)
pKey
- the parameter keypValue
- the parameter valueIllegalArgumentException
- if the specified key is null.public String getParam(String pKey)
pKey
- the parameter keyIllegalArgumentException
- if the specified key is null.public UrlParam getUrlParam(String pKey)
UrlParam
value associated with the specified
key in the underlying parameter map. Returns null if there is no value for
the specified key.pKey
- the parameter keyUrlParam
value associated with the specified key,
or null if there is no associated parameter value.IllegalArgumentException
- if the specified key is null.public String removeParam(String pKey)
pKey
- the parameter keyIllegalArgumentException
- if the specified key is null.public Collection getParameters()
UrlParam
mappings contained within
this UrlState
.UrlParam
parameters.public void inform(com.endeca.navigation.ENEQueryResults pENEQueryResults)
UrlState
using state from the
specified ENEQueryResults
. This method is typically used
to construct fully "informed" UrlState
objects that can
be used to create ancestor or refinemement links.pENEQueryResults
- the query resultspublic boolean containsERec()
UrlState
contains an ERec parameter.UrlFormatter.getERecParamKey()
public void setERec(com.endeca.navigation.ERec pERec)
pERec
- the ERec to associate with this UrlState; can be null
to clear any previously associated ERecpublic com.endeca.navigation.ERec getERec()
public boolean containsAggrERec()
UrlState
contains an AggrERec parameter.UrlFormatter.getAggrERecParamKey()
public void setAggrERec(com.endeca.navigation.AggrERec pAggrERec)
pAggrERec
- the AggrERec to associate with this UrlState; can
be null to clear any previously associated AggrERecpublic com.endeca.navigation.AggrERec getAggrERec()
public boolean containsNavState()
UrlState
contains a navigation state
parameter.UrlFormatter.getNavStateParamKey()
public void setNavState(com.endeca.navigation.DimLocationList pDimLocationList)
UrlState
using a DimLocationList
.
This method is typically used to set navigation state from dimension
search results.pDimLocationList
- the DimLocationList to associate with this
UrlState.clearNavState()
,
removeNavState()
public void setNavState(com.endeca.navigation.DimensionList pDescriptorDimensionList)
UrlState
using a DimensionList
.
This method is typically used to set navigation state from
Navigation.getDescriptorDimensions()
from a current
ENEQueryResults
object.pDescriptorDimensionList
- the Dimension list to associate with this
UrlState.clearNavState()
,
removeNavState()
public void setNavState(com.endeca.navigation.ERec pERec, com.endeca.navigation.DimValList pDimValList)
UrlState
using an ERec
and a DimValList
. The ERec
is used to reconstruct
full a DimLocationList
for the specified DimValList
. If the
record does not contain enough information to reconstruct a particular DimLocation
,
a degenerate DimLocation
is created and added to the list instead. A degenerate
DimLocation
contains the DimVal and an empty ancestor list.pERec
- the source ERec
used to reconstruct a full
DimLocationList
object.pDimValList
- the descriptor DimVal
objects that
represent the desired navigation state.clearNavState()
,
removeNavState()
public com.endeca.navigation.DimLocationList getNavState()
UrlState
or null
if there is no navigation state.IllegalStateException
- if the navigation state wasn't explicitly
or implicitly set on this UrlState
.inform(ENEQueryResults)
,
setNavState(DimLocationList)
,
setNavState(DimensionList)
,
setNavState(ERec,DimValList)
,
clearNavState()
public void clearNavState()
UrlState
. This
method is the functional equivalent of setting "N=0"
.
This method will implicitly create an empty navigation
state if one doesn't already exist on this UrlState
.
public void removeNavState()
UrlState
.public UrlState selectRefinement(com.endeca.navigation.Dimension pRefinementDimension, com.endeca.navigation.DimVal pRefinement, boolean pClone)
DimVal
from the specified
refinement Dimension
. This method is typically used to
select navigation refinements from Navigation.getRefinements()
.
This method is functionally similar to ENEQueryToolkit.selectRefinement(...)
.
This method will implicitly create an empty navigation
state if one doesn't already exist on this UrlState
. This
is done before selecting the specified refinement.
pRefinementDimension
- a Dimension
object from
Navigation.getRefinementDimensions()
.pRefinement
- a valid refinement DimVal
from
pRefinementDimension.getRefinements()
.pClone
- specifies whether this operation should modify a
cloned instance of this UrlState
.UrlState
object that was modified, i.e. a cloned
UrlState
if pClone
is true
or
this
if pClone
is false
.IllegalStateException
- if the navigation state wasn't explicitly
or implicitly set on this UrlState
.inform(ENEQueryResults)
,
setNavState(DimLocationList)
,
setNavState(DimensionList)
,
setNavState(ERec,DimValList)
,
clearNavState()
public UrlState selectRefinement(com.endeca.navigation.DimLocation pRefinement, boolean pClone)
DimLocation
object.
This method is typically used to select navigation refinements from
ERec.getDimValues()
.
This method is functionally similar to ENEQueryToolkit.selectRefinement(...)
.
This method will implicitly create an empty navigation
state if one doesn't already exist on this UrlState
. This
is done before selecting the specified refinement.
pRefinement
- the DimLocation
to selectpClone
- specifies whether this operation should modify a
cloned instance of this UrlState
.UrlState
object that was modified, i.e. a cloned
UrlState
if pClone
is true
or
this
if pClone
is false
.IllegalStateException
- if the navigation state wasn't explicitly
set on this UrlState
.inform(ENEQueryResults)
,
setNavState(DimLocationList)
,
setNavState(DimensionList)
,
setNavState(ERec,DimValList)
,
clearNavState()
public UrlState selectAncestor(com.endeca.navigation.DimVal pAncestor, com.endeca.navigation.DimVal pDescriptor, boolean pClone)
DimVal
for the specified descriptor
DimVal
.
This method is functionally similar to ENEQueryToolkit.selectAncestor(...)
.
This method will implicitly create an empty navigation
state if one doesn't already exist on this UrlState
.
pAncestor
- the ancestor DimVal
to select.pDescriptor
- the descriptor DimVal
related to the specifed ancestor.pClone
- specifies whether this operation should modify a
cloned instance of this UrlState
.UrlState
object that was modified (i.e. a cloned
UrlState
if pClone
is true
or
this
if pClone
is false
.IllegalStateException
- if the navigation state wasn't explicitly
set on this UrlState
.inform(ENEQueryResults)
,
setNavState(DimLocationList)
,
setNavState(DimensionList)
,
setNavState(ERec,DimValList)
public UrlState removeDescriptor(com.endeca.navigation.DimVal pDescriptor, boolean pClone)
DimVal
from the current
navigation state.
This method is functionally similar to ENEQueryToolkit.removeDescriptor(...)
.
This method will implicitly create an empty navigation
state if one doesn't already exist on this UrlState
.
pDescriptor
- the DimVal
to removepClone
- specifies whether this operation should modify a
cloned instance of this UrlState
.UrlState
object that was modified, i.e. a cloned
UrlState
if pClone
is true
or
this
if pClone
is false
.IllegalStateException
- if the navigation state wasn't explicitly
set on this UrlState
.inform(ENEQueryResults)
,
setNavState(DimLocationList)
,
setNavState(DimensionList)
,
setNavState(ERec,DimValList)
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.