Note: The cartridge handlers for the targeting cartridges are built using the Oracle ATG Web Commerce actor framework that assembles chains of actors to accomplish tasks. This section describes the handlers themselves. For more information on actors and actor chains, see the Web Services Guide.
The cartridge handler components for the targeting cartridges are all instances of the atg.projects.store.assembler.cartridge.handler.ActorInvokingCartridgeHandler
class. The ActorInvokingCartridgeHandler
class is a helper class that does the following:
Augments a content item passed in from Experience Manager with additional properties. This content item becomes the source of input parameters for an actor that is subsequently invoked.
Invokes an actor to accomplish a task. In the case of the targeting cartridges, the task is retrieving targeted items from a repository.
Four cartridge handler components exist for the targeting cartridges:
/atg/endeca/assembler/cartridge/handler/PromotionalContentSlot
/atg/endeca/assembler/cartridge/handler/PromotionalContentTargeter
/atg/endeca/assembler/cartridge/handler/ProductSpotlightSlot
/atg/endeca/assembler/cartridge/handler/ProductSpotlightTargeter
These handler components specify the following properties so that their instances of the ActorInvokingCartridgeHandler
class can call an actor to retrieve the correctly targeted content:
itemDescriptor
: The item descriptor type that should be returned, for example,promotionalContent
orproduct
.actorToInvoke
: The actor to invoke. For the targeting cartridges, this property is set to the/atg/endeca/assembler/cartridge/actor/HomepageTargetedItemsActor
, which is described in more detail below.contentItemAdditionsMap
: A map that defines the additional parameters to add to the content item before it is passed to theactorToInvoke
actor. For the targeting cartridges, this map specifies apathPrefix
and arepository
. ThepathPrefix
is prepended, if necessary, to thecomponentPath
defined for the content item in Experience Manager in order to create a fully-qualified path to the ATG slot or targeter. Therepository
property defines the repository that contains the item descriptor type that should be returned. Note that item descriptor types are not unique across repositories, so both the item descriptor type and the repository type must be compared when calculating which items to return.actorExecutor
: A reference to the component that enables a cartridge handler to invoke an actor chain. Out of the box, this property is set to/atg/dynamo/service/actor/ActorExecutor
.
The HomepageTargetedItemsActor
extracts the properties from the augmented content item and creates a set of input parameters from them. As part of this process, the HomepageTargetedItemsActor
determines if the componentPath
provided by Experience Manager is a complete path and, if not, it prepends the componentPath
with the value in pathPrefix
. After a complete path is determined, the HomepageTargetedItemsActor
resolves the ATG slot or targeter component and calls the /atg/endeca/assembler/cartridge/actor/TargetedItemsActor
to retrieve the number of items specified in the itemCount
property from the appropriate ATG repository (if no itemCount
property is supplied, all of an ATG slot or targeter’s items are returned).
Note: This architecture of having one actor compute a set of input parameters and then pass them to another actor that executes the targeter allows Commerce Reference Store to have a single, generic actor that can execute targeters against any repository.
The TargetedItemsActor
validates the items it retrieves, first by calling the /atg/store/droplet/ItemValidatorDroplet
servlet bean for each targeted item and then by making sure each item’s repository ID matches the repository specified in the contentItemAdditionsMap
. The ItemValidatorDroplet
servlet bean applies the CollectionObjectValidator
components listed in its validators
property to the repository item to determine whether to include it in the returned content. By default, the validators
property is set to the /atg/store/collections/validator/StartEndDateValidator
component.
For product items, the TargetedItemsActor
also adds pricing, site ID, and currency code information to the content that is returned. The TargetedItemsActor
then returns the retrieved items to the HomepageTargetedItemsActor
. The HomepageTargetedItemsActor
stores the retrieved items in the "contentItem['atg:contents']items"
property and returns the content item to the Assembler.
Because the cartridge names do not identically match the cartridge handler names, the /atg/endeca/assembler/NucleusAssemblerFactory.handlerMapping
property includes the following mappings to associate each targeting cartridge with the correct handler component:
PromotionalContent-ATGSlot=\ /atg/endeca/assembler/cartridge/handler/PromotionalContentSlot,\ PromotionalContent-ATGTargeter=\ /atg/endeca/assembler/cartridge/handler/PromotionalContentTargeter,\ ProductSpotlight-ATGSlot=\ /atg/endeca/assembler/cartridge/handler/ProductSpotlightSlot,\ ProductSpotlight-ATGTargeter=\ /atg/endeca/assembler/cartridge/handler/ProductSpotlightTargeter,\
All four components specify the same repository for targeting, specifically, the catalog repository specified by the /atg/commerce/catalog/CatalogTools.catalog
property. Each component has its own value for the itemDescriptor
property and for the pathPrefix
value included in the contentItemAdditionsMap
property. These values are shown in the table below:
Component | itemDescriptor | pathPrefix |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|