Filters objects in a collection.

Class Name

atg.service.collections.filter.droplet.CollectionFilter

Component(s)

/atg/collections/filter/droplet/StartEndDateFilterDroplet

Required Input Parameters

collection

Identifies the collection of objects that require filtering.

Optional Input Parameters

collectionIdentifierKey

Specifies a string that represents the collection to filter. Each unique collection should have a unique string. This parameter is required in order to cache filtered content.

filter

Refers to the component responsible for performing the filter operation. The default value provided to StartEndDateFilterDroplet for this parameter is atg/registry/CollectionFilters/StartEndDateFilter.

profile

Points to a Profile RepositoryItem. Use this parameter when the filtering condition is based on profile information. If no value is provided to this parameter, the Profile associated with the active session is used. None of the implementations of CollectionFilter provided with the ATG platform use this parameter.

Output Parameters

filteredCollection

Holds a collection of items that satisfy the filter criteria.

errorMsg

Holds error messages generated during the servlet bean execution.

Open Parameters

output

Rendered when the filter component completes processing.

empty

Rendered if the resultant collection is empty.

error

Rendered if an error occurs.

Usage Notes

CollectionFilter uses collection filtering components to reduce objects in a collection. The resulting collection is accessed by an output parameter. The StartEndDateFilterDroplet instance passes the collection to the StartEndDateFilter so it can determine which items in the collection are active for the current date.

Two properties, consultCache and updateCache, govern whether CollectionFilter checks the cache for content and saves the resultant content to the cache respectively. These properties are set to true by default. There are other settings you need to configure to enable caching for StartEndDateFilter on the collection filtering component itself.

The CollectionFilter servlet bean class filter property can be set to a collection filter component, which serves as the default value for the filter input parameter.

See the Filtering Collections chapter of the ATG Personalization Programming Guide for more information on filtering collections.

Example

In this example, all articles that are started and not ended for the current day are displayed.

<dsp:tomap bean="/atg/dynamo/service/CurrentDate" var="date"/>

<dsp:droplet name="/atg/collections/filter/droplet/StartEndDateDroplet">
   <dsp:param name="collection" beanvalue="Articles"/>
   <dsp:param name="collectionIdentifierKey"
   value="featuredArticles${date.dateAsDate}"/>

      <dsp:oparam name="output">
      Featured Articles:
         <p><dsp:droplet name="/atg/dynamo/droplet/ForEach">
               <dsp:param name="array" param="filteredCollection"/>

               <dsp:oparam name="output">
                   <dsp:valueof param="param"/>
               </dsp:oparam>
            </dsp:droplet>
      </dsp:oparam>

      <dsp:oparam name="empty">
            There are no articles today
      </dsp:oparam>
   </dsp:oparam>
</dsp:droplet>

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