code: public static List<CmsCategoryTreeEntry> getCategoriesForSitePathStatic(
          CmsObject cms,
          String sitePath,
          String localCategoryRepositoryPath)
      throws CmsException {
  
          List<CmsCategoryTreeEntry> result;
          CmsCategoryService catService = CmsCategoryService.getInstance();
          List<CmsCategory> categories;
          Locale wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
          // get the categories
          if (null == localCategoryRepositoryPath) {
              categories = catService.readCategories(cms, "", true, sitePath);
              categories = catService.localizeCategories(cms, categories, wpLocale);
              result = buildCategoryTree(cms, categories);
          } else {
              List<String> repositories = catService.getCategoryRepositories(cms, sitePath);
              repositories.remove(localCategoryRepositoryPath);
              categories = catService.readCategoriesForRepositories(cms, "", true, repositories);
              categories = catService.localizeCategories(cms, categories, wpLocale);
              result = buildCategoryTree(cms, categories);
              categories = catService.readCategoriesForRepositories(
                  cms,
                  "",
                  true,
                  Collections.singletonList(localCategoryRepositoryPath));
              categories = catService.localizeCategories(cms, categories, wpLocale);
              List<CmsCategoryTreeEntry> localCategories = buildCategoryTree(cms, categories);
              result.addAll(localCategories);
          }
  
          return result;
      }
docs: Helper method for getting the category beans for the given site path.<p>
  
  @param cms the CMS context to use
  @param sitePath the site path
  @param localCategoryRepositoryPath the categories for this repository are added separately
  @return the list of category beans
  
  @throws CmsException if something goes wrong