org.broadleafcommerce.core.web.search
Class SearchFilterUtil
java.lang.Object
org.broadleafcommerce.core.web.search.SearchFilterUtil
public class SearchFilterUtil
- extends Object
SearchFilterUtil exposes a simple static method for filtering out products that do not match the
criteria POSTed to a controller by a SearchFilterTag.
|
Method Summary |
static void |
filterProducts(List<Product> products,
Map<String,String[]> parameters,
String[] allowedParameters)
filterProducts iterates over the products for each allowed parameter, filtering out products that do
not match the values passed in via the parameters argument. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SearchFilterUtil
public SearchFilterUtil()
filterProducts
public static void filterProducts(List<Product> products,
Map<String,String[]> parameters,
String[] allowedParameters)
- filterProducts iterates over the products for each allowed parameter, filtering out products that do
not match the values passed in via the parameters argument. There are 2 ways that a product can be
filtered out, corresponding to the multiSelect and sliderRange displayTypes on
SearchFilterItemTag.
For multiSelect items, the method will remove the product if the property specified in allowedParameters's
toString() method returns a String equal to one of the Strings in the corresponding String[] in parameters.
For sliderRange items, the property on the product must be of type Money. The product will be filtered
out if it's property is greater than the Money value parsed out of max-(property name) or smaller than the Money
value parsed from min-(property name)
- Parameters:
products - the list of products to filterparameters - the parameters passed to the controller. Generally request.getParameterMap()allowedParameters - an array of the allowed parameters to filter on
Copyright © 2013. All Rights Reserved.