Java URL Optimization API (SEO API) 2.1.1

com.endeca.soleng.urlformatter.seo
Class SeoDimLocationFormatter

java.lang.Object
  extended by com.endeca.soleng.urlformatter.seo.SeoDimLocationFormatter
All Implemented Interfaces:
DimLocationFormatter

public class SeoDimLocationFormatter
extends java.lang.Object
implements DimLocationFormatter

A formatter that generates URL path keywords from a DimLocation object in the order [root][ancestors][descriptor]. Optional StringFormatter objects can be added to process the DimVal names.

Property Summary
Property Type Default Value
key Object (String or Long) null
appendRoot boolean true
appendAncestors boolean true
appendDescriptor boolean true
separator char - (hyphen)
rootStringFormatter StringFormatter NOOP_STRING_FORMATTER
dimValStringFormatter StringFormatter NOOP_STRING_FORMATTER


Constructor Summary
SeoDimLocationFormatter()
           
SeoDimLocationFormatter(java.lang.Object pKey, boolean pAppendRoot, boolean pAppendAncestors, boolean pAppendDescriptor, char pSeparator)
           
 
Method Summary
 java.lang.String formatDimLocation(com.endeca.soleng.urlformatter.UrlState pUrlState, com.endeca.navigation.DimLocation pDimLocation)
          Formats the specified DimLocation for the specified UrlState.
 boolean getAppendAncestors()
          Indicates whether or not to append ancestor DimVal names to the URL.
 boolean getAppendDescriptor()
          Indicates whether or not to append the descriptor DimVal name to the URL.
 boolean getAppendRoot()
          Indicates whether or not to append the root DimVal name to the URL.
 StringFormatter getDimValStringFormatter()
          The StringFormatter that is used to process the ancestor and descriptor DimVal names.
 java.lang.Object getKey()
          The dimension name or id used to associate a DimLocationFormatter with a specific dimension.
 StringFormatter getRootStringFormatter()
          The StringFormatter that is used to process the root DimVal name.
 char getSeparator()
          The separator character that is used to separate root, ancestor, and descriptor DimVal names.
 void setAppendAncestors(boolean pAppendAncestors)
          Specifies whether or not to append ancestor DimVal names to the URL.
 void setAppendDescriptor(boolean pAppendDescriptor)
          Specifies whether or not to append the descriptor DimVal name to the URL.
 void setAppendRoot(boolean pAppendRoot)
          Specifies whether or not to append the root DimVal name to the URL.
 void setDimValStringFormatter(StringFormatter pDimValStringFormatter)
          Specifies the StringFormatter that is used to process the ancestor and descriptor DimVal names.
 void setKey(java.lang.Object pKey)
          Specifies the dimension name or id used to associate a DimLocationFormatter with a specific dimension.
 void setRootStringFormatter(StringFormatter pRootStringFormatter)
          Specifies the StringFormatter that is used to process the root DimVal name.
 void setSeparator(char pSeparator)
          Specifies the separator character that is used to separate root, ancestor, and descriptor DimVal names.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SeoDimLocationFormatter

public SeoDimLocationFormatter()

SeoDimLocationFormatter

public SeoDimLocationFormatter(java.lang.Object pKey,
                               boolean pAppendRoot,
                               boolean pAppendAncestors,
                               boolean pAppendDescriptor,
                               char pSeparator)
Method Detail

getKey

public java.lang.Object getKey()
The dimension name or id used to associate a DimLocationFormatter with a specific dimension.

Specified by:
getKey in interface DimLocationFormatter
Returns:
the dimension name or id (a String or Long respectively).
See Also:
SeoNavStateFormatter.setUseDimensionNameAsKey(boolean), SeoERecFormatter.setUseDimensionNameAsKey(boolean)

setKey

public void setKey(java.lang.Object pKey)
Specifies the dimension name or id used to associate a DimLocationFormatter with a specific dimension.

Parameters:
pKey - the dimension name or id (a String or Long respectively).
See Also:
SeoNavStateFormatter.setUseDimensionNameAsKey(boolean), SeoERecFormatter.setUseDimensionNameAsKey(boolean)

getAppendRoot

public boolean getAppendRoot()
Indicates whether or not to append the root DimVal name to the URL.


setAppendRoot

public void setAppendRoot(boolean pAppendRoot)
Specifies whether or not to append the root DimVal name to the URL.

If true for the "Wine Type" dimension, then the following URL would be output:

  http://wines.endeca.com/browse/New-Zealand/Wine-Type-White-Sauvignon-Blanc/Cloudy-Bay/_/N-1z141hbZ66sZ1z1413q
 

If false, the URL would be output as follows (with "Wine-Type" omitted):

  http://wines.endeca.com/browse/New-Zealand/White-Sauvignon-Blanc/Cloudy-Bay/_/N-1z141hbZ66sZ1z1413q
 

Parameters:
pAppendRoot - flag specifying whether the root DimVal name should be appended to the URL.

getAppendAncestors

public boolean getAppendAncestors()
Indicates whether or not to append ancestor DimVal names to the URL.


setAppendAncestors

public void setAppendAncestors(boolean pAppendAncestors)
Specifies whether or not to append ancestor DimVal names to the URL.

