The bean element defines a filter for a Java bean class or interface that is in the ModelMap. The filter can be defined at any level of the class and interface hierarchy, and will automatically apply classes and interfaces that have a filter with the same ID. Note that it is best to insert whole objects into the ModelMap and allow bean filtering to control the way that the object is viewed. By defining a filter for every object you can control the output for that object.

The bean element contains the following attributes:

Attribute

Description

name

The fully qualified package name of the class or interface.

default-filter

The ID of the default filter. If no default-filter is defined, the first filter is used.

Available Filters

There are three filters that are primarily used:

The following is an example of the ElectronicShippingGroup filter:

<bean type="atg.commerce.order.ElectronicShippingGroup>
  <filter id="summary">
    <property name="emailAddress"/>
     <property name="shippingAddress" hidden="true"/>
  </filter>
</bean>

If the same property is defined in the super and sub-class, the sub-type definition overrides the super-type property definition if both reference the same filter ID. If filters are defined on two interfaces that a Java servlet bean implements, but no filter is defined on the classes that the bean implements, the output from both interface filters will be included.

Working with Shared Properties

The bean element allows you to define properties that are shared in one filter and then reference the filter class by super-type. For example, the ElectronicShippingGroup and the HardgoodShippingGroup are similar. However, the ElectronicShippingGroup adds the emailAddress property and does not require the ShippingAddress property. In the following example, the majority of the properties have been moved to the super-type class ShippingGroup. Because the HardgoodShippingGroup contains all of the properties of the based ShippinGroup, it does not need a definition. The ElectronicShippingGroup defines the emailAddress property and hides the unneeded shippingAddress property.

Note: Combining all shipping groups within one filter is not recommended, the following is merely an example. It is best to have a filter defined for each shipping group:

<bean type="atg.commerce.order.ShippingGroup">
    <filter id="summary">
      <property name="actualShipDate"/>
      <property name="id"/>
      <property name="shipOnDate"/>
      <property name="shippingAddress"/>
      <property name="shippingGroupClassType"/>
      <property name="shippingMethod"/>
      <property name="specialInstructions"/>
      <property name="stateAsUserResource"/>
      <property name="stateDetail"/>
      <property name="submittedDate"/>
      <property name="trackingNumber"/>
    </filter>
  </bean>

  <bean type="atg.commerce.order.ElectronicShippingGroup>
    <filter id="summary">
      <property name="emailAddress"/>
      <property name="shippingAddress" hidden="true"/>
    </filter>
  <component>
  <!--
  <bean type="atg.commerce.order.HardgoodShippingGroup"
      super-type="atg.commerce.order.ShippingGroup"/> -- >
</bean>

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