Class CategoryWorker


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

      • module

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

      • getCatalogTopCategory

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

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

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

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

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

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

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

        public static java.util.List<GenericValue> getRelatedCategoriesRet​(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​(ServletRequest request,
                                    java.lang.String currentCategory)
      • setTrail

        public static void setTrail​(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​(ServletRequest request)
      • setTrail

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

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

        public static java.lang.String lastTrailItem​(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.