There may be occasions when you need to pass additional parameters to a filter in order for the filter to do its work. For example, when filtering collections in a multisite environment, you must specify which sites’ items should be evaluated. To do this, the filtering classes in a multisite environment require two additional pieces of information:

To facilitate the passing of additional parameters, many of the methods in the atg.service.collections.filter.CachedCollectionFilter and atg.service.collections.filter.ChainedFilter filtering classes accept a pExtraParameters map. pExtraParameters is just a map that allows you to pass additional information to a filter so that it can do its work. All of these methods are overloaded with two signatures, one that uses the pExtraParameters map and another that doesn’t. The method that uses pExtraParameters contains the logic required to perform the given tasks. The method that doesn’t include pExtraParameters simply calls the method that does and passes in a null map. This use of overloading allows code that calls the original methods to continue to function properly while providing the flexibility to include additional filter parameters when needed.

You can choose to populate the pExtraParameters map in any way that makes sense for your implementation, although typically it is done through a combination of servlet bean properties and JSP settings. The example below describes how to pass site ID and site scope parameters to /atg/registry/CollectionFilters/GiftlistSiteFilter, a component that filters gift lists and gift items in a multisite environment. A servlet bean, /atg/registry/CollectionFilters/GiftlistSiteFilterDroplet, creates the pExtraParameters map with the site ID and site scope, and passes it along when it calls GiftlistSiteFilter.

Out of the box, the only filter Commerce includes that uses the pExtraParameters map is the GiftlistSiteFilter filter, mentioned above. You can find additional information on this filter, and the servlet bean that calls it, in the Filtering Gift Lists section of the ATG Commerce Programming Guide. Keep in mind that, while the pExtraParameters map was initially developed to support site-aware filters, it can be used to pass any additional parameters that your filters require.


Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices