The ATG-Endeca integration includes an implementation of the VariantProducer interface,, for generating variant records for different locales. It also includes a component of this class, /atg/commerce/search/LocaleVariantProducer.

The LocaleVariantProducer class has a locales property where you specify the list of locales to generate variants for. For example:


You specify the VariantProducer components to use by setting the variantProducers property of the EndecaIndexingOutputConfig component. Note that this property is an array; you can specify any number of VariantProducer components. For example:


If you specify multiple variant producers, the EndecaIndexingOutputConfig generates a separate variant for each possible combination of values of the variant criteria. For example, suppose you use the configuration shown above, and MyVariantProducer creates three variants (1, 2, and 3). The total number of variants generated for each repository item is six (French 1, English 1, French 2, English 2, French 3, and English 3).

Accessing the Context Object

Classes that implement the PropertyAccessor or VariantProducer interface must be stateless, because they can be accessed by multiple threads at the same time. Rather than maintaining state themselves, these classes instead use an object of class to store state information and to pass data to each other. The Context object contains the current list of parent repository items that were navigated to reach the current item, the current URL (if any), the current collected output values (if any), and status information.

One of the main uses of the Context object is to store information used to determine what variant to generate next. For example, each time a new record is generated, the LocaleVariantProducer uses the next value in its locale array to set the currentDocumentLocale property of the Context object. A PropertyAccessor instance might read the currentDocumentLocale property and use its current value to determine the locale to use for the property.

Note that classes that implement the PropertyFormatter or PropertyValuesFilter interface (described below) are applied after all of the output properties have been gathered, so these classes do not have access to the Context object.

For more information about the Context object, see the ATG Platform API Reference.

Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved.

Legal Notices