atg.commerce.search.producer
Class CustomCatalogVariantProducer

java.lang.Object
  extended by atg.commerce.search.producer.CustomCatalogVariantProducer
All Implemented Interfaces:
IndexConstants, atg.repository.search.indexing.VariantProducer

public class CustomCatalogVariantProducer
extends java.lang.Object
implements atg.repository.search.indexing.VariantProducer, IndexConstants

A VariantProducer that produces a variant for each ancestor catalog of the indexing document item type.

See Also:
atg.repository.search.index.producer.VariantProducer

Field Summary
static java.lang.String CLASS_VERSION
           
protected  CatalogProperties mCatalogProperties
           
protected  boolean mEnableCatalogVariants
           
 
Fields inherited from interface atg.commerce.search.IndexConstants
CATALOG_ATTR, CATALOGS_ITER_ATTR
 
Constructor Summary
CustomCatalogVariantProducer()
           
 
Method Summary
protected  java.util.Collection getAncestorCatalogs(Context pContext, RepositoryItem pItem, java.util.Map pUniqueParams)
          Gets the ancestor catalogs for the given item type.
protected  java.util.Collection getAncestorCatalogsForCategory(Context pContext, RepositoryItem pCategory, RepositoryItemDescriptor pBaseItemDescriptor, java.util.Map pUniqueParams)
          Gets the ancestor catalogs for the given category.
protected  java.util.Collection getAncestorCatalogsForProduct(Context pContext, RepositoryItem pProduct, RepositoryItemDescriptor pBaseItemDescriptor, java.util.Map pUniqueParams)
          Gets the ancestor catalogs for the given category.
protected  java.util.Collection getAncestorCatalogsForSku(Context pContext, RepositoryItem pSku, RepositoryItemDescriptor pBaseItemDescriptor, java.util.Map pUniqueParams)
          Gets the ancestor catalogs for the given category.
 CatalogProperties getCatalogProperties()
          Gets the CatalogProperties object that holds meta-data about the names of item-descriptors and property-descriptors used in custom catalogs.
 boolean isEnableCatalogVariants()
          Gets the enableCatalogVariants property.
 boolean prepareNextVariant(Context pContext, java.lang.String pPropertyName, RepositoryItem pItem, int pIndex, java.util.Map pUniqueParams)
          Get the next variant.
 void setCatalogProperties(CatalogProperties pCatalogProperties)
          Sets the CatalogProperties object that holds meta-data about the names of item-descriptors and property-descriptors used in custom catalogs.
 void setEnableCatalogVariants(boolean pEnableCatalogVariants)
          Sets the enableCatalogVariants property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION

mEnableCatalogVariants

protected boolean mEnableCatalogVariants

mCatalogProperties

protected CatalogProperties mCatalogProperties
Constructor Detail

CustomCatalogVariantProducer

public CustomCatalogVariantProducer()
Method Detail

isEnableCatalogVariants

public boolean isEnableCatalogVariants()
Gets the enableCatalogVariants property. If true, calls to prepareNextVariant will return a variant for each ancestor catalog.

This property accessor is used to index multiple versions of products when they contain catalog specific values in their info objects. If your custom catalog definition does not include any catalog specific properties, then catalog variant generation should be disabled. If you add any catalog specific properties that you would like to index, then you should set enableCatalogVariants to 'true' so that a product document is generated for each of the catalogs it is contained in.


setEnableCatalogVariants

public void setEnableCatalogVariants(boolean pEnableCatalogVariants)
Sets the enableCatalogVariants property. If true, calls to prepareNextVariant will return a variant for each ancestor catalog.


getCatalogProperties

public CatalogProperties getCatalogProperties()
Gets the CatalogProperties object that holds meta-data about the names of item-descriptors and property-descriptors used in custom catalogs.


setCatalogProperties

public void setCatalogProperties(CatalogProperties pCatalogProperties)
Sets the CatalogProperties object that holds meta-data about the names of item-descriptors and property-descriptors used in custom catalogs.


prepareNextVariant

public boolean prepareNextVariant(Context pContext,
                                  java.lang.String pPropertyName,
                                  RepositoryItem pItem,
                                  int pIndex,
                                  java.util.Map pUniqueParams)
Get the next variant. This method sets up the different variants of a catalog item based on the ancestor catalogs of a product. Each time this method is called by the loader, it will get the next ancestorCatalog from the product and set it to a context attribute. It will then return true. Once each ancestorCatalog of the product has been visited, this method will return false when called.

Specified by:
prepareNextVariant in interface atg.repository.search.indexing.VariantProducer
Parameters:
pContext - the current context.
pPropertyName - the name of the property in question
pItem - the original context item.
pIndex - the index of the variant
pUniqueParams - the parameters that will be added to the items URI. Keys and values should all be strings.

getAncestorCatalogs

protected java.util.Collection getAncestorCatalogs(Context pContext,
                                                   RepositoryItem pItem,
                                                   java.util.Map pUniqueParams)
Gets the ancestor catalogs for the given item type.


getAncestorCatalogsForCategory

protected java.util.Collection getAncestorCatalogsForCategory(Context pContext,
                                                              RepositoryItem pCategory,
                                                              RepositoryItemDescriptor pBaseItemDescriptor,
                                                              java.util.Map pUniqueParams)
Gets the ancestor catalogs for the given category.


getAncestorCatalogsForProduct

protected java.util.Collection getAncestorCatalogsForProduct(Context pContext,
                                                             RepositoryItem pProduct,
                                                             RepositoryItemDescriptor pBaseItemDescriptor,
                                                             java.util.Map pUniqueParams)
Gets the ancestor catalogs for the given category.


getAncestorCatalogsForSku

protected java.util.Collection getAncestorCatalogsForSku(Context pContext,
                                                         RepositoryItem pSku,
                                                         RepositoryItemDescriptor pBaseItemDescriptor,
                                                         java.util.Map pUniqueParams)
Gets the ancestor catalogs for the given category.