/** * Returns all categories given some search parameters.<p> * * @param cms the current cms context * @param parentCategoryPath the path of the parent category to get the categories for * @param includeSubCats if to include all categories, or first level child categories only * @param referencePath the reference path to find all the category repositories * * @return a list of {@link CmsCategory} objects * * @throws CmsException if something goes wrong */ public List<CmsCategory> readCategories( CmsObject cms, String parentCategoryPath, boolean includeSubCats, String referencePath) throws CmsException { List<String> repositories = getCategoryRepositories(cms, referencePath); return readCategoriesForRepositories(cms, parentCategoryPath, includeSubCats, repositories); }
List<String> repositories = catService.getCategoryRepositories(cms, sitePath); repositories.remove(localCategoryRepositoryPath); categories = catService.readCategoriesForRepositories(cms, "", true, repositories); result = buildCategoryTree(cms, categories); categories = catService.readCategoriesForRepositories( cms, "",
/** * @see org.opencms.gwt.shared.rpc.I_CmsCoreService#getCategories(java.lang.String, boolean, java.util.List) */ public List<CmsCategoryTreeEntry> getCategories(String fromPath, boolean includeSubCats, List<String> refPaths) throws CmsRpcException { CmsObject cms = getCmsObject(); CmsCategoryService catService = CmsCategoryService.getInstance(); List<String> repositories = new ArrayList<String>(); if ((refPaths != null) && !refPaths.isEmpty()) { for (String refPath : refPaths) { repositories.addAll(catService.getCategoryRepositories(getCmsObject(), refPath)); } } else { repositories.add(CmsCategoryService.CENTRALIZED_REPOSITORY); } List<CmsCategoryTreeEntry> result = null; try { // get the categories List<CmsCategory> categories = catService.readCategoriesForRepositories( cms, fromPath, includeSubCats, repositories); result = buildCategoryTree(cms, categories); } catch (Throwable e) { error(e); } return result; }