atg.projects.store.assembler.cartridge.handler
Class TargetedItemsHandler

java.lang.Object
  extended by com.endeca.infront.cartridge.NavigationCartridgeHandler<com.endeca.infront.assembler.ContentItem,TargetedItemsContentItem>
      extended by atg.projects.store.assembler.cartridge.handler.TargetedItemsHandler
All Implemented Interfaces:
com.endeca.infront.assembler.CartridgeHandler<com.endeca.infront.assembler.ContentItem>

public class TargetedItemsHandler
extends com.endeca.infront.cartridge.NavigationCartridgeHandler<com.endeca.infront.assembler.ContentItem,TargetedItemsContentItem>

TargetedItemsHandler adds a configurable prefix to the cartridge targeter component path if needed, resolves the targeter component, targets for a set number of items and adds them into TargeterItems.

Properties:

Version:
$Id: //hosting-blueprint/B2CBlueprint/version/10.2.1/Endeca/Assembler/src/atg/projects/store/assembler/cartridge/handler/TargetedItemsHandler.java#4 $$Change: 804523 $
Author:
Yekaterina Kostenevich

Field Summary
static java.lang.String CLASS_VERSION
           
protected static java.lang.String COMPONENT_PATH
           
protected static java.lang.String COMPONENT_PATH_SEPARATOR
           
protected static int DEFAULT_ITEMS_AMOUNT
           
protected static java.lang.String ITEM_COUNT
           
 
Constructor Summary
TargetedItemsHandler()
           
 
Method Summary
 java.lang.String getItemDescriptor()
           
 java.lang.String getPathPrefix()
           
 atg.repository.Repository getRepository()
           
 atg.targeting.TargetingSourceMap getSourceMap()
           
 atg.service.collections.validator.CollectionObjectValidator[] getValidators()
           
 TargetedItemsContentItem process(com.endeca.infront.assembler.ContentItem pCartridgeConfig)
           This method builds a full targeter/slot component path.
 void setItemDescriptor(java.lang.String pItemDescriptor)
           
 void setPathPrefix(java.lang.String pPathPrefix)
           
 void setRepository(atg.repository.Repository pRepository)
           
 void setSourceMap(atg.targeting.TargetingSourceMap pSourceMap)
           
 void setValidators(atg.service.collections.validator.CollectionObjectValidator[] pValidators)
           
 boolean validateItem(atg.repository.RepositoryItem pItem)
          Validate repository item using configured set of validators.
protected  com.endeca.infront.assembler.ContentItem wrapConfig(com.endeca.infront.assembler.ContentItem pContentitem)
          Create a new BasicContentItem using the passed in ContentItem.
 
Methods inherited from class com.endeca.infront.cartridge.NavigationCartridgeHandler
createMdexRequest, dispatchNavigationEventInformation, executeMdexRequest, executeMdexRequest, getActionPathProvider, getContentItemInitializer, getMdexRequestBroker, getNavigationState, initialize, populateNavigationPathDefaults, preprocess, setActionPathProvider, setContentItemInitializer, setMdexRequestBroker, setNavigationState
 
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
See Also:
Constant Field Values

COMPONENT_PATH_SEPARATOR

protected static final java.lang.String COMPONENT_PATH_SEPARATOR
See Also:
Constant Field Values

COMPONENT_PATH

protected static final java.lang.String COMPONENT_PATH
See Also:
Constant Field Values

ITEM_COUNT

protected static final java.lang.String ITEM_COUNT
See Also:
Constant Field Values

DEFAULT_ITEMS_AMOUNT

protected static final int DEFAULT_ITEMS_AMOUNT
See Also:
Constant Field Values
Constructor Detail

TargetedItemsHandler

public TargetedItemsHandler()
Method Detail

getPathPrefix

public java.lang.String getPathPrefix()
Returns:
the pathPrefix.

setPathPrefix

public void setPathPrefix(java.lang.String pPathPrefix)
Parameters:
pPathPrefix - - The pathPrefix to set.

getItemDescriptor

public java.lang.String getItemDescriptor()
Returns:
the item descriptor of item that should be used in this targeter.

setItemDescriptor

public void setItemDescriptor(java.lang.String pItemDescriptor)
Parameters:
pItemDescriptor - - The item descriptor of item that should be used in this targeter.

getRepository

public atg.repository.Repository getRepository()
Returns:
the repository of item that should be used by this targeter.

setRepository

public void setRepository(atg.repository.Repository pRepository)
Parameters:
pRepository - the repository of item that should be returned by this targeter.

getValidators

public atg.service.collections.validator.CollectionObjectValidator[] getValidators()
Returns:
array of validators that will be applied to items.

setValidators

public void setValidators(atg.service.collections.validator.CollectionObjectValidator[] pValidators)
Parameters:
pValidators - - The validators to set.

getSourceMap

public atg.targeting.TargetingSourceMap getSourceMap()
Returns:
the mSourceMap.

setSourceMap

public void setSourceMap(atg.targeting.TargetingSourceMap pSourceMap)
Parameters:
pSourceMap - - The sourceMap to set.

wrapConfig

protected com.endeca.infront.assembler.ContentItem wrapConfig(com.endeca.infront.assembler.ContentItem pContentitem)
Create a new BasicContentItem using the passed in ContentItem.

Specified by:
wrapConfig in class com.endeca.infront.cartridge.NavigationCartridgeHandler<com.endeca.infront.assembler.ContentItem,TargetedItemsContentItem>
Parameters:
pContentItem - - The cartridge content item to be wrapped.
Returns:
a new TargetedItems configuration.

process

public TargetedItemsContentItem process(com.endeca.infront.assembler.ContentItem pCartridgeConfig)
                                 throws com.endeca.infront.assembler.CartridgeHandlerException

This method builds a full targeter/slot component path. It is built using the component path configured in Experience Manager along with the pathPrefix property. The targeter/slot component is then resolved and the itemCount amount of items are targeted.

Items returned by slot/targeter should be of type itemDescriptor. Only items of this type will be put in the TargetedItemsContentItem. If an item of another type is found, error will be logged. If itemCount is not set, then all items returned by slot or targeter of type itemDescriptor will be put in the TargetedItemsContentItem.

Specified by:
process in interface com.endeca.infront.assembler.CartridgeHandler<com.endeca.infront.assembler.ContentItem>
Overrides:
process in class com.endeca.infront.cartridge.NavigationCartridgeHandler<com.endeca.infront.assembler.ContentItem,TargetedItemsContentItem>
Parameters:
pCartridgeConfig - - 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.
Returns:
a fully configured TargetedItemsContentItem.
Throws:
com.endeca.infront.assembler.CartridgeHandlerException

validateItem

public boolean validateItem(atg.repository.RepositoryItem pItem)
Validate repository item using configured set of validators.

Parameters:
pItem - - The item to validate.
Returns:
false if item fails validation, true if there should be no validation or if item is valid.