While using the Oracle ATG system, we encounter various scenarios where we have to filter out a collection of the repository Items. They are returned as a part of an action/query based on specific conditions. These may include falling under a specific date range or under a particular site group or because the repository Items belonged to a particular user group. The RespositoryItem could be anything ranging from products or Promotions or correspond to any custom repository.

The ATG platform includes a filtering class – atg.service.collections.filter.ValidatorFilter. This is used to filter a collection of repository items. The components of this class, which is a subclass of atg.service.collections.filter.CachedCollectionFilter, can be passed to a servlet bean to execute the filtering operation.

In addition, the Commerce Reference Store includes the atg.projects.store.collections.filter.ItemValidatorFilter class, which is a subclass of ValidatorFilter. It is used to implement the atg.service.filter.ItemFilter interface and the components of this class can be passed to a servlet bean to filter items returned for slots.

The Commerce Reference Store uses these classes to filter products, promotional items, and other repository items based on various criteria, such as site groups and start and end dates. These classes have a validators property that can be set to an array of components of classes that implement the atg.service.collections.validator.CollectionObjectValidator interface. The validator components evaluate items such as promotions and catalog items to determine if they are valid for inclusion on sites.

For example, a ValidatorFilter component, /atg/store/collections/filter/PromotionFilter, is used by the /atg/store/droplet/PromotionFilterDroplet (of class atg.projects.store.droplet.PromotionFilterDroplet) to filter promotions. The PromotionFilter component’s validators property is set to an array of components of classes that implement the atg.service.collections.validator.CollectionObjectValidator interface. The PromotionFilter.validators property is set to:

validators=\
/atg/store/collections/validator/PromotionSiteValidator,\
/atg/store/collections/validator/PromotionDateValidator

The PromotionSiteValidator determines whether a promotion is acceptable based on whether the site it is associated with is in the same cart sharing group as the current site. The PromotionDateValidator determines whether a promotion is authorized depending on whether the current date is between the start date and end date for the promotion. In order for a promotion to go through, it must be approved by all the components listed in the validators property.

In addition to ValidationFilter and ItemValidationFilter, a number of other Commerce Reference Store classes can be configured to use validators. For example, the atg.projects.store.catalog.CatalogNavigationService class has validators property that list the components for evaluating which categories must be included in your Ecommerce solution.

 About SynergyTop

SynergyTop can help you make the best of your Oracle ATG investments. We have helped dozens of leading enterprise brands leverage Oracle Commerce Solution Suite to deliver engaging, relevant and profitable retail experiences.

Write to us at info@synergytop.com to ask how we can help you in the support and maintenance of your ATG deployments.