Each collection filtering class relies on the base abstract class atg.service.collections.filter.CachedCollectionFilter for the ability to filter collections. This class is designed to receive a collection, remove items from the collection, and create a result set. It’s possible to pass a Profile to this class so that subclasses can use Profile property values as filter conditions. Other objects and properties may also be passed and used as filter conditions (see Passing Additional Parameters to a Filter (Filtering in a Multisite Environment) for more details). Finally, this class is capable of caching the filtered collection.

When you want to filter objects in a collection, you use a subclass of CachedCollectionFilter. ATG comes with several subclasses already implemented:

  • atg.service.collections.filter.StartEndDateFilter limits a collection by removing objects that are inactive. You can find an instance of it in /atg/registry/CollectionFilters/StartEndDateFilter and a servlet bean for accessing it from a JSP in /atg/collections/filter/droplet/StartEndDateFilterDroplet.

  • atg.service.collections.filter.ChainedFilter lets you chain several filters together so the resultant collection contains items that meet the conditions of all filters in the chain. There are no sample components in ATG Relationship Management, but Commerce includes a sample filtering component and servlet bean. See the Filtering Collections of Products chapter of the ATG Commerce Guide to Setting Up a Store for details about this and other components of CachedCollectionFilter.

  • atg.commerce.gifts.GiftlistSiteFilter filters gift lists and gift items in a multisite environment. You can find an instance of this class in /atg/registry/CollectionFilters/GiftlistSiteFilter and a servlet bean for accessing it in /atg/commerce/collections/filter/droplet/GiftlistSiteFilterDroplet. For more information, see Passing Additional Parameters to a Filter (Filtering in a Multisite Environment).