com.endeca.infront.cartridge
Class RecordSpotlightHandler

java.lang.Object
  extended by com.endeca.infront.cartridge.NavigationCartridgeHandler<Config,Model>
      extended by com.endeca.infront.cartridge.RecordSpotlightHandler
All Implemented Interfaces:
CartridgeHandler<RecordSpotlightConfig>

public class RecordSpotlightHandler
extends NavigationCartridgeHandler<Config,Model>

Cartridge handler that creates RecordSpotlight model objects.


Constructor Summary
RecordSpotlightHandler()
           
 
Method Summary
protected  List<String> combineFieldNames(NavigationState navigationState, com.endeca.infront.cartridge.FieldNamesConfig config)
          Updates the list of string for retaining representative record properties.
protected  List<Record> createRecords(com.endeca.navigation.ENEQueryResults results, NavigationState navigationState, com.endeca.infront.cartridge.FieldNamesConfig config)
          Convert the records found in the given query to Record form.
protected  NavigationState createSpotlightNavigationState(NavigationState navigationState, RecordSpotlightConfig config)
          This method is responsible for merging the global NavigationState passed in with the RecordSpotlightConfig's navigation selection.
protected static long getTotalNumRecs(com.endeca.navigation.ENEQueryResults results)
           
 void preprocess(RecordSpotlightConfig cartridgeConfig)
          This method ensures the configuration's recordSelection is valid (i.e.
 RecordSpotlight process(RecordSpotlightConfig cartridgeConfig)
          This method processes the global query results in order to obtain information about the current navigation state dimensions, such as whether they are multi-or, and what their ancestors are.
protected  RecordSpotlight processSpotlightMdexResponse(NavigationState spotlightNavigationState, RecordSpotlightConfig config, com.endeca.navigation.ENEQueryResults eneResults)
          Protected method allows this to be overridden by subclasses of the CartridgeHandler.
protected  void retainFields(Map<String,Attribute> attributeMap, com.endeca.infront.cartridge.FieldNamesConfig config, boolean aggregationEnabled)
          Helper method for retaining properties.
protected  RecordSpotlightConfig wrapConfig(ContentItem pContentItem)
          Creates a RecordSpotlightConfig.
 
Methods inherited from class com.endeca.infront.cartridge.NavigationCartridgeHandler
createMdexRequest, dispatchNavigationEventInformation, executeMdexRequest, getActionPathProvider, getContentItemInitializer, getMdexRequestBroker, getNavigationState, initialize, populateNavigationPathDefaults, setActionPathProvider, setContentItemInitializer, setMdexRequestBroker, setNavigationState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecordSpotlightHandler

public RecordSpotlightHandler()
Method Detail

wrapConfig

protected RecordSpotlightConfig wrapConfig(ContentItem pContentItem)
Creates a RecordSpotlightConfig.

Specified by:
wrapConfig in class NavigationCartridgeHandler<RecordSpotlightConfig,RecordSpotlight>
Parameters:
pContentItem - the configuration for this cartridge handler. This will either be the fully initialized configuration object, if a ContentItemInitializer has been set, or it will simply be the instance configuration.
Returns:
an instance of ConfigType which wraps the input ContentItem.
See Also:
NavigationCartridgeHandler.initialize(ContentItem), NavigationCartridgeHandler.setContentItemInitializer(ContentItemInitializer)

preprocess

public void preprocess(RecordSpotlightConfig cartridgeConfig)
                throws CartridgeHandlerException
This method ensures the configuration's recordSelection is valid (i.e. not null). It also runs the globally shared query to get access to breadcrumbs metadata

Specified by:
preprocess in interface CartridgeHandler<RecordSpotlightConfig>
Overrides:
preprocess in class NavigationCartridgeHandler<RecordSpotlightConfig,RecordSpotlight>
Parameters:
cartridgeConfig - the cartridge configuration returned by CartridgeHandler.initialize(ContentItem). This cartridge configuration may be modified by this handler. Note that this cartridge configuration is also passed to CartridgeHandler.process(ContentItem).
Throws:
CartridgeHandlerException - if the recordSelection isn't valid

