Class Name

atg.service.collections.filter.droplet.CollectionFilter

Components

/atg/commerce/collections/filter/droplet
/InventoryFilterDroplet
/atg/commerce/collections/filter/droplet
/ProductFilterDroplet
/atg/commerce/collections/filter/droplet
/ExcludeItemInCartFilterDroplet
/atg/commerce/collections/filter/droplet
/CartSharingFilterDroplet
/atg/commerce/collections/filter/droplet
/GiftListSiteFilterDroplet

The CollectionFilter servlet beans use collection filtering components to reduce objects in a collection. Each servlet bean works with a different collection filtering component.

The primary discussion of this class resides in Appendix B: ATG Servlet Beans of the Page Developer's Guide. For details about collection filtering components and caching, see the Filtering Collections chapter in the Personalization Programming Guide.

Note that each droplet’s filter input parameter has a different default value of class CollectionFilter:

  • InventoryFilterDroplet uses /atg/registry/CollectionFilters/InventoryFilter

  • ExcludeItemInCartFilterDroplet uses /atg/registry/CollectionFilters/ExcludeItemInCartFilter

  • ProductFilterDroplet uses /atg/registry/CollectionFilters/ProductFilter

  • CartSharingFilterDroplet uses /atg/registry/COllectionFilters/CartSharingFilter

ProductFilterDroplet Example

In this example, ProductFilterDroplet causes the filters (InventoryFilter and StartEndDateFiler)specified in the ProductFilter to apply their filtering mechanisms to a collection of products. The resultant collection of products that are in stock and active are displayed.

<dspel:droplet name="/atg/commerce/catalog/CategoryLookup">
   <dspel:param name="Id" param="catId"/>
   <dspel:oparam name="output">

   <%
    String collIdentifierKey = request.getParameter("catId") + "-childprd";
   %>
      <dspel:droplet name="/atg/commerce/collections/filter/droplet/
             ProductFilterDroplet">
         <dsp:param name="collection" param="item.childproducts/>
         <dsp:param name="collectionIdentifierKey" value="<%=collIdentifierKey
          %>"/>

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

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

         <dspel:oparam name="empty">
            There are currently no outdoor plants
         </dspel:oparam>
      </dspel:droplet>
   </dspel:oparam>
</dspel:droplet>
GiftListSiteFilterDroplet Examples

This JSP excerpt shows one example of how you can use GiftlistSiteFilterDroplet to filter gift lists. No site scope is passed in, so the GiftlistSiteFilter uses the GiftlistManager component’s siteScope, which for the purposes of this example is set to the atg.ShoppingCart shareable type component. Also, no site IDs are provided, so the filtered gift lists will come from the current site and sites that share a shopping cart with the current site only.

<dsp:droplet
name="/atg/commerce/collections/filter/droplet/GiftlistSiteFilterDroplet">
  <&-- Specify the collection to filter --%>
  <dsp:param name="collection" bean="Profile.giftlists"/>

  <dsp:oparam name="output">

    <%-- Iterate through the collection. --%>
      <dsp:droplet name="="/atg/dynamo/droplet/ForEach">
        <dsp:param name="array" param="filteredCollection"/>

        <dsp:oparam name="output">
          <dsp:setvalue param="giftList" paramvalue="element"/>
          <dsp:getvalueof var="eventName" param="giftList.eventName"/>
          <c:out value="${eventName}"/>
        </dsp:oparam>
      </dsp:droplet>

  </dsp:oparam>
</dsp:droplet>

This JSP excerpt filters a collection of wish list items. A site scope value of current is passed to the filter but no site IDs are passed, resulting in a collection of items from the current site only.

<dsp:droplet
name="/atg/commerce/collections/filter/droplet/GiftlistSiteFilterDroplet">
  <&-- Specify the collection to filter and the site scope. --%>
  <dsp:param name="collection" bean="Profile.wishlist.giftlistItems"/>
  <dsp:param name="siteScope" value="current"/>

  <dsp:oparam name="output">

    <%-- Iterate through the collection. --%>
      <dsp:droplet name="="/atg/dynamo/droplet/ForEach">
        <dsp:param name="array" param="filteredCollection"/>

        <dsp:oparam name="output">
          <dsp:setvalue param="giftItem" paramvalue="element"/>
          <dsp:getvalueof var="displayName" param="giftItem.displayName"/>
          <c:out value="${displayName}"/>
        </dsp:oparam>
      </dsp:droplet>

   </dsp:oparam>
</dsp:droplet>

Notes:


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