Package org.opencms.jsp.util
Class CmsJspCategoryAccessBean
java.lang.Object
org.opencms.jsp.util.CmsJspCategoryAccessBean
Bean for easy access to categories of a resource in JSPs.
-
Constructor Summary
ConstructorsConstructorDescriptionCmsJspCategoryAccessBean
(CmsObject cms, CmsResource resource) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if the wrapped categories contain a given category.boolean
containsAll
(Collection<String> categoryPaths) Checks if the wrapped categories contain all given categories.boolean
containsAny
(Collection<String> categoryPaths) Checks if the wrapped categories contain at lease one of the given categories.Returns all wrapped categories.boolean
Returnstrue
if there is no category wrapped, otherwisefalse
.Returns only the leaf categories of the wrapped categories.Returns a map from a category path to the wrapper of all the sub-categories of the category with the path given as key.Returns all categories that are direct children of the current main category.
-
Constructor Details
-
CmsJspCategoryAccessBean
Default constructor.- Parameters:
cms
- the currentCmsObject
.resource
- the resource for which the categories should be read.
-
-
Method Details
-
contains
Checks if the wrapped categories contain a given category.- Parameters:
categoryPath
- the complete path of the category to check, e.g. "location/africa/"- Returns:
true
iff the wrapped categories contain a category with the provided categoryPath.
-
containsAll
Checks if the wrapped categories contain all given categories.- Parameters:
categoryPaths
- the complete paths of the categories to check, e.g. ["location/africa/", "news/"]- Returns:
true
iff for each of the provided categoryPaths, the wrapped categories contain a category with this path.
-
containsAny
Checks if the wrapped categories contain at lease one of the given categories.- Parameters:
categoryPaths
- the complete paths of the categories to check, e.g. ["location/africa/", "news/"]- Returns:
true
iff for at least one of the provided categoryPaths, the wrapped categories contain a category with this path.
-
getAllItems
Returns all wrapped categories.- Returns:
- all wrapped categories.
-
getIsEmpty
Returnstrue
if there is no category wrapped, otherwisefalse
.- Returns:
true
if there is no category wrapped, otherwisefalse
.
-
getLeafItems
Returns only the leaf categories of the wrapped categories. The method assumes that categories are ordered in the list, i.e., parents are directly followed by their children. NOTE: In the complete category tree a leaf of the wrapped tree part may not be a leaf.- Returns:
- only the leaf categories of the wrapped categories.
-
getSubCategories
Returns a map from a category path to the wrapper of all the sub-categories of the category with the path given as key.- Returns:
- a map from a category path to all sub-categories of the path's category.
-
getTopItems
Returns all categories that are direct children of the current main category.- Returns:
- all categories that are direct children of the current main category.
-