atg.commerce.csr.catalog
Class MapElementMRUList

java.lang.Object
  extended by atg.commerce.csr.catalog.MRUList<java.util.Map>
      extended by atg.commerce.csr.catalog.MapElementMRUList

public class MapElementMRUList
extends atg.commerce.csr.catalog.MRUList<java.util.Map>

A MRU list where elements are Map instances.

Using a Map is very flexible in JSP because any number of properties can be retained in the list. For example, if the MRU list is used to hold a list of view product items, each map element can hold the product ID, the product description, even UI state information for that particular product.

This class provides its own equals() list element identity check method, because the base class's method would not be appropriate for map elements. This equals() check is used to determine if two map list elements refer to the same item. In this case, the 'equalityTestKeys' property lists all the map keys who's values should be compared with another map list element for equality.

For example, if all map list elements contain unique values for "id" keys, then the 'equalityTestKeys' property could simply be "id". This would result in map list elements being considered equal if the value associated with each map's "id" key were equal(). Any number of key names (other than zero) of 'equalityTestKeys' can be specified.


Field Summary
static java.lang.String CLASS_VERSION
           
 
Constructor Summary
MapElementMRUList()
           
 
Method Summary
 boolean equals(java.lang.Object pElement1, java.lang.Object pElement2)
          Overriding base class's method, this method compares the values associated with each map's keys as a test for equality.
 java.lang.String[] getEqualityTestKeys()
          The names of the map list element keys to compare to test for element equality.
 void setEqualityTestKeys(java.lang.String[] pKeys)
          The names of the map list element keys to compare to test for element equality.
 
Methods inherited from class atg.commerce.csr.catalog.MRUList
add, addFirst, adding, find, getHistory, getMaxSize, getTop, removed, setMaxSize, setTop, shrinkIfNeeded
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
See Also:
Constant Field Values
Constructor Detail

MapElementMRUList

public MapElementMRUList()
Method Detail

setEqualityTestKeys

public void setEqualityTestKeys(java.lang.String[] pKeys)
The names of the map list element keys to compare to test for element equality.

Parameters:
pKeys - the map element keys

getEqualityTestKeys

public java.lang.String[] getEqualityTestKeys()
The names of the map list element keys to compare to test for element equality.

Returns:
pKeys the map element keys

equals

public boolean equals(java.lang.Object pElement1,
                      java.lang.Object pElement2)
Overriding base class's method, this method compares the values associated with each map's keys as a test for equality. The keys to be compared are specified in the 'equalityTestKeys' property.

Overrides:
equals in class atg.commerce.csr.catalog.MRUList<java.util.Map>
Returns:
true if both elements are maps the relevant keys match