private void loadCategories(CategoryGraph graph) throws DaoException {
   LOG.info("loading categories...");
   graph.catIndexes = new TIntIntHashMap();
   List<String> catList = new ArrayList<String>();
   Iterable<LocalPage> catIter =
       pageDao.get(new DaoFilter().setNameSpaces(NameSpace.CATEGORY).setLanguages(graph.language));
   TIntList catIds = new TIntArrayList();
   for (LocalPage cat : catIter) {
     if (cat != null) {
       if (graph.catIndexes.containsKey(cat.getLocalId())) {
         continue;
       }
       assert (catList.size() == graph.catIndexes.size());
       assert (catIds.size() == graph.catIndexes.size());
       int ci = graph.catIndexes.size();
       graph.catIndexes.put(cat.getLocalId(), ci);
       catList.add(cat.getTitle().getCanonicalTitle());
       catIds.add(cat.getLocalId());
     }
   }
   graph.cats = catList.toArray(new String[0]);
   graph.catIds = catIds.toArray();
   LOG.info("finished loading " + graph.cats.length + " categories");
 }
 /**
  * @param localArticle the article to find
  * @return a map contains the LocalPageIDs and the LocalCategories of all the categories this
  *     article belongs to
  * @throws DaoException
  */
 @Override
 public Map<Integer, LocalPage> getCategories(LocalPage localArticle) throws DaoException {
   Collection<Integer> categoryIds = getCategoryIds(localArticle);
   LocalPageLiveDao dao = new LocalPageLiveDao();
   return dao.getByIds(localArticle.getLanguage(), categoryIds);
 }
 /**
  * @param localCategory the category to find
  * @return a map contains the LocalArticleIDs and the LocalArticle of all members in the given
  *     category
  * @throws DaoException
  */
 public Map<Integer, LocalPage> getCategoryMembers(LocalPage localCategory) throws DaoException {
   Collection<Integer> articleIds = getCategoryMemberIds(localCategory);
   LocalPageLiveDao dao = new LocalPageLiveDao();
   return dao.getByIds(localCategory.getLanguage(), articleIds);
 }
 /**
  * @param localPage the page
  * @return a collection of categoryids of all the categories this article belongs to
  * @throws DaoException
  */
 @Override
 public Collection<Integer> getCategoryIds(LocalPage localPage) throws DaoException {
   return getCategoryIds(localPage.getLanguage(), localPage.getLocalId());
 }
 /**
  * @param localCategory the category
  * @return a collection of the ids of all members in the given category
  * @throws DaoException
  */
 public Collection<Integer> getCategoryMemberIds(LocalPage localCategory) throws DaoException {
   return getCategoryMemberIds(localCategory.getLanguage(), localCategory.getLocalId());
 }