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 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.
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
CLASS_VERSION
Class version string.
|
Constructor and Description |
---|
CrossCartridgeItemsLookup() |
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.util.List<com.endeca.infront.assembler.ContentItem>> |
getContentItemsCache() |
java.util.List<java.lang.String> |
getContentItemsToCache() |
java.util.List<java.lang.String> |
getDisplayedItems() |
java.lang.String |
getItemIdKey() |
java.util.Map<java.lang.String,java.lang.String> |
getTypeToPropertyNameMap() |
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) |
void |
setContentItemsToCache(java.util.List<java.lang.String> pContentItemsToCache) |
void |
setDisplayedItems(java.util.List<java.lang.String> pDisplayedItems) |
void |
setItemIdKey(java.lang.String pItemIdKey) |
void |
setTypeToPropertyNameMap(java.util.Map<java.lang.String,java.lang.String> pTypeToPropertyNameMap) |
getCircularReferenceErrorMessage, traverse, traverseChildren, traverseList
protected static final java.lang.String CLASS_VERSION
public java.util.List<java.lang.String> getDisplayedItems()
public void setDisplayedItems(java.util.List<java.lang.String> pDisplayedItems)
pDisplayedItems
- - The list of displayed items to set.public java.util.Map<java.lang.String,java.lang.String> getTypeToPropertyNameMap()
public void setTypeToPropertyNameMap(java.util.Map<java.lang.String,java.lang.String> pTypeToPropertyNameMap)
pTypeToPropertyNameMap
- - The mapping between cartridge types and property names where the items we
are looking for stored.public java.util.List<java.lang.String> getContentItemsToCache()
public void setContentItemsToCache(java.util.List<java.lang.String> pContentItemsToCache)
pContentItemsToCache
- - The array of content item types which should be cached during content
item tree iteration.public java.util.Map<java.lang.String,java.util.List<com.endeca.infront.assembler.ContentItem>> getContentItemsCache()
public void setContentItemsCache(java.util.Map<java.lang.String,java.util.List<com.endeca.infront.assembler.ContentItem>> pContentItemsCache)
pContentItemsCache
- - The mapping between cartridge types and list of content items
assembled for this request.public java.lang.String getItemIdKey()
public void setItemIdKey(java.lang.String pItemIdKey)
pItemIdKey
- - The content item key where the item's ID stored.public void process(com.endeca.infront.assembler.ContentItem pContentItem)
The implementation of content item process method. This method checks
whether the passed in content item has one of the types configured in
typeToPropertyNameMap
and if so, retrieves items from the
property mapped to the corresponding cartridge type.
Item IDs are stored in the displayedItems
list. If the retrieved
items are RepositoryItems, the ID is taken from the repositoryId property. In
the case when the retrieved items are Endeca records, the IDs are taken from
the property configured in the itemIdKey
.
process
in class ContentItemTreeIterator
pContentItem
- The configuration item.