A simple implementation of the ItemFilter
and ItemHistory
interfaces is provided in the atg.service.filter.TopicHistoryConflictFilter
class, which maintains a historical record of all items that have been allowed through it so far. On invocation of its filterItems
method, it filters out any items that conflict either with other items in the same result set, or with any items that have been allowed through the filter on previous invocations.
Typically this object will be a session or request-scoped Nucleus component. If session-scoped, it provides conflict resolution over the course of the session; if request-scoped, it provides conflict resolution within the serving of a single page.
The algorithm used to resolve conflicts is as follows: each item is analyzed by looking at a set of specific DynamicBeans properties, whose names are supplied by the conflict filter configuration. The analysis determines these attributes for each item:
conflict topic
The name of a “topic” to which the item applies. For example, a soft drink promotion might belong to the topicsoftDrinks
, while a promotion for automobile parts might belong to the topicautoParts
.
conflict tag
A string that is used to resolve conflicts within a given topic. For example, a promotion for Cogswell Cogs auto parts might have a conflict tag ofCogswell
, while a Spacely Sprockets auto parts promotion might have a conflict tag ofSpacely
.
conflict priority
An integer that determines priority within a given topic.
Two items are considered to be in conflict if their conflict topics are the same, but their conflict tags differ. Thus, Cogswell Cogs and Spacely Sprockets promotions in the above examples would be considered in conflict with each other. On the other hand, a soft drink promotion would not conflict with an auto parts promotion, despite their conflict tags being different, because their conflict topics are not the same.
If two conflicting items belong to a single targeting result set being filtered, and conflict priorities can be determined, then the item with the greater priority wins. If conflict priorities cannot be determined, then a random choice is made.
If two items conflict and one item has already been recorded in the filter’s history as having passed the filter, then the other item is rejected.
The configurable properties of a TopicHistoryConflictFilter
are as follows:
itemTopicProperty
The name of an item DynamicBeans property which provides the conflict topic. If an item lacks this property, it will always pass the filter.
itemTagProperty
The name of an item DynamicBeans property which provides the conflict tag by default. If an item lacks this property, it will always pass the filter.
itemPriorityProperty
(optional)
The name of an item DynamicBeans property which provides the conflict priority. If omitted, then conflict priorities are ignored and conflicts within a result set are always resolved randomly.
Different conflict filters may be deployed in different servlet beans on the same site, if desired, to provide conflict resolution services that are customized for particular purposes.
The Personalization module includes a /atg/targeting/ConflictFilter
component that is a session-scoped conflict filter of type TopicHistoryConflictFilter
pre-configured to use the item property names conflictTopic
and conflictTag
.