Class CategoryWorker
java.lang.Object
org.apache.ofbiz.product.category.CategoryWorker
CategoryWorker - Worker class to reduce code in JSPs.
-
Method Summary
Modifier and TypeMethodDescriptionadjustTrail
(List<String> origTrail, String currentCategoryId, String previousCategoryId) static long
categoryMemberCount
(GenericValue category) static long
categoryRollupCount
(GenericValue category) static boolean
checkTrailItem
(ServletRequest request, String category) static List<GenericValue>
filterProductsInCategory
(Delegator delegator, List<GenericValue> valueObjects, String productCategoryId) static List<GenericValue>
filterProductsInCategory
(Delegator delegator, List<GenericValue> valueObjects, String productCategoryId, String productIdFieldName) static String
getCatalogTopCategory
(ServletRequest request, String defaultTopCategory) static void
getCategoriesWithNoParent
(ServletRequest request, String attributeName) static void
getCategoryContentWrappers
(Map<String, CategoryContentWrapper> catContentWrappers, List<GenericValue> categoryList, HttpServletRequest request) getCategoryTrail
(DispatchContext dctx, Map<String, Object> context) Returns a complete category trail - can be used for exporting proper category trees.static void
getRelatedCategories
(ServletRequest request, String attributeName, boolean limitView) static void
getRelatedCategories
(ServletRequest request, String attributeName, String parentId, boolean limitView) static void
getRelatedCategories
(ServletRequest request, String attributeName, String parentId, boolean limitView, boolean excludeEmpty) static List<GenericValue>
getRelatedCategoriesRet
(ServletRequest request, String attributeName, String parentId, boolean limitView) static List<GenericValue>
getRelatedCategoriesRet
(ServletRequest request, String attributeName, String parentId, boolean limitView, boolean excludeEmpty) static List<GenericValue>
getRelatedCategoriesRet
(ServletRequest request, String attributeName, String parentId, boolean limitView, boolean excludeEmpty, boolean recursive) static List<GenericValue>
getRelatedCategoriesRet
(Delegator delegator, String attributeName, String parentId, boolean limitView, boolean excludeEmpty, boolean recursive) getTrail
(ServletRequest request) static boolean
isCategoryEmpty
(GenericValue category) static boolean
isProductInCategory
(Delegator delegator, String productId, String productCategoryId) static String
lastTrailItem
(ServletRequest request) static void
setTrail
(ServletRequest request, String currentCategory) static void
setTrail
(ServletRequest request, String currentCategory, String previousCategory) setTrail
(ServletRequest request, List<String> crumb)
-
Method Details
-
getCatalogTopCategory
-
getCategoriesWithNoParent
-
getRelatedCategories
public static void getRelatedCategories(ServletRequest request, String attributeName, boolean limitView) -
getRelatedCategories
public static void getRelatedCategories(ServletRequest request, String attributeName, String parentId, boolean limitView) -
getRelatedCategories
public static void getRelatedCategories(ServletRequest request, String attributeName, String parentId, boolean limitView, boolean excludeEmpty) -
getRelatedCategoriesRet
public static List<GenericValue> getRelatedCategoriesRet(ServletRequest request, String attributeName, String parentId, boolean limitView) -
getRelatedCategoriesRet
public static List<GenericValue> getRelatedCategoriesRet(ServletRequest request, String attributeName, String parentId, boolean limitView, boolean excludeEmpty) -
getRelatedCategoriesRet
public static List<GenericValue> getRelatedCategoriesRet(ServletRequest request, String attributeName, String parentId, boolean limitView, boolean excludeEmpty, boolean recursive) -
getRelatedCategoriesRet
public static List<GenericValue> getRelatedCategoriesRet(Delegator delegator, String attributeName, String parentId, boolean limitView, boolean excludeEmpty, boolean recursive) -
isCategoryEmpty
-
categoryMemberCount
-
categoryRollupCount
-
setTrail
-
setTrail
public static void setTrail(ServletRequest request, String currentCategory, String previousCategory) -
adjustTrail
-
getTrail
-
setTrail
-
checkTrailItem
-
lastTrailItem
-
isProductInCategory
public static boolean isProductInCategory(Delegator delegator, String productId, String productCategoryId) throws GenericEntityException - Throws:
GenericEntityException
-
filterProductsInCategory
public static List<GenericValue> filterProductsInCategory(Delegator delegator, List<GenericValue> valueObjects, String productCategoryId) throws GenericEntityException - Throws:
GenericEntityException
-
filterProductsInCategory
public static List<GenericValue> filterProductsInCategory(Delegator delegator, List<GenericValue> valueObjects, String productCategoryId, String productIdFieldName) throws GenericEntityException - Throws:
GenericEntityException
-
getCategoryContentWrappers
public static void getCategoryContentWrappers(Map<String, CategoryContentWrapper> catContentWrappers, List<GenericValue> categoryList, HttpServletRequest request) throws GenericEntityException- Throws:
GenericEntityException
-
getCategoryTrail
Returns a complete category trail - can be used for exporting proper category trees. This is mostly useful when used in combination with bread-crumbs, for building a faceted index tree, or to export a category tree for migration to another system. Will create the tree from root point to categoryId. This method is not meant to be run on every request. Its best use is to generate the trail every so often and store somewhere (a lucene/solr tree, entities, cache or so).- Parameters:
dctx
- The DispatchContext that this service is operating incontext
- Map containing the input parameters- Returns:
- Map organized trail from root point to categoryId.
-