ClassName

atg.service.collections.filter.droplet.CollectionFilter

Component(s)

/atg/collections/filter/droplet/StartEndDateFilterDroplet

The CollectionFilter servlet beans use collection filtering components to reduce objects in a collection. The resultant 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 provides a filter property you can set to the collection filter component that is used as the default value for the filter input parameter.

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

Input Parameters

collection
This parameter identifies the collection of objects that require filtering. (Required)

collectionIdentifierKey
Specifies a string that represents the collection to be filtered. Each unique collection should have a unique string. This parameter is required if you want to cache filtered content.

filter
This parameter 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
This parameter points to a ProfileRepositoryItem. 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
This parameter holds a collection of items that satisfy the filter criteria.

errorMsg
This parameter holds error messages generated during the servlet bean execution.

Open Parameters

output
This parameter is rendered when the filter component completes processing.

empty
This parameter is rendered if the resultant collection is empty.

error
This parameter is rendered if an error occurs.

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>
 
loading table of contents...