Collection filtering is the process of reducing objects in a collection based on some condition. Each collection filtering component defines a condition (for example, start date) and, when necessary, a criteria value (5/19/2004). When a collection filtering component receives a collection, it determines which objects satisfy the condition by having matching criteria (objects that have a start date on or before 5/19/2004). All matching objects become part of the result set collection while the remaining objects are “filtered out” or discarded.

When you want to filter a collection based on several conditions, you can create one complex filter. Another approach is to define one collection filtering component per condition and a filter chain component to organize the filters into a sequence chain. The chain produces one result set that satisfies all of the conditions specified by the filters within it.

A collection used in collection filtering can be made up of any grouping of objects. This grouping is passed to a collection filtering component by a scenario or a servlet bean in a JSP that is defined specifically for this purpose. Once the collection filter processes the collection, it returns the resultant collection to the invoking resource. When that resource is a servlet bean, you have the option of caching the resultant content in order to optimize performance for repeat collections accessed multiple times.

You can also access the collection filtering classes in the atg.service.collections.filter package using the API. See ATG API Reference for information.

ATG Commerce provides additional collection filtering components to ATG Commerce customers. See the ATG Commerce Guide to Setting Up a Store for more information.

This chapter describes collection filtering in the following sections:

loading table of contents...