Package org.apache.ofbiz.product.product
Class ProductSearchSession
- java.lang.Object
-
- org.apache.ofbiz.product.product.ProductSearchSession
-
public class ProductSearchSession extends java.lang.Object
Utility class with methods to prepare and perform ProductSearch operations in the content of an HttpSession
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ProductSearchSession.ProductSearchOptions
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
module
-
Constructor Summary
Constructors Constructor Description ProductSearchSession()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
checkDoKeywordOverride(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
A ControlServlet event method used to check to see if there is an override for any of the current keywords in the searchstatic void
checkSaveSearchOptionsHistory(javax.servlet.http.HttpSession session)
static java.lang.String
clearSearchOptionsHistoryList(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
static void
clearSearchOptionsHistoryList(javax.servlet.http.HttpSession session)
static int
getCategoryCostraintIndex(javax.servlet.http.HttpSession session)
static long
getCountForListPriceRange(java.math.BigDecimal priceLow, java.math.BigDecimal priceHigh, javax.servlet.http.HttpSession session, Delegator delegator)
This method returns count of products within a given price range, the constraint being applied on current ProductSearchConstraint list in session.static long
getCountForProductCategory(java.lang.String productCategoryId, javax.servlet.http.HttpSession session, Delegator delegator)
This method returns count of products in a given category (including all sub categories), the constraint being applied on current ProductSearchConstraint list in session.static ProductSearchSession.ProductSearchOptions
getProductSearchOptions(javax.servlet.http.HttpSession session)
static java.util.Map<java.lang.String,java.lang.Object>
getProductSearchResult(javax.servlet.http.HttpServletRequest request, Delegator delegator, java.lang.String prodCatalogId)
static java.util.List<ProductSearchSession.ProductSearchOptions>
getSearchOptionsHistoryList(javax.servlet.http.HttpSession session)
static java.util.List<java.util.Map<java.lang.String,java.lang.String>>
listCountByFeatureForType(java.lang.String productFeatureTypeId, javax.servlet.http.HttpSession session, Delegator delegator)
This method returns a list of productId counts grouped by productFeatureId's of input productFeatureTypeId, the constraint being applied on current ProductSearchConstraint list in session.static java.lang.String
makeSearchParametersString(javax.servlet.http.HttpSession session)
static java.lang.String
makeSearchParametersString(ProductSearchSession.ProductSearchOptions productSearchOptions)
static void
processSearchParameters(java.util.Map<java.lang.String,java.lang.Object> parameters, javax.servlet.http.HttpServletRequest request)
static void
searchAddConstraint(ProductSearch.ProductSearchConstraint productSearchConstraint, javax.servlet.http.HttpSession session)
static void
searchAddFeatureIdConstraints(java.util.Collection<java.lang.String> featureIds, java.lang.Boolean exclude, javax.servlet.http.HttpServletRequest request)
static void
searchClear(javax.servlet.http.HttpSession session)
static java.util.ArrayList<java.lang.String>
searchDo(javax.servlet.http.HttpSession session, Delegator delegator, java.lang.String prodCatalogId)
static java.util.List<java.lang.String>
searchGetConstraintStrings(boolean detailed, javax.servlet.http.HttpSession session, Delegator delegator)
static java.lang.String
searchGetSortOrderString(boolean detailed, javax.servlet.http.HttpServletRequest request)
static void
searchRemoveConstraint(int index, javax.servlet.http.HttpSession session)
static void
searchSetSortOrder(ProductSearch.ResultSortOrder resultSortOrder, javax.servlet.http.HttpSession session)
static void
setCurrentSearchFromHistory(int index, boolean removeOld, javax.servlet.http.HttpSession session)
static java.lang.String
setCurrentSearchFromHistory(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
-
-
-
Method Detail
-
getProductSearchOptions
public static ProductSearchSession.ProductSearchOptions getProductSearchOptions(javax.servlet.http.HttpSession session)
-
checkSaveSearchOptionsHistory
public static void checkSaveSearchOptionsHistory(javax.servlet.http.HttpSession session)
-
getSearchOptionsHistoryList
public static java.util.List<ProductSearchSession.ProductSearchOptions> getSearchOptionsHistoryList(javax.servlet.http.HttpSession session)
-
clearSearchOptionsHistoryList
public static void clearSearchOptionsHistoryList(javax.servlet.http.HttpSession session)
-
setCurrentSearchFromHistory
public static void setCurrentSearchFromHistory(int index, boolean removeOld, javax.servlet.http.HttpSession session)
-
clearSearchOptionsHistoryList
public static java.lang.String clearSearchOptionsHistoryList(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
-
setCurrentSearchFromHistory
public static java.lang.String setCurrentSearchFromHistory(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
-
checkDoKeywordOverride
public static final java.lang.String checkDoKeywordOverride(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
A ControlServlet event method used to check to see if there is an override for any of the current keywords in the search
-
searchDo
public static java.util.ArrayList<java.lang.String> searchDo(javax.servlet.http.HttpSession session, Delegator delegator, java.lang.String prodCatalogId)
-
searchClear
public static void searchClear(javax.servlet.http.HttpSession session)
-
searchGetConstraintStrings
public static java.util.List<java.lang.String> searchGetConstraintStrings(boolean detailed, javax.servlet.http.HttpSession session, Delegator delegator)
-
searchGetSortOrderString
public static java.lang.String searchGetSortOrderString(boolean detailed, javax.servlet.http.HttpServletRequest request)
-
searchSetSortOrder
public static void searchSetSortOrder(ProductSearch.ResultSortOrder resultSortOrder, javax.servlet.http.HttpSession session)
-
searchAddFeatureIdConstraints
public static void searchAddFeatureIdConstraints(java.util.Collection<java.lang.String> featureIds, java.lang.Boolean exclude, javax.servlet.http.HttpServletRequest request)
-
searchAddConstraint
public static void searchAddConstraint(ProductSearch.ProductSearchConstraint productSearchConstraint, javax.servlet.http.HttpSession session)
-
searchRemoveConstraint
public static void searchRemoveConstraint(int index, javax.servlet.http.HttpSession session)
-
processSearchParameters
public static void processSearchParameters(java.util.Map<java.lang.String,java.lang.Object> parameters, javax.servlet.http.HttpServletRequest request)
-
getProductSearchResult
public static java.util.Map<java.lang.String,java.lang.Object> getProductSearchResult(javax.servlet.http.HttpServletRequest request, Delegator delegator, java.lang.String prodCatalogId)
-
makeSearchParametersString
public static java.lang.String makeSearchParametersString(javax.servlet.http.HttpSession session)
-
makeSearchParametersString
public static java.lang.String makeSearchParametersString(ProductSearchSession.ProductSearchOptions productSearchOptions)
-
listCountByFeatureForType
public static java.util.List<java.util.Map<java.lang.String,java.lang.String>> listCountByFeatureForType(java.lang.String productFeatureTypeId, javax.servlet.http.HttpSession session, Delegator delegator)
This method returns a list of productId counts grouped by productFeatureId's of input productFeatureTypeId, the constraint being applied on current ProductSearchConstraint list in session.- Parameters:
productFeatureTypeId
- The productFeatureTypeId, productFeatureId's of which should be considered.session
- Current session.delegator
- The delegator object.- Returns:
- List of Maps containing productFeatureId, productFeatureTypeId, description, featureCount.
-
getCategoryCostraintIndex
public static int getCategoryCostraintIndex(javax.servlet.http.HttpSession session)
-
getCountForListPriceRange
public static long getCountForListPriceRange(java.math.BigDecimal priceLow, java.math.BigDecimal priceHigh, javax.servlet.http.HttpSession session, Delegator delegator)
This method returns count of products within a given price range, the constraint being applied on current ProductSearchConstraint list in session.- Parameters:
priceLow
- The low price.priceHigh
- The high price.session
- Current session.delegator
- The delegator object.- Returns:
- The long value of count of products.
-
getCountForProductCategory
public static long getCountForProductCategory(java.lang.String productCategoryId, javax.servlet.http.HttpSession session, Delegator delegator)
This method returns count of products in a given category (including all sub categories), the constraint being applied on current ProductSearchConstraint list in session.- Parameters:
productCategoryId
- productCategoryId for which the count should be returned.session
- Current session.delegator
- The delegator object.- Returns:
- The long value of count of products.
-
-