process

public RecordSpotlight process(RecordSpotlightConfig cartridgeConfig)
                        throws CartridgeHandlerException
This method processes the global query results in order to obtain information about the current navigation state dimensions, such as whether they are multi-or, and what their ancestors are. It passes this information through the NavigationState object to the createSpotlightNavigationState(NavigationState, RecordSpotlightConfig) method, which merges the spotlight's merchandiser configured navigation state with the user's navigation state, and then makes a second MDEX query for the spotlight results, which it then passes to processSpotlightMdexResponse(NavigationState, RecordSpotlightConfig, ENEQueryResults).

Specified by:
process in interface CartridgeHandler<RecordSpotlightConfig>
Overrides:
process in class NavigationCartridgeHandler<RecordSpotlightConfig,RecordSpotlight>
Parameters:
cartridgeConfig - the cartridge configuration returned by CartridgeHandler.initialize(ContentItem). Note that this instance may have been modified by the CartridgeHandler.preprocess(ContentItem) method.
Returns:
the output value for this cartridge. If null is returned, then the corresponding node in the output tree will be deleted.
Throws:
CartridgeHandlerException - if an error occurs that is scoped to an individual cartridge instance. This exception will not halt the entire assembly process, which occurs across multiple cartridges; instead, this exception will be packaged in the overall response model. If an unchecked exception is thrown, then the entire assembly process will be halted.

createSpotlightNavigationState

protected NavigationState createSpotlightNavigationState(NavigationState navigationState,
                                                         RecordSpotlightConfig config)
This method is responsible for merging the global NavigationState passed in with the RecordSpotlightConfig's navigation selection.

Subclasses can further modify the NavigationState that is used to query for the record spotlight results by overriding this method and returning a modified NavigationState

Parameters:
navigationState - the global navigation state
config -
Returns:
The resulting navigation state

processSpotlightMdexResponse

protected RecordSpotlight processSpotlightMdexResponse(NavigationState spotlightNavigationState,
                                                       RecordSpotlightConfig config,
                                                       com.endeca.navigation.ENEQueryResults eneResults)
Protected method allows this to be overridden by subclasses of the CartridgeHandler. Subclasses should override this method if they need access to the ENEQueryResults used in the creation of the RecordSpotlight model. Overriding the NavigationCartridgeHandler.executeMdexRequest(com.endeca.infront.navigation.request.MdexRequest) method will only provide access to the global ENEQueryResults which would be used for building Breadcrumbs or ResultsList, etc.

Returns:
the output RecordSpotlight model

combineFieldNames

protected List<String> combineFieldNames(NavigationState navigationState,
                                         com.endeca.infront.cartridge.FieldNamesConfig config)
                                  throws CartridgeHandlerException
Updates the list of string for retaining representative record properties.

Returns:
the combined field names from representative record field names, sub-record field names and potentially DGraph.WhyRank and DGraph.WhyMatch if whymatch and whyrank are turned on respectively.
Throws:
CartridgeHandlerException

getTotalNumRecs

protected static long getTotalNumRecs(com.endeca.navigation.ENEQueryResults results)

createRecords

protected List<Record> createRecords(com.endeca.navigation.ENEQueryResults results,
                                     NavigationState navigationState,
                                     com.endeca.infront.cartridge.FieldNamesConfig config)
Convert the records found in the given query to Record form.

Parameters:
results - result of MDEX query.
navigationState - base navigation state for record details links. If null, record details links are omitted.

retainFields

protected void retainFields(Map<String,Attribute> attributeMap,
                            com.endeca.infront.cartridge.FieldNamesConfig config,
                            boolean aggregationEnabled)
Helper method for retaining properties. Assumes getFieldNames() does not return null

Parameters:
attributeMap - A list of attributes to maintain on the records.
config - Cartridge Configuration used to determine which attributes to include.
aggregationEnabled - TRUE if aggregation is enabled on the request.


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