atg.projects.store.recommendations.processor
Class SetSearchTermProcessor

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.adc.pipeline.ADCPipelineProcessor
              extended by atg.adc.pipeline.PatternMappingProcessor
                  extended by atg.projects.store.recommendations.processor.SetSearchTermProcessor
All Implemented Interfaces:
atg.naming.AbsoluteNameable, atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameContextParentable, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.Configured, atg.nucleus.logging.ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, atg.nucleus.naming.ComponentNameResolver, atg.nucleus.Service, atg.nucleus.ServiceListener, atg.service.pipeline.PipelineProcessor, java.util.EventListener

public class SetSearchTermProcessor
extends atg.adc.pipeline.PatternMappingProcessor

This processor knows where to look up for the search term in the search results page request and stores corresponding search keyword into ADCRequestData object for the use in the remaining pipeline processors. The processor extends the atg.adc.pipeline.PatternMappingProcessor that gives the possibility to lookup URL parameter value for the configured set of pages. If the URL of the requested page matches an entry in the configured searchResultsPages property, the product ID is taken from a query parameter named in the categoryIdQueryArgs property.

Version:
$Id: //hosting-blueprint/B2CBlueprint/version/10.2.1/Recommendations/src/atg/projects/store/recommendations/processor/SetSearchTermProcessor.java#3 $Change: 630322 $
Author:
Yekaterina Kostenevich

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String PERFORM_OPERATION_NAME
           
 
Fields inherited from class atg.adc.pipeline.ADCPipelineProcessor
MADE_CHANGE, NO_CHANGE
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.service.pipeline.PipelineProcessor
STOP_CHAIN_EXECUTION, STOP_CHAIN_EXECUTION_AND_COMMIT, STOP_CHAIN_EXECUTION_AND_ROLLBACK
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
SetSearchTermProcessor()
           
 
Method Summary
 void doStartService()
          Initializes searchResultsPagePatterns property with compiled page patterns corresponding to searchResultsPages list.
protected  java.lang.String findQueryArgument(atg.servlet.DynamoHttpServletRequest pRequest, java.lang.String[] pQueryArgs)
          Looks for query arguments in request.
protected  java.lang.String findSearchKeyword(atg.adc.pipeline.ADCPipelineArgs pArgs)
          Finds the search keyword in the query arguments in the request.
 atg.core.util.PagePattern[] getSearchResultsPagePatterns()
          Gets compiled search results page patterns
 java.lang.String[] getSearchResultsPages()
          Gets search results pages
 atg.service.cache.Cache getSearchResultsPagesCache()
          Gets the search results pages cache
 java.lang.String[] getSearchTermQueryArgs()
          Gets search term query arguments
 boolean pathMatchesPattern(java.lang.String pPath, atg.core.util.PagePattern[] pPatterns, atg.service.cache.Cache pCache)
          This method will determine if the given path fits one of the patterns.
 void setSearchResultsPagePatterns(atg.core.util.PagePattern[] pSearchResultsPagePatterns)
          Sets compiled search results page patterns
 void setSearchResultsPages(java.lang.String[] pSearchResultsPages)
          Sets search results pages
 void setSearchResultsPagesCache(atg.service.cache.Cache pSearchResultsPagesCache)
          Sets the search results pages cache
 void setSearchTermQueryArgs(java.lang.String[] pSearchTermQueryArgs)
          Sets search term query arguments
 int updateADCData(atg.adc.pipeline.ADCPipelineArgs pArgs)
          Stores the search keyword in the ADCRequestData.
 
Methods inherited from class atg.adc.pipeline.PatternMappingProcessor
createPatternMappings, findMappingForPath
 
Methods inherited from class atg.adc.pipeline.ADCPipelineProcessor
getRetCodes, isEnabled, runProcess, setEnabled
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values

PERFORM_OPERATION_NAME

public static final java.lang.String PERFORM_OPERATION_NAME
See Also:
Constant Field Values
Constructor Detail

SetSearchTermProcessor

public SetSearchTermProcessor()
Method Detail

getSearchResultsPages

public java.lang.String[] getSearchResultsPages()
Gets search results pages

Returns:
the array of search results pages

setSearchResultsPages

public void setSearchResultsPages(java.lang.String[] pSearchResultsPages)
Sets search results pages

Parameters:
pSearchResultsPages - the array of search results pages

getSearchResultsPagesCache

public atg.service.cache.Cache getSearchResultsPagesCache()
Gets the search results pages cache

Returns:
the search results pages cache

setSearchResultsPagesCache

public void setSearchResultsPagesCache(atg.service.cache.Cache pSearchResultsPagesCache)
Sets the search results pages cache

Parameters:
pSearchResultsPagesCache - the search results pages cache

getSearchResultsPagePatterns

public atg.core.util.PagePattern[] getSearchResultsPagePatterns()
Gets compiled search results page patterns

Returns:
the compiled search results page patterns

setSearchResultsPagePatterns

public void setSearchResultsPagePatterns(atg.core.util.PagePattern[] pSearchResultsPagePatterns)
Sets compiled search results page patterns

Parameters:
pSearchResultsPagePatterns - the compiled search results page patterns

getSearchTermQueryArgs

public java.lang.String[] getSearchTermQueryArgs()
Gets search term query arguments

Returns:
the search term query arguments

setSearchTermQueryArgs

public void setSearchTermQueryArgs(java.lang.String[] pSearchTermQueryArgs)
Sets search term query arguments

Parameters:
pSearchTermQueryArgs - the search term query arguments

doStartService

public void doStartService()
                    throws atg.nucleus.ServiceException
Initializes searchResultsPagePatterns property with compiled page patterns corresponding to searchResultsPages list.

Overrides:
doStartService in class atg.nucleus.GenericService
Throws:
atg.nucleus.ServiceException - if the Service had a problem starting up

updateADCData

public int updateADCData(atg.adc.pipeline.ADCPipelineArgs pArgs)
Stores the search keyword in the ADCRequestData. If the current URL matches one of the searchResultsPages patterns then the current request is searched for to see if the page has a query parameter specified in searchTermQueryArgs If query parameter is found the corresponding search keyword is stored in the ADCRequestData.

Specified by:
updateADCData in class atg.adc.pipeline.ADCPipelineProcessor
Parameters:
pArgs - The pipeline arguments
Returns:
NO_CHANGE pipeline result code

findSearchKeyword

protected java.lang.String findSearchKeyword(atg.adc.pipeline.ADCPipelineArgs pArgs)
Finds the search keyword in the query arguments in the request. If the URL for the current request matches an entry in searchResultsPages, each argument name in searchTermQueryArgs is checked until something is found.

Parameters:
pArgs - The pipeline arguments
Returns:
The search keyword, or null if nothing found

findQueryArgument

protected java.lang.String findQueryArgument(atg.servlet.DynamoHttpServletRequest pRequest,
                                             java.lang.String[] pQueryArgs)
Looks for query arguments in request.

Parameters:
pRequest - the request in which query arguments will be looked for
pQueryArgs - the array of arguments to be looked in request
Returns:
the first pQueryArgs that is found in the request or null if none of them are found.

pathMatchesPattern

public boolean pathMatchesPattern(java.lang.String pPath,
                                  atg.core.util.PagePattern[] pPatterns,
                                  atg.service.cache.Cache pCache)
                           throws java.lang.Exception
This method will determine if the given path fits one of the patterns.

Parameters:
pPath - The url to search for
pPatterns - The url patterns
pCache - Cached results of previous paths
Returns:
boolean indicating if the path fits one of the patterns
Throws:
java.lang.Exception