Class CategoryWorker


  • public final class CategoryWorker
    extends java.lang.Object
    CategoryWorker - Worker class to reduce code in JSPs.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String module  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<java.lang.String> adjustTrail​(java.util.List<java.lang.String> origTrail, java.lang.String currentCategoryId, java.lang.String previousCategoryId)  
      static long categoryMemberCount​(GenericValue category)  
      static long categoryRollupCount​(GenericValue category)  
      static boolean checkTrailItem​(javax.servlet.ServletRequest request, java.lang.String category)  
      static java.util.List<GenericValue> filterProductsInCategory​(Delegator delegator, java.util.List<GenericValue> valueObjects, java.lang.String productCategoryId)  
      static java.util.List<GenericValue> filterProductsInCategory​(Delegator delegator, java.util.List<GenericValue> valueObjects, java.lang.String productCategoryId, java.lang.String productIdFieldName)  
      static java.lang.String getCatalogTopCategory​(javax.servlet.ServletRequest request, java.lang.String defaultTopCategory)  
      static void getCategoriesWithNoParent​(javax.servlet.ServletRequest request, java.lang.String attributeName)  
      static void getCategoryContentWrappers​(java.util.Map<java.lang.String,​CategoryContentWrapper> catContentWrappers, java.util.List<GenericValue> categoryList, javax.servlet.http.HttpServletRequest request)  
      static java.util.Map<java.lang.String,​java.lang.Object> getCategoryTrail​(DispatchContext dctx, java.util.Map<java.lang.String,​java.lang.Object> context)
      Returns a complete category trail - can be used for exporting proper category trees.
      static void getRelatedCategories​(javax.servlet.ServletRequest request, java.lang.String attributeName, boolean limitView)  
      static void getRelatedCategories​(javax.servlet.ServletRequest request, java.lang.String attributeName, java.lang.String parentId, boolean limitView)  
      static void getRelatedCategories​(javax.servlet.ServletRequest request, java.lang.String attributeName, java.lang.String parentId, boolean limitView, boolean excludeEmpty)  
      static java.util.List<GenericValue> getRelatedCategoriesRet​(javax.servlet.ServletRequest request, java.lang.String attributeName, java.lang.String parentId, boolean limitView)  
      static java.util.List<GenericValue> getRelatedCategoriesRet​(javax.servlet.ServletRequest request, java.lang.String attributeName, java.lang.String parentId, boolean limitView, boolean excludeEmpty)  
      static java.util.List<GenericValue> getRelatedCategoriesRet​(javax.servlet.ServletRequest request, java.lang.String attributeName, java.lang.String parentId, boolean limitView, boolean excludeEmpty, boolean recursive)  
      static java.util.List<GenericValue> getRelatedCategoriesRet​(Delegator delegator, java.lang.String attributeName, java.lang.String parentId, boolean limitView, boolean excludeEmpty, boolean recursive)  
      static java.util.List<java.lang.String> getTrail​(javax.servlet.ServletRequest request)  
      static boolean isCategoryEmpty​(GenericValue category)  
      static boolean isProductInCategory​(Delegator delegator, java.lang.String productId, java.lang.String productCategoryId)  
      static java.lang.String lastTrailItem​(javax.servlet.ServletRequest request)  
      static void setTrail​(javax.servlet.ServletRequest request, java.lang.String currentCategory)  
      static void setTrail​(javax.servlet.ServletRequest request, java.lang.String currentCategory, java.lang.String previousCategory)  
      static java.util.List<java.lang.String> setTrail​(javax.servlet.ServletRequest request, java.util.List<java.lang.String> crumb)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • module

        public static final java.lang.String module
    • Method Detail

      • getCatalogTopCategory

        public static java.lang.String getCatalogTopCategory​(javax.servlet.ServletRequest request,
                                                             java.lang.String defaultTopCategory)
      • getCategoriesWithNoParent

        public static void getCategoriesWithNoParent​(javax.servlet.ServletRequest request,
                                                     java.lang.String attributeName)
      • getRelatedCategories

        public static void getRelatedCategories​(javax.servlet.ServletRequest request,
                                                java.lang.String attributeName,
                                                boolean limitView)
      • getRelatedCategories

        public static void getRelatedCategories​(javax.servlet.ServletRequest request,
                                                java.lang.String attributeName,
                                                java.lang.String parentId,
                                                boolean limitView)
      • getRelatedCategories

        public static void getRelatedCategories​(javax.servlet.ServletRequest request,
                                                java.lang.String attributeName,
                                                java.lang.String parentId,
                                                boolean limitView,
                                                boolean excludeEmpty)
      • getRelatedCategoriesRet

        public static java.util.List<GenericValue> getRelatedCategoriesRet​(javax.servlet.ServletRequest request,
                                                                           java.lang.String attributeName,
                                                                           java.lang.String parentId,
                                                                           boolean limitView)
      • getRelatedCategoriesRet

        public static java.util.List<GenericValue> getRelatedCategoriesRet​(javax.servlet.ServletRequest request,
                                                                           java.lang.String attributeName,
                                                                           java.lang.String parentId,
                                                                           boolean limitView,
                                                                           boolean excludeEmpty)
      • getRelatedCategoriesRet

        public static java.util.List<GenericValue> getRelatedCategoriesRet​(javax.servlet.ServletRequest request,
                                                                           java.lang.String attributeName,
                                                                           java.lang.String parentId,
                                                                           boolean limitView,
                                                                           boolean excludeEmpty,
                                                                           boolean recursive)
      • getRelatedCategoriesRet

        public static java.util.List<GenericValue> getRelatedCategoriesRet​(Delegator delegator,
                                                                           java.lang.String attributeName,
                                                                           java.lang.String parentId,
                                                                           boolean limitView,
                                                                           boolean excludeEmpty,
                                                                           boolean recursive)
      • isCategoryEmpty

        public static boolean isCategoryEmpty​(GenericValue category)
      • categoryMemberCount

        public static long categoryMemberCount​(GenericValue category)
      • categoryRollupCount

        public static long categoryRollupCount​(GenericValue category)
      • setTrail

        public static void setTrail​(javax.servlet.ServletRequest request,
                                    java.lang.String currentCategory)
      • setTrail

        public static void setTrail​(javax.servlet.ServletRequest request,
                                    java.lang.String currentCategory,
                                    java.lang.String previousCategory)
      • adjustTrail

        public static java.util.List<java.lang.String> adjustTrail​(java.util.List<java.lang.String> origTrail,
                                                                   java.lang.String currentCategoryId,
                                                                   java.lang.String previousCategoryId)
      • getTrail

        public static java.util.List<java.lang.String> getTrail​(javax.servlet.ServletRequest request)
      • setTrail

        public static java.util.List<java.lang.String> setTrail​(javax.servlet.ServletRequest request,
                                                                java.util.List<java.lang.String> crumb)
      • checkTrailItem

        public static boolean checkTrailItem​(javax.servlet.ServletRequest request,
                                             java.lang.String category)
      • lastTrailItem

        public static java.lang.String lastTrailItem​(javax.servlet.ServletRequest request)
      • getCategoryTrail

        public static java.util.Map<java.lang.String,​java.lang.Object> getCategoryTrail​(DispatchContext dctx,
                                                                                              java.util.Map<java.lang.String,​java.lang.Object> context)
        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 in
        context - Map containing the input parameters
        Returns:
        Map organized trail from root point to categoryId.