com.endeca.infront.cartridge
Class ResultsListHandler

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

public class ResultsListHandler
extends NavigationCartridgeHandler<Config,Model>

Handler for the ResultsList cartridge.


Constructor Summary
ResultsListHandler()
           
 
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  void dispatchNavigationEventInformation(ResultsListConfig cartridgeConfig, ResultsList resultsList)
          Tracks all Navigation State related information.
 List<SortOptionConfig> getSortOptions()
          A list of sort options to display to the end user.
protected static long getTotalNumRecs(com.endeca.navigation.ENEQueryResults results)
           
 ResultsListConfig initialize(ContentItem pContentItem)
          Creates a ResultsListConfig representing the full configuration for this cartridge.
 void preprocess(ResultsListConfig cartridgeConfig)
          Creates a record list MDEX query.
 ResultsList process(ResultsListConfig cartridgeConfig)
          Creates a basic RecordList model.
protected  void retainFields(Map<String,Attribute> attributeMap, com.endeca.infront.cartridge.FieldNamesConfig config, boolean aggregationEnabled)
          Helper method for retaining properties.
 void setSortOptions(List<SortOptionConfig> sortOptions)
          Returns the list of sort options to display to the end user.
protected  ResultsListConfig wrapConfig(ContentItem pContentItem)
          Wraps the input ContentItem as a typed config object.
 
Methods inherited from class com.endeca.infront.cartridge.NavigationCartridgeHandler
createMdexRequest, dispatchNavigationEventInformation, executeMdexRequest, getActionPathProvider, getContentItemInitializer, getMdexRequestBroker, getNavigationState, 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

ResultsListHandler

public ResultsListHandler()
Method Detail

getSortOptions

public List<SortOptionConfig> getSortOptions()
A list of sort options to display to the end user.


setSortOptions

public void setSortOptions(List<SortOptionConfig> sortOptions)
Returns the list of sort options to display to the end user.

See Also:
getSortOptions()

initialize

public ResultsListConfig initialize(ContentItem pContentItem)
                             throws CartridgeHandlerException
Creates a ResultsListConfig representing the full configuration for this cartridge.

Specified by:
initialize in interface CartridgeHandler<ResultsListConfig>
Overrides:
initialize in class NavigationCartridgeHandler<ResultsListConfig,ResultsList>
Parameters:
pContentItem - cartridge instance configuration, typically from Experience Manager.
Returns:
Full configuration for this cartridge. It is not expected that this configuration will be further modified by the NavigationCartridgeHandler.preprocess(ConfigType) or NavigationCartridgeHandler.process(ConfigType) methods.
Throws:
CartridgeHandlerException - if an error occurs that is scoped to an individual cartridge instance (for instance, the handler is unable to access its default configuration). 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.
See Also:
NavigationCartridgeHandler.setContentItemInitializer(ContentItemInitializer), NavigationCartridgeHandler.wrapConfig(ContentItem)

wrapConfig

protected ResultsListConfig wrapConfig(ContentItem pContentItem)
Description copied from class: NavigationCartridgeHandler
Wraps the input ContentItem as a typed config object. It is not expected that subclasses will mutate the input ContentItem, beyond passing it into their typed configuration class as a constructor argument.

Specified by:
wrapConfig in class NavigationCartridgeHandler<ResultsListConfig,ResultsList>
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(ResultsListConfig cartridgeConfig)
                throws CartridgeHandlerException
Creates a record list MDEX query.

Specified by:
preprocess in interface CartridgeHandler<ResultsListConfig>
Overrides:
preprocess in class NavigationCartridgeHandler<ResultsListConfig,ResultsList>
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 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.

process

public ResultsList process(ResultsListConfig cartridgeConfig)
                    throws CartridgeHandlerException
Creates a basic RecordList model. Subclasses can override this method to create more complex models (for instance, if access to Dimension information from the record is needed).

Subclasses could also override the createRecordFromERec(com.endeca.navigation.ERec, com.endeca.infront.navigation.NavigationState, boolean, com.endeca.infront.cartridge.FieldNamesConfig) or createRecords(com.endeca.navigation.ENEQueryResults, com.endeca.infront.navigation.NavigationState, com.endeca.infront.cartridge.FieldNamesConfig) methods if they are only making a customization to the Record model.

Specified by:
process in interface CartridgeHandler<ResultsListConfig>
Overrides:
process in class NavigationCartridgeHandler<ResultsListConfig,ResultsList>
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.

dispatchNavigationEventInformation

protected void dispatchNavigationEventInformation(ResultsListConfig cartridgeConfig,
                                                  ResultsList resultsList)
Tracks all Navigation State related information.


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.
See Also:
RecordBasedNavigationCartridgeHandler.retainFields(java.util.Map, FieldNamesConfig, boolean)

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.


Copyright © 2012. All Rights Reserved.