If true for the "Wine Type" dimension, then the following URL would be output:

  http://wines.endeca.com/browse/New-Zealand/Wine-Type-White-Sauvignon-Blanc/Cloudy-Bay/_/N-1z141hbZ66sZ1z1413q
 

If false, the URL would be output as follows (with "White" omitted):

  http://wines.endeca.com/browse/New-Zealand/Wine-Type-Sauvignon-Blanc/Cloudy-Bay/_/N-1z141hbZ66sZ1z1413q
 

Parameters:
pAppendAncestors - flag specifying whether the ancestor DimVal names should be appended to the URL.

getAppendDescriptor

public boolean getAppendDescriptor()
Indicates whether or not to append the descriptor DimVal name to the URL.


setAppendDescriptor

public void setAppendDescriptor(boolean pAppendDescriptor)
Specifies whether or not to append the descriptor DimVal name to the URL.

If true for the "Wine Type" dimension, then the following URL would be output:

  http://wines.endeca.com/browse/New-Zealand/Wine-Type-White-Sauvignon-Blanc/Cloudy-Bay/_/N-1z141hbZ66sZ1z1413q
 

If false, the URL would be output as follows (with "Sauvignon-Blanc" omitted):

  http://wines.endeca.com/browse/New-Zealand/Wine-Type-White/Cloudy-Bay/_/N-1z141hbZ66sZ1z1413q
 

Parameters:
pAppendDescriptor - flag specifying whether the descriptor DimVal name should be appended to the URL.

getSeparator

public char getSeparator()
The separator character that is used to separate root, ancestor, and descriptor DimVal names.


setSeparator

public void setSeparator(char pSeparator)
Specifies the separator character that is used to separate root, ancestor, and descriptor DimVal names.

In the following example, '/' is the separator character associated with the "Wine Type" dimension:

  http://wines.endeca.com/browse/New-Zealand/Wine-Type/White/Sauvignon-Blanc/Cloudy-Bay/_/N-1z141hbZ66sZ1z1413q
 

Parameters:
pSeparator - the separator character to use.

getRootStringFormatter

public StringFormatter getRootStringFormatter()
The StringFormatter that is used to process the root DimVal name.


setRootStringFormatter

public void setRootStringFormatter(StringFormatter pRootStringFormatter)
Specifies the StringFormatter that is used to process the root DimVal name.

The following example shows the resulting URL if a RegexStringFormatter with a match pattern of "Wine-Type" and a replacement string of "Wine" were used for the "Wine Type" dimension:

  Before:
  http://wines.endeca.com/browse/New-Zealand/Wine-Type-White-Sauvignon-Blanc/Cloudy-Bay/_/N-1z141hbZ66sZ1z1413q

  After:
  http://wines.endeca.com/browse/New-Zealand/Wine-White-Sauvignon-Blanc/Cloudy-Bay/_/N-1z141hbZ66sZ1z1413q
 

Parameters:
pRootStringFormatter - the StringFormatter that is used to process the roo DimVal name.
See Also:
StringFormatterChain, RegexStringFormatter, UpperCaseStringFormatter, LowerCaseStringFormatter, UrlEncodedStringFormatter

getDimValStringFormatter

public StringFormatter getDimValStringFormatter()
The StringFormatter that is used to process the ancestor and descriptor DimVal names.


setDimValStringFormatter

public void setDimValStringFormatter(StringFormatter pDimValStringFormatter)
Specifies the StringFormatter that is used to process the ancestor and descriptor DimVal names.

The following example shows the resulting URL if an UpperCaseStringFormatter were used for the "Wine Type" dimension:

  before
  http://wines.endeca.com/browse/New-Zealand/Wine-Type-White-Sauvignon-Blanc/Cloudy-Bay/_/N-1z141hbZ66sZ1z1413q

  after
  http://wines.endeca.com/browse/New-Zealand/Wine-Type-WHITE-SAUVIGNON-BLANC/Cloudy-Bay/_/N-1z141hbZ66sZ1z1413q
 

Note that only the ancestor and descriptor DimVal names have been converted to uppercase. Specifically, the "Wine-Type" root dimension name is left untouched.

Parameters:
pDimValStringFormatter - the StringFormatter that is used to process DimVal names.
See Also:
StringFormatterChain, RegexStringFormatter, UpperCaseStringFormatter, LowerCaseStringFormatter, UrlEncodedStringFormatter

formatDimLocation

public java.lang.String formatDimLocation(com.endeca.soleng.urlformatter.UrlState pUrlState,
                                          com.endeca.navigation.DimLocation pDimLocation)
                                   throws com.endeca.soleng.urlformatter.UrlFormatException
Description copied from interface: DimLocationFormatter
Formats the specified DimLocation for the specified UrlState.

Specified by:
formatDimLocation in interface DimLocationFormatter
Parameters:
pUrlState - the UrlState that contains the specified DimLocation
pDimLocation - the DimLocation to be formatted
Returns:
a formatted string
Throws:
com.endeca.soleng.urlformatter.UrlFormatException - if the DimLocation cannot be properly formatted

Java URL Optimization API (SEO API) 2.1.1

Copyright © 2012 Endeca Technologies, Inc. All Rights Reserved.
@VERSION
PRODUCT: Java URL Optimization API (SEO API) (urlFormatterSeo)
VERSION: 2.1.1
BUILD:   12083DEV
ARCH_OS: n/a
DATE:    2012-02-16T20:40:10-0500