|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.relations.CmsCategoryService
Provides several simplified methods for manipulating category relations.
Constructor Summary | |
CmsCategoryService()
|
Method Summary | |
void |
addResourceToCategory(CmsObject cms,
java.lang.String resourceName,
java.lang.String categoryPath)
Adds a resource identified by the given resource name to the category identified by the given category path. |
CmsCategory |
createCategory(CmsObject cms,
CmsCategory parent,
java.lang.String name,
java.lang.String title,
java.lang.String description)
Creates a new category, which is just a simplification of a folder under /system/categories/. |
void |
deleteCategory(CmsObject cms,
java.lang.String categoryPath)
Deletes the category identified by the given path. |
static CmsCategoryService |
getInstance()
Returns the singleton instance. |
void |
moveCategory(CmsObject cms,
java.lang.String oldCatPath,
java.lang.String newCatPath)
Renames/Moves a category from the old path to the new one. |
java.util.List |
readAllCategories(CmsObject cms,
boolean includeSubCats)
Reads all first level categories, including sub categories if needed. |
CmsCategory |
readCategory(CmsObject cms,
java.lang.String categoryPath)
Reads the category identified by the given category path. |
java.util.List |
readCategoryResources(CmsObject cms,
java.lang.String categoryPath,
boolean recursive)
Reads the resources for a category identified by the given category path. |
java.util.List |
readResourceCategories(CmsObject cms,
java.lang.String resourceName)
Reads the categories for a resource identified by the given resource name. |
java.util.List |
readSubCategories(CmsObject cms,
java.lang.String categoryPath,
boolean includeSubCats)
Returns all sub categories of the given category. |
void |
removeResourceFromCategory(CmsObject cms,
java.lang.String resourceName,
java.lang.String categoryPath)
Removes a resource identified by the given resource name from the category identified by the given category path. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CmsCategoryService()
Method Detail |
public static CmsCategoryService getInstance()
public void addResourceToCategory(CmsObject cms, java.lang.String resourceName, java.lang.String categoryPath) throws CmsException
cms
- the current cms contextresourceName
- the site relative path to the resource to addcategoryPath
- the path of the category to add the resource to
CmsException
- if something goes wrongpublic CmsCategory createCategory(CmsObject cms, CmsCategory parent, java.lang.String name, java.lang.String title, java.lang.String description) throws CmsException
cms
- the current cms contextparent
- the parent category or null
for a new top level categoryname
- the (file-) name for the new categorytitle
- the titledescription
- the description
CmsException
- if something goes wrongpublic void deleteCategory(CmsObject cms, java.lang.String categoryPath) throws CmsException
cms
- the current cms contextcategoryPath
- the path of the category to delete
CmsException
- if something goes wrongpublic void moveCategory(CmsObject cms, java.lang.String oldCatPath, java.lang.String newCatPath) throws CmsException
cms
- the current cms contextoldCatPath
- the path of the category to movenewCatPath
- the new category path
CmsException
- if something goes wrongpublic java.util.List readAllCategories(CmsObject cms, boolean includeSubCats) throws CmsException
cms
- the current cms contextincludeSubCats
- flag to indicate if sub categories should also be read
CmsCategory
objects
CmsException
- if something goes wrongpublic CmsCategory readCategory(CmsObject cms, java.lang.String categoryPath) throws CmsException
cms
- the current cms contextcategoryPath
- the path of the category to read
CmsException
- if something goes wrongpublic java.util.List readCategoryResources(CmsObject cms, java.lang.String categoryPath, boolean recursive) throws CmsException
cms
- the current cms contextcategoryPath
- the path of the category to read the resources forrecursive
- true
if including sub-categories
CmsResource
objects
CmsException
- if something goes wrongpublic java.util.List readResourceCategories(CmsObject cms, java.lang.String resourceName) throws CmsException
cms
- the current cms contextresourceName
- the path of the resource to get the categories for
CmsException
- if something goes wrongpublic java.util.List readSubCategories(CmsObject cms, java.lang.String categoryPath, boolean includeSubCats) throws CmsException
cms
- the current cms contextcategoryPath
- the path of the category to get the sub categories forincludeSubCats
- if to include sub-subcategories
CmsCategory
objects
CmsException
- if something goes wrongpublic void removeResourceFromCategory(CmsObject cms, java.lang.String resourceName, java.lang.String categoryPath) throws CmsException
cms
- the current cms contextresourceName
- the site relative path to the resource to removecategoryPath
- the path of the category to remove the resource from
CmsException
- if something goes wrong
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |