/** * 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); }
/** * Reads all categories identified by the given category path for the given reference path.<p> * * @param cms the current cms context * @param categoryPath the path of the category to read * @param referencePath the reference path to find all the category repositories * * @return a list of matching categories, could also be empty, if no category exists with the given path * * @throws CmsException if something goes wrong */ public CmsCategory readCategory(CmsObject cms, String categoryPath, String referencePath) throws CmsException { // iterate all possible category repositories, starting with the most global one Iterator<String> it = getCategoryRepositories(cms, referencePath).iterator(); while (it.hasNext()) { String repository = it.next(); try { return getCategory(cms, internalCategoryRootPath(repository, categoryPath)); } catch (CmsVfsResourceNotFoundException e) { // throw the exception if no repository left if (!it.hasNext()) { throw e; } } } // this will never be executed return null; }
/** * Reads all categories identified by the given category path for the given reference path.<p> * * @param cms the current cms context * @param categoryPath the path of the category to read * @param referencePath the reference path to find all the category repositories * * @return a list of matching categories, could also be empty, if no category exists with the given path * * @throws CmsException if something goes wrong */ public CmsCategory readCategory(CmsObject cms, String categoryPath, String referencePath) throws CmsException { // iterate all possible category repositories, starting with the most global one Iterator it = getCategoryRepositories(cms, referencePath).iterator(); while (it.hasNext()) { String repository = (String)it.next(); try { return getCategory(cms, internalCategoryRootPath(repository, categoryPath)); } catch (CmsVfsResourceNotFoundException e) { // throw the exception if no repository left if (!it.hasNext()) { throw e; } } } // this will never be executed return null; }
List repositories = getCategoryRepositories(cms, referencePath); Iterator it = repositories.iterator(); while (it.hasNext()) {
List<String> categoriesList = catService.getCategoryRepositories(cms, cms.getSitePath(resource)); Iterator<String> it = categoriesList.iterator(); String catList = "|CategoryList=";
/** * @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; }
result = buildCategoryTree(cms, categories); } else { List<String> repositories = catService.getCategoryRepositories(cms, sitePath); repositories.remove(localCategoryRepositoryPath); categories = catService.readCategoriesForRepositories(cms, "", true, repositories);
folderPath += CmsCategoryService.CENTRALIZED_REPOSITORY; } else { List<String> repositories = getCategoryRepositories(cms, referencePath);
folderPath += CmsCategoryService.CENTRALIZED_REPOSITORY; } else { List repositories = getCategoryRepositories(cms, referencePath);