atg.projects.store.assembler.cartridge
Class CrossCartridgeItemsLookup

java.lang.Object
  extended by atg.projects.store.assembler.cartridge.ContentItemTreeIterator
      extended by atg.projects.store.assembler.cartridge.CrossCartridgeItemsLookup

public class CrossCartridgeItemsLookup
extends ContentItemTreeIterator

This is the subclass of ContentItemTreeIterator that iterates through the content item tree looking for the items displayed in different kind of cartridges. The main purpose of this class is to put all displayed items into one bucket so that other component can check it to avoid duplicates in the cartridges. The class looks for displayed items only in the cartridges with types configured in the typeToPropertyNameMap. The typeToPropertyNameMap contains mapping between cartridge type and property name where the displayed items are stored. Items itself are expected to be RepositoryItems or Endeca Record objects. If detected items are RepositoryItems the repository ID is stored into the storage. If items are Endeca Records then the ID of item is retrieved from the property configured in the itemIdKey property. The ContentItemTreeIterator also performs caching of content items with IDs configured in the contentItemsToCache list. The cached content items can be used in cases where displayed items are not part of content item but retrieved in the renderer code.


Field Summary
protected static java.lang.String CLASS_VERSION
          Class version string.
 
Constructor Summary
CrossCartridgeItemsLookup()
           
 
Method Summary
 java.util.Map<java.lang.String,java.util.List<com.endeca.infront.assembler.ContentItem>> getContentItemsCache()
          Returns the mapping between cartridge types and list of content items assembled for this request.
 java.util.List<java.lang.String> getContentItemsToCache()
          Returns the array of content item types which should be cached during content item tree iteration.
 java.util.List<java.lang.String> getDisplayedItems()
          Returns the list of displayed items
 java.lang.String getItemIdKey()
          Returns the content item key where the item's ID stored.
 java.util.Map<java.lang.String,java.lang.String> getTypeToPropertyNameMap()
          Returns the mapping between cartridge types and property names where the items we are looking for stored.
 void process(com.endeca.infront.assembler.ContentItem pContentItem)
          The implementation of content item process method.
 void setContentItemsCache(java.util.Map<java.lang.String,java.util.List<com.endeca.infront.assembler.ContentItem>> pContentItemsCache)
          Sets the mapping between cartridge types and list of content items assembled for this request.
 void setContentItemsToCache(java.util.List<java.lang.String> pContentItemsToCache)
          Sets the array of content item types which should be cached during content item tree iteration.
 void setDisplayedItems(java.util.List<java.lang.String> pDisplayedItems)
          Sets the list of displayed items
 void setItemIdKey(java.lang.String pItemIdKey)
          Sets the content item key where the item's ID stored.
 void setTypeToPropertyNameMap(java.util.Map<java.lang.String,java.lang.String> pTypeToPropertyNameMap)
          Sets the mapping between cartridge types and property names where the items we are looking for stored.
 
Methods inherited from class atg.projects.store.assembler.cartridge.ContentItemTreeIterator
getCircularReferenceErrorMessage, traverse, traverseChildren, traverseList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

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

See Also:
Constant Field Values
Constructor Detail

CrossCartridgeItemsLookup

public CrossCartridgeItemsLookup()
Method Detail

getDisplayedItems

public java.util.List<java.lang.String> getDisplayedItems()
Returns the list of displayed items

Returns:
The list of displayed items

setDisplayedItems

public void setDisplayedItems(java.util.List<java.lang.String> pDisplayedItems)
Sets the list of displayed items

Parameters:
pDisplayedItems - list of displayed items to set

getTypeToPropertyNameMap

public java.util.Map<java.lang.String,java.lang.String> getTypeToPropertyNameMap()
Returns the mapping between cartridge types and property names where the items we are looking for stored.


setTypeToPropertyNameMap

public void setTypeToPropertyNameMap(java.util.Map<java.lang.String,java.lang.String> pTypeToPropertyNameMap)
Sets the mapping between cartridge types and property names where the items we are looking for stored.

Parameters:
pTypeToPropertyNameMap - The mapping between cartridge types and property names where the items we are looking for stored.

getContentItemsToCache

public java.util.List<java.lang.String> getContentItemsToCache()
Returns the array of content item types which should be cached during content item tree iteration.


setContentItemsToCache

public void setContentItemsToCache(java.util.List<java.lang.String> pContentItemsToCache)
Sets the array of content item types which should be cached during content item tree iteration.

Parameters:
pContentItemsToCache - The array of content item types which should be cached during content item tree iteration.

getContentItemsCache

public java.util.Map<java.lang.String,java.util.List<com.endeca.infront.assembler.ContentItem>> getContentItemsCache()
Returns the mapping between cartridge types and list of content items assembled for this request.


setContentItemsCache

public void setContentItemsCache(java.util.Map<java.lang.String,java.util.List<com.endeca.infront.assembler.ContentItem>> pContentItemsCache)
Sets the mapping between cartridge types and list of content items assembled for this request.

Parameters:
pContentItemsCache - The mapping between cartridge types and list of content items assembled for this request.

getItemIdKey

public java.lang.String getItemIdKey()
Returns the content item key where the item's ID stored.


setItemIdKey

public void setItemIdKey(java.lang.String pItemIdKey)
Sets the content item key where the item's ID stored.

Parameters:
pItemIdKey - The content item key where the item's ID stored.

process

public void process(com.endeca.infront.assembler.ContentItem pContentItem)
The implementation of content item process method. The method checks whether the passed in content item has one of types configured in typeToPropertyNameMap and if so retrieves items from the property mapped to the corresponding cartridge type. Items IDs are stored into the displayedItems list. If the retrieved items are RepositoryItems the ID is taken from the repositoryId property, in the case when retrieved items are Endeca records the IDs are taken from the property configured in the itemIdKey.

Specified by:
process in class ContentItemTreeIterator
Parameters:
pContentItem - The content item to process